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: 190

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.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top