Tutorial Creating a Personal Stash for a player

woot

New Member
Reaction score
8
Personal Stash Tutorial

models_4370_screenshot_tnb.jpg


A stash is a unit that can store items for your hero if your hero's inventory is full. You just put the items in the stash and it will hold them for you. Many custom games have these stashes, 1 for each player scattered around the "base" or "town" area of the board.

This tutorial will show you how to create a personal stash: A single stash that is viewable by everyone playing, but is actually many stashes each accessible by a single player's hero.

Points:

- Uses a treasure chest model that opens and closes.
- One visible stash for all players that actually disguises many stashes, 1 stash for each player.
- The stash opens and closes on select. (The opening and closing will only be seen by the player who selects the stash)


Requirements:

- Stash model: Fill-Me-Up Treasure chest: http://www.hiveworkshop.com/forums/resource.php?t=50672
- Players must not be able to see invis units in the area that the stash will be (including invisible allied units .. so allies must not have shared vision)


A demo map is attached.

Process:

Object Manager:
- Import the Fill-Me-Up Treasure Chest model
- Create a new custom unit named Stash (I based it off footman.. setting the movement type to none and speed to 0, and the attacks allowed to none)
- Make sure the custom unit's collision size is 0
- Give the Stash the imported model
- Give the stash the Ghost ability, the Inventory (Hero) ability, and Invulnerability (Neutral) .. The ghost ability is so that each player can only see their own stash. The inventory ability allows you to store items.
- Copy the stash and paste it .. creating a new stash object
- Set the suffix of this new stash object to (Locust)
- Remove the ghost ability from the new stash object.. and add the Locust ability. Locust makes the new stash untargetable, and removing ghost makes it visible to all players
- Create a small square shaped region on the board where you want the stash to be located. name it Stash.
- Create a global Unit variable in your triggers named Stash
- Create a global location variable named tempPoint
- Create a global player variable named tempPlayer

Now for the triggers:

Initialization: Create the stashes for each player (invisible) and a dummy stash for neutral passive (visible, locust for untargetable):
Code:
Initialize
    Events
        Map initialization
    Conditions
    Actions
        -------- NECESSARY CODE --------
        Set tempPoint = (Center of Stash <gen>)
        -------- Create the dummy (locust) stash visible to all but selectable by none --------
        Unit - Create 1 Stash (Locust) for Neutral Passive at tempPoint facing 270.00 degrees
        Set Stash = (Last created unit)
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                -------- Create a stash for each player, visible by only that player --------
                Unit - Create 1 Stash for (Picked player) at tempPoint facing 270.00 degrees
        Custom script:   call RemoveLocation(udg_tempPoint)

On Select: Display the open animation for the stash to the player, and the opening animation for the locust stash for the local player (displaying it to only the player who opened the stash)
Code:
Selection
    Events
        Player - Player 1 (Red) Selects a unit
        Player - Player 2 (Blue) Selects a unit
        Player - Player 3 (Teal) Selects a unit
        Player - Player 4 (Purple) Selects a unit
        Player - Player 5 (Yellow) Selects a unit
        Player - Player 6 (Orange) Selects a unit
        Player - Player 7 (Green) Selects a unit
        Player - Player 8 (Pink) Selects a unit
        Player - Player 9 (Gray) Selects a unit
        Player - Player 10 (Light Blue) Selects a unit
        Player - Player 11 (Dark Green) Selects a unit
        Player - Player 12 (Brown) Selects a unit
    Conditions
    Actions
        -------- GetLocalPlayer() gets which player is running on the local computer --------
        Custom script:   set udg_tempPlayer = GetLocalPlayer()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Triggering unit)) Equal to Stash
            Then - Actions
                -------- Open the player's stash --------
                Animation - Play (Triggering unit)'s Morph animation
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Triggering unit)) Equal to tempPlayer
                    Then - Actions
                        -------- Open the local dummy stash --------
                        Animation - Play Stash's Morph animation
                    Else - Actions
            Else - Actions

On Deselect: Display the close animation for the player's stash, and locally for the dummy's stash
Code:
Deselection
    Events
        Player - Player 1 (Red) Deselects a unit
        Player - Player 2 (Blue) Deselects a unit
        Player - Player 3 (Teal) Deselects a unit
        Player - Player 4 (Purple) Deselects a unit
        Player - Player 5 (Yellow) Deselects a unit
        Player - Player 6 (Orange) Deselects a unit
        Player - Player 7 (Green) Deselects a unit
        Player - Player 8 (Pink) Deselects a unit
        Player - Player 9 (Gray) Deselects a unit
        Player - Player 10 (Light Blue) Deselects a unit
        Player - Player 11 (Dark Green) Deselects a unit
        Player - Player 12 (Brown) Deselects a unit
    Conditions
    Actions
        -------- GetLocalPlayer() gets which player is running on the local computer --------
        Custom script:   set udg_tempPlayer = GetLocalPlayer()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Triggering unit)) Equal to Stash
            Then - Actions
                -------- Close the player's stash --------
                Animation - Play (Triggering unit)'s Morph Alternate animation
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Triggering unit)) Equal to tempPlayer
                    Then - Actions
                        -------- Close the local dummy stash --------
                        Animation - Play Stash's Morph Alternate animation
                    Else - Actions
            Else - Actions


That's it! You're done!



Optional Stuff

You can also create an information ability and give it to your stash so players know what the stash is all about.

- Base the ability off of Devotion Aura (Neutral Hostile) .. call it Stash Information
- Change the icon to Box (under Extra)
- Change the Art Icon X position to 3 and the Y position to 2
- Change the Art (Target) to nothing
- Change the armor bonus to 0
- Change the area effect to 0
- Change the buffs to nothing
- Make sure Hero Ability is false
- Make sure Levels is 1
- Set Targets Allowed to None
- Under Tooltip Normal put "Stash Information"
- Under Tooltip Extended put a description of what a stash is.. From my demo map: "The Stash is your hero's personal place to store items if his/her inventory is full.|nOther players cannot access your stash."
- Give your stash this ability

Done!


Remember: For this to work properly players must not be able to see invisible in the area that the stash is located (including invisible allied units)



Enjoy! Comments are appreciated!
 

Attachments

  • PersonalStashTutorial.w3x
    27.5 KB · Views: 187

Darius34

New Member
Reaction score
30
This could work by hiding the stashes (for the local player). That way, the problem with True Sight could be worked around.

Tried-and-true method, anyway, and I have seen people ask about this. Quite a good tutorial.
 

woot

New Member
Reaction score
8
This could work by hiding the stashes (for the local player). That way, the problem with True Sight could be worked around.

Tried-and-true method, anyway, and I have seen people ask about this. Quite a good tutorial.

That works without desync?


let me test this and get back to you. i'll update the tutorial if it works


EDIT:

nope... it desyncs the game =\
 

Darius34

New Member
Reaction score
30
Hmm, that's strange... I've never done it myself, but I have read some posts on the subject. Can't find at link at the moment, though, and can't test it myself. Maybe you could post your code?

Another method could be to change the vertex colour (transparency) for local players - assuming the stashes are all placed at the same spot, the extra shadows wouldn't show.
 

woot

New Member
Reaction score
8
Hmm, that's strange... I've never done it myself, but I have read some posts on the subject. Can't find at link at the moment, though, and can't test it myself. Maybe you could post your code?

Another method could be to change the vertex colour (transparency) for local players - assuming the stashes are all placed at the same spot, the extra shadows wouldn't show.

The code I tried this out with is simply:

on initialize, when creating the stash objects for the players, if the local player is not equal to the player, hide the stash

I also added a check for if the local player is not the player to displaying the animation for the hidden stash, but that didn't help .. it desyncs


changing the transparency wouldn't help me, the idea is to keep the stash not selectable by other players, not just keep it invisible



I really wish it were possible to hide the stash to all players but the local player.. having this not work if you can see invis or if you have allies is kind of annoying :( If anyone has input on how to fix this please share
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top