• 🏆 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!

Visual Bag System - v0.1

  • Like
Reactions: Gregory Tountas
Description:
-31 more slots for your all of your heroes
-full multiboard display
-press "Escape" to put the first item from your inventory into your bag
-and write "-get " and the slot number to get it back

Note:
-this way you can also transfer items between heroes

Credits to Gamecrafter_DK for the idea of a bag system
His System supports an unlimited number of items and one hero (you may change this if you want) while mine supports only 31 items per player due to the multiboard limitation of 32 rows.

  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Game - Display to (All players) the text: Press "Esc" to put ...
    • -------- Create events --------
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • -------- This detects if the Escape key is pressed --------
        • Trigger - Add to BagSysStore <gen> the event (Player - (Picked player) skips a cinematic sequence)
        • -------- If you change this event remember to change the substring length in the BagSysGet Trigger --------
        • Trigger - Add to BagSysGet <gen> the event (Player - (Picked player) types a chat message containing -get as A substring)
        • -------- Save each player as a playergroup to prevent leaks --------
        • Set P2PG[(Player number of (Picked player))] = (Player group((Picked player)))
    • -------- Setup multiboard --------
    • -------- (this is not inlined cause it will hit the operation limit) --------
    • For each (Integer i2) from 1 to 12, do (Actions)
      • Loop - Actions
        • Trigger - Run BagSysIni2 <gen> (ignoring conditions)
    • Wait 0.00 game-time seconds
    • -------- Show multiboard depending on player --------
    • For each (Integer i2) from 1 to 12, do (Actions)
      • Loop - Actions
        • Custom script: if ConvertedPlayer(udg_i2) == GetLocalPlayer() then
        • Multiboard - Show BagSys_Multiboard[i2]
        • Custom script: endif
    • Skip remaining actions
    • -------- Additional messages --------
    • Game - Display to P2PG[i2] the text: (You put + ((Name of item) + into your bag))
    • Game - Display to P2PG[i2] the text: (You got + (Name of item))
  • Events
  • Conditions
  • Actions
    • Multiboard - Create a multiboard with 3 columns and 32 rows, titled Stuff that's in you...
    • Set BagSys_Multiboard[i2] = (Last created multiboard)
    • -------- Sub titles --------
    • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 1, row 1 to Slot
    • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row 1 to Item-Type
    • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 3, row 1 to Charges
    • For each (Integer i) from 1 to 32, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • i Not equal to 1
          • Then - Actions
            • -------- Slot number --------
            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 1, row i to (String((i - 1)))
            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row i to -
            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 3, row i to 0
          • Else - Actions
        • -------- Width --------
        • Multiboard - Set the width for BagSys_Multiboard[i2] item in column 1, row i to 2.00% of the total screen width
        • Multiboard - Set the width for BagSys_Multiboard[i2] item in column 2, row i to 10.00% of the total screen width
        • Multiboard - Set the width for BagSys_Multiboard[i2] item in column 3, row i to 3.00% of the total screen width
        • -------- Hide all icons --------
        • Multiboard - Set the display style for BagSys_Multiboard[i2] item in column 1, row i to Show text and Hide icons
        • Multiboard - Set the display style for BagSys_Multiboard[i2] item in column 2, row i to Show text and Hide icons
        • Multiboard - Set the display style for BagSys_Multiboard[i2] item in column 3, row i to Show text and Hide icons
  • Events
  • Conditions
  • Actions
    • -------- Detect selected units and check if one of them is a hero owned by the triggering player --------
    • Set i2 = (Player number of (Triggering player))
    • Set u = No unit
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Picked unit)) Equal to (Triggering player)
            • ((Picked unit) is A Hero) Equal to True
          • Then - Actions
            • Set u = (Picked unit)
          • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • u Equal to No unit
      • Then - Actions
        • -------- Player did not select a hero which belongs to him --------
        • Game - Display to P2PG[i2] the text: No valid unit selec...
      • Else - Actions
        • -------- Player did select a hero which belongs to him --------
        • -------- Search for an item in this hero's inventory --------
        • For each (Integer i) from 1 to 7, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • i Equal to 7
              • Then - Actions
                • -------- No items --------
                • Game - Display to P2PG[i2] the text: This unit does not ...
                • Skip remaining actions
              • Else - Actions
            • Set item = (Item carried by u in slot i)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • item Equal to No item
              • Then - Actions
                • -------- No item in this slot --------
                • -------- Continue --------
              • Else - Actions
                • -------- Found an item --------
                • -------- Search for an empty slot in the bag --------
                • For each (Integer i) from 2 to 33, do (Actions)
                  • Loop - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • i Equal to 33
                      • Then - Actions
                        • -------- Full bag --------
                        • Game - Display to P2PG[i2] the text: Your bag is full
                        • Skip remaining actions
                      • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • BagSys_Item[((i2 x 32) + i)] Equal to No item
                      • Then - Actions
                        • -------- Found empty slot --------
                        • -------- Save item --------
                        • Set BagSys_Item[((i2 x 32) + i)] = item
                        • Set loc = (Position of u)
                        • -------- Hide item --------
                        • Item - Move item to loc
                        • Item - Hide item
                        • Custom script: call RemoveLocation(udg_loc)
                        • -------- Redraw multiboard --------
                        • -------- It seems like there is a difference between an empty string and no string --------
                        • Custom script: set udg_s2 = null
                        • For each (Integer i) from 2 to 32, do (Actions)
                          • Loop - Actions
                            • Set s = (Name of BagSys_Item[((i2 x 32) + i)])
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • s Equal to s2
                              • Then - Actions
                                • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row i to -
                              • Else - Actions
                                • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row i to (Name of BagSys_Item[((i2 x 32) + i)])
                            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 3, row i to (String((Charges remaining in BagSys_Item[((i2 x 32) + i)])))
                        • Skip remaining actions
                      • Else - Actions
  • Events
  • Conditions
  • Actions
    • Set i2 = (Player number of (Triggering player))
    • -------- Get the entered slot number --------
    • Set s = (Entered chat string)
    • Set s2 = (Substring(s, 1, 5))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • s2 Equal to -get
      • Then - Actions
        • Set s2 = (Substring(s, 6, 7))
        • Set i = (Integer(s2))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • i Greater than 0
            • i Less than 33
          • Then - Actions
            • Set u = No unit
            • Custom script: set bj_wantDestroyGroup = true
            • -------- Check for valid hero --------
            • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Owner of (Picked unit)) Equal to (Triggering player)
                    • ((Picked unit) is A Hero) Equal to True
                  • Then - Actions
                    • Set u = (Picked unit)
                  • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • u Equal to No unit
              • Then - Actions
                • -------- Player did not select a hero which belongs to him --------
                • Game - Display to P2PG[i2] the text: Please select a val...
              • Else - Actions
                • -------- Increase i by 1 cause we started with slot 0 --------
                • Set i = (i + 1)
                • Set item = BagSys_Item[((i2 x 32) + i)]
                • -------- Check if slot contains an item --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • item Equal to No item
                  • Then - Actions
                    • -------- No item in this slot --------
                    • Game - Display to P2PG[i2] the text: This slot is empty
                  • Else - Actions
                    • -------- Give item to hero and delete itemslot --------
                    • Hero - Give item to u
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (u has item) Equal to False
                      • Then - Actions
                        • -------- If the unit does not get the item it has a full inventory --------
                        • -------- In this case the item will be moved next to this unit and be revealed --------
                        • Set loc = (Position of u)
                        • Item - Move item to loc
                        • Custom script: call RemoveLocation(udg_loc)
                        • -------- Tell the player about it so he does not forget about the item --------
                        • Game - Display to P2PG[i2] the text: This unit's invento...
                      • Else - Actions
                    • Set BagSys_Item[((i2 x 32) + i)] = No item
                    • -------- Redraw multiboard --------
                    • Custom script: set udg_s2 = null
                    • For each (Integer i) from 2 to 32, do (Actions)
                      • Loop - Actions
                        • Set s = (Name of BagSys_Item[((i2 x 32) + i)])
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • s Equal to s2
                          • Then - Actions
                            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row i to -
                          • Else - Actions
                            • Multiboard - Set the text for BagSys_Multiboard[i2] item in column 2, row i to (Name of BagSys_Item[((i2 x 32) + i)])
          • Else - Actions
            • -------- Unvalid slot --------
            • Game - Display to P2PG[i2] the text: Please enter a slot...
      • Else - Actions
Keywords:
bag, system,
Contents

Bag System (Map)

Reviews
11:04, 17th Jun 2010 Hanky: There is no need for the trigger BagSysIni2 just add the actions to the loop in the BagSysIni trigger. Also you could add some more documentation since it's a system. But your system works fine and maybe it's useful...

Moderator

M

Moderator

11:04, 17th Jun 2010
Hanky:
There is no need for the trigger BagSysIni2 just add the actions to the loop in the BagSysIni trigger. Also you could add some more documentation since it's a system.

But your system works fine and maybe it's useful enough for some guys.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
So, don't you think we have enough choices of such systems?

sure we have a lot but they fill 2 item slots and/or are JASS or not exactly what I wanted
of cause yours is better for mayor requirements (if you wanted me to say that ;)

And for what kind of map is this inventory system useful?
I mean, it takes ages to load/unload items.

the loading is quite fast
I also think that unloading is quite slow but it appears to be the fastest way without trackables
-spells won't work since I would need 31 (1 for each slot)
-I can't click them
-wandering around with the arrow keys would requite more triggers without being a lot faster
-changing the eventstring would be the best idea I think but I did not decide which letter/symbol would be best

edit:
just red your description of your inventory system and you pointed out the reasons already

QUOTE
____________________________
What it [your custom inventory] isn’t
This isn’t
finished.
in GUI
useable without the knowledge of vJass.
____________________________

mine is the opposite

edit2:
your system is the only "spell" which is voted "Director's Cut" xD

edit3:
feel free to tell me about any better way to unload the items but I doubt that there is anything easier to implant than this
 
Last edited:
This Trigger is Intence!!! question though, if i wanted it upgradible (EG you have small bag, 8 slots, you have big bag, 16 slots) how would i propose to change the slot maxium inside the trigger for each individual player? or would i have to copy/paste the trigger and build a set of seprate versons A-B controled by som body gaining a speical item?

no idea im a terrible trigger'er.

in either case this is intence, one of my fav spells iv ever seen on here. 9.5/10 doooood!
 
Top