• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make a pouch?

Status
Not open for further replies.
Level 14
Joined
Jan 7, 2017
Messages
466
Hello guys Wardota2 Gamer here and I really wanna know how to creat a pouch to where you put you extra items there when the invitory of the hero is full?

The example is the puch in @Turnro's campgain Mal'Furions Quest as you in the campgain Mal'Furion carries a druid pouch which you can carry extra items.
 
Level 16
Joined
Mar 24, 2017
Messages
827
I think the mechanic behind it is a hero that is disabled, but that can carry items and always stays close to your hero, sadly I dont really know how the rest works :(
 
Level 14
Joined
Oct 8, 2012
Messages
498
I don't know about the pouch you're talking about but I made a very basic backpack system that do the same. It might at least give you an idea if it's not what you're looking for ;P

I put lots of comments in there so you can understand what's going on. Don't worry, it's simple and easy to learn. Made it as basic as I can.

  • Backpack
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
    • Conditions
    • Actions
      • -------- We first set the variable of a temporary unit we will use, which is the player hero. --------
      • -------- Player 1 uses [1]. --------
      • -------- Player 2 uses [2]. --------
      • -------- and so on... --------
      • Set TempUnit = HERO[(Player number of (Triggering player))]
      • -------- So, if you're Player 1, then this is equal to HERO[1] --------
      • -------- --------
      • -------- --------
      • -------- MOST IMPORTANT PART: THE KEY --------
      • -------- This is how we get the unique id of a unit. Every unit has one. Kinda like human DNA. --------
      • Custom script: set udg_TempHandle = GetHandleId( udg_TempUnit )
      • -------- --------
      • -------- --------
      • For each (Integer TempInteger) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set TempItemA = (Item carried by TempUnit in slot TempInteger)
          • -------- --------
          • -------- --------
          • -------- CLEARING THE INVENTORY --------
          • -------- If slot not empty, drop and hide the item. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempItemA Not equal to No item
            • Then - Actions
              • Hero - Drop TempItemA from TempUnit
              • Item - Hide TempItemA
            • Else - Actions
              • -------- We use the dummy item NO_ITEM because the standard NoItem is buggy when used in Hashtables! --------
              • Set TempItemA = NO_ITEM
          • -------- --------
          • -------- --------
          • -------- LOADING THE ITEMS FROM THE LAST INVENTORY --------
          • -------- Now, we load the items we saved in the Main backpack. --------
          • Set TempItemB = (Load TempInteger of TempHandle in HASHTABLE)
          • -------- Notice that I used TempItemB so that TempItemA won't be overwritten. We need to save it later afterall. --------
          • -------- --------
          • -------- If loaded item slot is not empty, give the item to unit. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempItemB Not equal to No item
              • TempItemB Not equal to NO_ITEM
            • Then - Actions
              • Item - Show TempItemB
              • Hero - Give TempItemB to TempUnit
              • Unit - Order TempUnit to move TempItemB to inventory slot TempInteger
            • Else - Actions
          • -------- --------
          • -------- --------
          • -------- SAVING THE ITEMS AS THE LAST INVENTORY --------
          • -------- Below, we save the itemA in a Hashtable, using the player hero's unique id (every unit has unique id for them) --------
          • Hashtable - Save Handle OfTempItemA as TempInteger of TempHandle in HASHTABLE
          • -------- Here we finally saved TempItemA in a Hashtable so that we can load it later the next time the player pressed ESC. --------
          • -------- --------
          • -------- --------
          • -------- It just looks long and complicated because of all the comments. But it's really simple and easy to understand. --------
          • -------- No memory leak here. --------
          • -------- NOTE: This system is MUI, meaning every unit in the map can have 2 inventories. Provided they are player controlled. --------
          • -------- Otherwise, there is no player to press ESC to toggle it for them. --------
 

Attachments

  • BasicBackpackSystem.w3x
    21.4 KB · Views: 15
Last edited:
Status
Not open for further replies.
Top