1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  5. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  6. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  7. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  8. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Inventory Extension

Submitted by D4RK_G4ND4LF
This bundle is marked as approved. It works and satisfies the submission rules.
This system emulates an unlimited number of inventory slots.

Has:
-support for a great range of stat canges
-support for an unlimited number of units
-different borders for Humans/Orcs/Undeads/Nightelfs

Credits to Red_Cap and Gh0strid4h for betatesting and everyone in the thread for constructive criticism (that excludes zero :p)

Changes:
26.08.2010 12:43: made inventory tiles use paletted compression
05.09.2010 13:37: added borders for 4 races; changed wait to timers so units will move 0 instead of 0.00001; locked camera (don't like that myself but other peoples do and it is easy to delete again....)
06.09.2010 21:27: deleted support for race-based inventory-base-tile-support (borders still work), had some blizzard-related GetLolcaPlayer()-bug, working on it
06.09.2010 21:35: fixed graphic glitch caused by unaccurate rendering of models making tiny little black pixels (blizzards fault again, 4th time in this system)

Trigger
  • Inventory Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Display to (All players) for 0.00 seconds the text: Select an item with...
      • Hashtable - Create a hashtable
      • Set Inventory_Hashtable = (Last created hashtable)
      • -------- Number of supported item types --------
      • Set Inventory_ItemNumber = 8
      • -------- Number of inventory slots --------
      • Set Inventory_ButtonNumber = 45
      • -------- Number of columns --------
      • Hashtable - Save 9 as (Key Columns) of 0 in Inventory_Hashtable
      • Set Inventory_Ability = Inventory
      • Set Inventory_Camera[0] = Camera 001 <gen>
      • -------- Area of inventory --------
      • Set Inventory_Rect = (Region(-1280.00, 512.00, -512.00, 1024.00))
      • -------- Upper left corner X --------
      • Hashtable - Save -1150.00 as (Key X) of 0 in Inventory_Hashtable
      • -------- Upper left corner Y --------
      • Hashtable - Save 900.00 as (Key Y) of 0 in Inventory_Hashtable
      • -------- Hide borders --------
      • Destructible - Pick every destructible in Inventory_Rect and do (Actions)
        • Loop - Actions
          • Destructible - Hide (Picked destructible)
      • -------- Remove borders and create new ones to fix a bug --------
      • -------- (If you create a destructable on another destructable the height is different and caues weird graphic glitches) --------
      • Destructible - Pick every destructible in Inventory_Rect and do (Actions)
        • Loop - Actions
          • Set d = (Picked destructible)
          • Custom script: set udg_d2 = CreateDestructable(GetDestructableTypeId(udg_d), GetWidgetX(udg_d), GetWidgetY(udg_d), 0.00, 1, 0 )
          • Destructible - Remove d
          • Custom script: call SetDestructableInvulnerable(udg_d2, true)
          • Custom script: call ShowDestructable(udg_d2, false)
      • For each (Integer i) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set p = (Player(i))
          • Visibility - Create an initially Disabled visibility modifier for p emitting Visibility across Inventory_Rect
          • Set Inventory_Vision[i] = (Last created visibility modifier)
          • Set P2G[i] = (Player group(p))
      • Set zLoc = (Point(0.00, 0.00))
      • -------- Set inventory tile based on player race --------
      • Custom script: set udg_p = GetLocalPlayer()
      • If ((Race of p) Equal to Human) then do (Set Inventory_Button[0] = war3mapImported\HuInvTile.blp) else do (-------- Do Nothing --------)
      • If ((Race of p) Equal to Orc) then do (Set Inventory_Button[0] = war3mapImported\OrcInvTile.blp) else do (-------- Do Nothing --------)
      • If ((Race of p) Equal to Undead) then do (Set Inventory_Button[0] = war3mapImported\UdInvTile.blp) else do (-------- Do Nothing --------)
      • If ((Race of p) Equal to Night Elf) then do (Set Inventory_Button[0] = war3mapImported\NeInvTile.blp) else do (-------- Do Nothing --------)
      • -------- ITEM SETUP --------
      • -------- ITEM SETUP --------
      • -------- ITEM SETUP --------
      • -------- Item index --------
      • Set i = 1
      • -------- Button type --------
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNBelt.blp
      • -------- Item type --------
      • Set Inventory_ItemType[i] = Belt of Giant Strength +6
      • -------- Convert item id to integer --------
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • -------- Number of stat modifications --------
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • -------- Type of stat modification --------
      • Hashtable - Save 5 as 1 of i in Inventory_Hashtable
      • -------- Ammount of added stats --------
      • Hashtable - Save 6 as 2 of i in Inventory_Hashtable
      • Set i = 2
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNClawsOfAttack.blp
      • Set Inventory_ItemType[i] = Claws of Attack +15
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 1 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 15 as 2 of i in Inventory_Hashtable
      • Set i = 3
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNHelmOfValor.blp
      • Set Inventory_ItemType[i] = Helm of Valor
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 2 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 5 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 4 as 2 of i in Inventory_Hashtable
      • Hashtable - Save 6 as 3 of i in Inventory_Hashtable
      • Hashtable - Save 4 as 4 of i in Inventory_Hashtable
      • Set i = 4
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNPendantOfMana.blp
      • Set Inventory_ItemType[i] = Pendant of Mana
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 4 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 250 as 2 of i in Inventory_Hashtable
      • Set i = 5
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNPeriapt.blp
      • Set Inventory_ItemType[i] = Periapt of Vitality
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 3 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 150 as 2 of i in Inventory_Hashtable
      • Set i = 6
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNPeriapt1.blp
      • Set Inventory_ItemType[i] = Khadgar's Gem of Health
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 3 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 300 as 2 of i in Inventory_Hashtable
      • Set i = 7
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNMedalionOfCourage.blp
      • Set Inventory_ItemType[i] = Medallion of Courage
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 2 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 5 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 4 as 2 of i in Inventory_Hashtable
      • Hashtable - Save 7 as 3 of i in Inventory_Hashtable
      • Hashtable - Save 4 as 4 of i in Inventory_Hashtable
      • Set i = 8
      • Set Inventory_Button[i] = ReplaceableTextures\CommandButtons\BTNRingGreen.blp
      • Set Inventory_ItemType[i] = Ring of Protection +5
      • Custom script: set udg_i = udg_Inventory_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in Inventory_Hashtable
      • Hashtable - Save 0 as 1 of i in Inventory_Hashtable
      • Hashtable - Save 5 as 2 of i in Inventory_Hashtable
      • -------- ITEM SETUP END --------
      • -------- ITEM SETUP END --------
      • -------- ITEM SETUP END --------
      • -------- Setup borders --------
      • -------- Create inventorys for preplaced heros --------
      • Custom script: call GroupEnumUnitsInRect(udg_g, bj_mapInitialPlayableArea, null)
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u is A Hero) Equal to True
            • Then - Actions
              • Trigger - Run Inventory NewInventory <gen> (checking conditions)
            • Else - Actions
  • Inventory NewUnit
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • -------- Create an inventory for new hero --------
      • Set u = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (u is A Hero) Equal to True
        • Then - Actions
          • Trigger - Run Inventory NewInventory <gen> (checking conditions)
        • Else - Actions
  • Inventory NewInventory
    • Events
    • Conditions
    • Actions
      • -------- Add inventory ability to unit --------
      • Unit - Add Inventory_Ability to u
      • -------- Get handle id of unit u --------
      • Custom script: set udg_i = GetHandleId(udg_u)
      • -------- Number of columns --------
      • Set i3 = (Load (Key Columns) of 0 from Inventory_Hashtable)
      • -------- Upper left corner X --------
      • Set x2 = (Load (Key X) of 0 from Inventory_Hashtable)
      • -------- Upper left corner Y --------
      • Set y2 = (Load (Key Y) of 0 from Inventory_Hashtable)
      • For each (Integer i2) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
        • Loop - Actions
          • Set x = ((Real(((i2 mod i3) x 64))) + x2)
          • Set y = ((Real(((i2 / i3) x -64))) + y2)
          • Custom script: call MoveLocation(udg_zLoc, udg_x, udg_y)
          • -------- Create button --------
          • Destructible - Create a Inventory_Button[0] at zLoc facing 0.00 with scale 1.00 and variation 0
          • -------- Hide button --------
          • Custom script: call ShowDestructable(bj_lastCreatedDestructable, false)
          • -------- Make invulnerable --------
          • Custom script: call SetDestructableInvulnerable(bj_lastCreatedDestructable, true)
          • -------- Save button --------
          • Hashtable - Save Handle Of(Last created destructible) as i2 of i in Inventory_Hashtable
  • Inventory OpenClose
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(magicdefense))
          • (Issued order) Equal to (Order(magicundefense))
    • Actions
      • Set u = (Triggering unit)
      • Set p = (Owner of u)
      • Set i3 = (Player number of p)
      • -------- If inventory is open already --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (p is in Inventory_Players) Equal to False
        • Then - Actions
          • -------- Check if unit is valid (hero, owned by that player) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of u) Equal to p
              • (u is A Hero) Equal to True
            • Then - Actions
              • -------- Backup camera --------
              • Set Inventory_Camera[i3] = (Current camera)
              • -------- Apply inventory cam --------
              • Camera - Apply Inventory_Camera[0] for p over 0.00 seconds
              • -------- Apply cam lock --------
              • -------- If you don't want cam lock delete the CamLock trigger --------
              • Trigger - Turn on Inventory CamLock <gen>
              • -------- Save player to active inventory players --------
              • Player Group - Add p to Inventory_Players
              • -------- Save hero --------
              • Set Inventory_Hero[i3] = u
              • -------- Get hero handle id --------
              • Custom script: set udg_i = GetHandleId(udg_u)
              • -------- Set last button selected to false --------
              • Hashtable - Save -1 as (Key Last) of i in Inventory_Hashtable
              • -------- Reveal inventory area --------
              • Visibility - Enable Inventory_Vision[i3]
              • -------- Load first button --------
              • Set d = (Load 0 of i in Inventory_Hashtable)
              • Custom script: call MoveLocation(udg_zLoc, GetWidgetX(udg_d), GetWidgetY(udg_d))
              • -------- Show buttons for owner of hero --------
              • Custom script: set udg_b = udg_p == GetLocalPlayer()
              • For each (Integer i2) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
                • Loop - Actions
                  • Set d = (Load i2 of i in Inventory_Hashtable)
                  • Custom script: call ShowDestructable(udg_d, udg_b)
              • -------- Load hp of border type --------
              • -------- Each border type has a special hp number (human borders have 99991 hp, orc borders 99992, etc.) --------
              • If ((Race of p) Equal to Human) then do (Set r = 99991.00) else do (-------- Do Nothing --------)
              • If ((Race of p) Equal to Orc) then do (Set r = 99992.00) else do (-------- Do Nothing --------)
              • If ((Race of p) Equal to Undead) then do (Set r = 99993.00) else do (-------- Do Nothing --------)
              • If ((Race of p) Equal to Night Elf) then do (Set r = 99994.00) else do (-------- Do Nothing --------)
              • Destructible - Pick every destructible in Inventory_Rect and do (Actions)
                • Loop - Actions
                  • Set d = (Picked destructible)
                  • Custom script: if GetWidgetLife(udg_d) == udg_r then
                  • Custom script: call ShowDestructable(udg_d, udg_b)
                  • Custom script: endif
            • Else - Actions
              • Game - Display to P2G[i3] the text: Please select a val...
        • Else - Actions
          • -------- Reset camera --------
          • Camera - Apply Inventory_Camera[i3] for p over 0.00 seconds
          • -------- Load hero --------
          • Set u = Inventory_Hero[i3]
          • Custom script: call MoveLocation(udg_zLoc, GetUnitX(udg_u), GetUnitY(udg_u))
          • -------- Get hero handle id --------
          • Custom script: set udg_i = GetHandleId(udg_u)
          • -------- Remove player from active inventory players --------
          • Player Group - Remove p from Inventory_Players
          • -------- Disable vision of inventory area --------
          • Visibility - Disable Inventory_Vision[i3]
          • -------- Destroy selection effect --------
          • Special Effect - Destroy (Load (Key Effect) of i in Inventory_Hashtable)
          • -------- Hide buttons --------
          • Set b = False
          • For each (Integer i2) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
            • Loop - Actions
              • Set d = (Load i2 of i in Inventory_Hashtable)
              • Custom script: call ShowDestructable(udg_d, udg_b)
          • Destructible - Pick every destructible in Inventory_Rect and do (Actions)
            • Loop - Actions
              • Custom script: call ShowDestructable(GetEnumDestructable(), udg_b)
  • Inventory GetClick
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Owner of (Triggering unit)) is in Inventory_Players) Equal to True
    • Actions
      • Set p = (Owner of (Triggering unit))
      • -------- Get the coordinates of the order point --------
      • Custom script: set udg_x = GetOrderPointX()
      • Custom script: set udg_y = GetOrderPointY()
      • -------- Load hero --------
      • Set u = Inventory_Hero[(Player number of p)]
      • -------- If hero is alive --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of u) Greater than 0.00
        • Then - Actions
          • -------- Get hero handle id --------
          • Custom script: set udg_i = GetHandleId(udg_u)
          • -------- Loop through inventory slots --------
          • For each (Integer i2) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
            • Loop - Actions
              • -------- Load button --------
              • Set d = (Load i2 of i in Inventory_Hashtable)
              • -------- Get position --------
              • Custom script: set udg_x2 = GetWidgetX(udg_d)
              • Custom script: set udg_y2 = GetWidgetY(udg_d)
              • -------- Check distance between click and current button --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Abs((x - x2))) Less than 32.00
                  • (Abs((y - y2))) Less than 32.00
                • Then - Actions
                  • -------- Load last selected button number --------
                  • Set i3 = (Load (Key Last) of i from Inventory_Hashtable)
                  • -------- If -1 there was no last selected button --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • i3 Not equal to -1
                    • Then - Actions
                      • Custom script: call MoveLocation(udg_zLoc, udg_x2, udg_y2)
                      • -------- Destroy old selection effect --------
                      • Special Effect - Destroy (Load (Key Effect) of i in Inventory_Hashtable)
                      • -------- set d2 to last selected button --------
                      • Set d2 = (Load i3 of i in Inventory_Hashtable)
                      • -------- Set last button to false --------
                      • Hashtable - Save -1 as (Key Last) of i in Inventory_Hashtable
                      • Set item = (Load i of i2 in Inventory_Hashtable)
                      • -------- Check doubleclick --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • d Equal to d2
                        • Then - Actions
                          • -------- If tile not empty --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Destructible-type of d) Not equal to Inventory_Button[0]
                            • Then - Actions
                              • -------- Set tile empty --------
                              • Destructible - Remove d
                              • Destructible - Create a Inventory_Button[0] at zLoc facing 0.00 with scale 1.00 and variation 0
                              • Hashtable - Save Handle Of(Last created destructible) as i2 of i in Inventory_Hashtable
                              • -------- Drop item --------
                              • Custom script: call MoveLocation(udg_zLoc, GetUnitX(udg_u), GetUnitY(udg_u))
                              • Item - Move item to zLoc
                              • -------- Disable trigger so it won't trigger pickup event --------
                              • Trigger - Turn off Inventory AcquireItem <gen>
                              • Hero - Give item to u
                              • Trigger - Turn on Inventory AcquireItem <gen>
                              • -------- Update stats --------
                              • Trigger - Run Bonus SetStatsUnit <gen> (ignoring conditions)
                            • Else - Actions
                        • Else - Actions
                          • -------- Swap tiles and items --------
                          • Set dt = (Destructible-type of d)
                          • Set dt2 = (Destructible-type of d2)
                          • Custom script: set udg_x2 = GetWidgetX(udg_d2)
                          • Custom script: set udg_y2 = GetWidgetY(udg_d2)
                          • Destructible - Remove d
                          • Destructible - Remove d2
                          • Destructible - Create a dt2 at zLoc facing 0.00 with scale 1.00 and variation 0
                          • Hashtable - Save Handle Of(Last created destructible) as i2 of i in Inventory_Hashtable
                          • Custom script: call MoveLocation(udg_zLoc, udg_x2, udg_y2)
                          • Destructible - Create a dt at zLoc facing 0.00 with scale 1.00 and variation 0
                          • Hashtable - Save Handle Of(Last created destructible) as i3 of i in Inventory_Hashtable
                          • Hashtable - Save Handle Of(Load i of i3 in Inventory_Hashtable) as i of i2 in Inventory_Hashtable
                          • Hashtable - Save Handle Ofitem as i of i3 in Inventory_Hashtable
                    • Else - Actions
                      • -------- Destroy old effect --------
                      • Special Effect - Destroy (Load (Key Effect) of i in Inventory_Hashtable)
                      • Hashtable - Save i2 as (Key Last) of i in Inventory_Hashtable
                      • -------- Create selection effect for local player --------
                      • Set s = <Empty String>
                      • Custom script: if udg_p == GetLocalPlayer() then
                      • Set s = war3mapImported\BTNselection.mdx
                      • Custom script: endif
                      • Custom script: call MoveLocation(udg_zLoc, udg_x2, udg_y2)
                      • Special Effect - Create a special effect at zLoc using s
                      • Hashtable - Save Handle Of(Last created special effect) as (Key Effect) of i in Inventory_Hashtable
                  • -------- Stop hero from walking around --------
                  • Unit - Order Inventory_Stop to Stop
                  • Set Inventory_Stop = u
                  • Countdown Timer - Start Inventory_Timer as a One-shot timer that will expire in 0.00 seconds
                  • -------- Skip all other actions since the button was found already --------
                  • Skip remaining actions
                • Else - Actions
        • Else - Actions
          • Game - Display to P2G[(Player number of p)] the text: Your hero is dead
  • Inventory AcquireItem
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set u = (Triggering unit)
      • Set p = (Owner of u)
      • Set i3 = (Key (Triggering unit))
      • -------- Loop through all item types --------
      • For each (Integer i) from 1 to Inventory_ItemNumber, do (Actions)
        • Loop - Actions
          • -------- If current item = acquired item --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Inventory_ItemType[i]
            • Then - Actions
              • -------- Loop through inventory slots --------
              • For each (Integer i2) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
                • Loop - Actions
                  • -------- If slot is empty --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Destructible-type of (Load i2 of i3 in Inventory_Hashtable)) Equal to Inventory_Button[0]
                    • Then - Actions
                      • -------- Save item --------
                      • Hashtable - Save Handle Of(Item being manipulated) as i3 of i2 in Inventory_Hashtable
                      • Set d = (Load i2 of i3 in Inventory_Hashtable)
                      • Custom script: call MoveLocation(udg_zLoc, GetWidgetX(udg_d), GetWidgetY(udg_d))
                      • -------- Hide item --------
                      • Item - Move (Item being manipulated) to zLoc
                      • Item - Hide (Item being manipulated)
                      • Destructible - Remove d
                      • -------- Create a button for item type --------
                      • Destructible - Create a Inventory_Button[i] at zLoc facing 0.00 with scale 1.00 and variation 0
                      • -------- Save new button --------
                      • Hashtable - Save Handle Of(Last created destructible) as i2 of i3 in Inventory_Hashtable
                      • -------- Show item if inventory is active for owning player --------
                      • Set b = False
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (p is in Inventory_Players) Equal to True
                        • Then - Actions
                          • Custom script: set udg_b = udg_p == GetLocalPlayer()
                        • Else - Actions
                      • Custom script: call ShowDestructable(bj_lastCreatedDestructable, udg_b)
                      • -------- Update stats --------
                      • Trigger - Run Bonus SetStatsUnit <gen> (ignoring conditions)
                      • -------- Item got saved in inventory; stop doing stuff --------
                      • Skip remaining actions
                    • Else - Actions
            • Else - Actions
  • Inventory Stop
    • Events
      • Time - Inventory_Timer expires
    • Conditions
    • Actions
      • -------- Stops a unit from walking into the inventory --------
      • Unit - Order Inventory_Stop to Stop
      • Set Inventory_Stop = No unit
  • Inventory CamLock
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Set player to no player --------
      • Custom script: set udg_p = null
      • -------- Lock cam --------
      • Player Group - Pick every player in Inventory_Players and do (Actions)
        • Loop - Actions
          • Set p = (Picked player)
          • Camera - Apply Inventory_Camera[0] for p over 0.00 seconds
      • -------- If player was not set to non-null player turn off because the group is empty --------
      • Custom script: if udg_p == null then
      • Trigger - Turn off (This trigger)
      • Custom script: endif
  • Bonus Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Number of bonus types --------
      • Set Bonus_Number = 8
      • Set Bonus_Ability[0] = Item Armor Bonus (+1)
      • Set Bonus_Ability[1] = Item Armor Bonus (+2)
      • Set Bonus_Ability[2] = Item Armor Bonus (+4)
      • Set Bonus_Ability[3] = Item Armor Bonus (+8)
      • Set Bonus_Ability[4] = Item Armor Bonus (+16)
      • Set Bonus_Ability[5] = Item Armor Bonus (+32)
      • Set Bonus_Ability[6] = Item Armor Bonus (+64)
      • Set Bonus_Ability[7] = Item Armor Bonus (+128)
      • Set Bonus_Ability[8] = Item Armor Bonus (+256)
      • Set Bonus_Ability[9] = Item Armor Bonus (+512)
      • Set Bonus_Ability[100] = Item Damage Bonus (+1)
      • Set Bonus_Ability[101] = Item Damage Bonus (+2)
      • Set Bonus_Ability[102] = Item Damage Bonus (+4)
      • Set Bonus_Ability[103] = Item Damage Bonus (+8)
      • Set Bonus_Ability[104] = Item Damage Bonus (+16)
      • Set Bonus_Ability[105] = Item Damage Bonus (+32)
      • Set Bonus_Ability[106] = Item Damage Bonus (+64)
      • Set Bonus_Ability[107] = Item Damage Bonus (+128)
      • Set Bonus_Ability[108] = Item Damage Bonus (+256)
      • Set Bonus_Ability[109] = Item Damage Bonus (+512)
      • Set Bonus_Ability[110] = Item Damage Bonus (+1024)
      • Set Bonus_Ability[111] = Item Damage Bonus (+2048)
      • Set Bonus_Ability[112] = Item Damage Bonus (+4096)
      • Set Bonus_Ability[113] = Item Damage Bonus (+8192)
      • Set Bonus_Ability[114] = Item Damage Bonus (+16384)
      • Set Bonus_Ability[115] = Item Damage Bonus (+32768)
      • Set Bonus_Ability[200] = Item Attack Speed Bonus (+1)
      • Set Bonus_Ability[201] = Item Attack Speed Bonus (+2)
      • Set Bonus_Ability[202] = Item Attack Speed Bonus (+4)
      • Set Bonus_Ability[203] = Item Attack Speed Bonus (+8)
      • Set Bonus_Ability[204] = Item Attack Speed Bonus (+16)
      • Set Bonus_Ability[205] = Item Attack Speed Bonus (+32)
      • Set Bonus_Ability[206] = Item Attack Speed Bonus (+64)
      • Set Bonus_Ability[207] = Item Attack Speed Bonus (+128)
      • Set Bonus_Ability[208] = Item Attack Speed Bonus (+256)
      • Set Bonus_Ability[209] = Item Attack Speed Bonus (+512)
      • Set Bonus_Ability[300] = Item Life Bonus (+1)
      • Set Bonus_Ability[301] = Item Life Bonus (+2)
      • Set Bonus_Ability[302] = Item Life Bonus (+4)
      • Set Bonus_Ability[303] = Item Life Bonus (+8)
      • Set Bonus_Ability[304] = Item Life Bonus (+16)
      • Set Bonus_Ability[305] = Item Life Bonus (+32)
      • Set Bonus_Ability[306] = Item Life Bonus (+64)
      • Set Bonus_Ability[307] = Item Life Bonus (+128)
      • Set Bonus_Ability[308] = Item Life Bonus (+256)
      • Set Bonus_Ability[309] = Item Life Bonus (+512)
      • Set Bonus_Ability[310] = Item Life Bonus (+1024)
      • Set Bonus_Ability[311] = Item Life Bonus (+2048)
      • Set Bonus_Ability[312] = Item Life Bonus (+4096)
      • Set Bonus_Ability[313] = Item Life Bonus (+8192)
      • Set Bonus_Ability[314] = Item Life Bonus (+16384)
      • Set Bonus_Ability[315] = Item Life Bonus (+32768)
      • Set Bonus_Ability[400] = Item Mana Bonus (+1)
      • Set Bonus_Ability[401] = Item Mana Bonus (+2)
      • Set Bonus_Ability[402] = Item Mana Bonus (+4)
      • Set Bonus_Ability[403] = Item Mana Bonus (+8)
      • Set Bonus_Ability[404] = Item Mana Bonus (+16)
      • Set Bonus_Ability[405] = Item Mana Bonus (+32)
      • Set Bonus_Ability[406] = Item Mana Bonus (+64)
      • Set Bonus_Ability[407] = Item Mana Bonus (+128)
      • Set Bonus_Ability[408] = Item Mana Bonus (+256)
      • Set Bonus_Ability[409] = Item Mana Bonus (+512)
      • Set Bonus_Ability[410] = Item Mana Bonus (+1024)
      • Set Bonus_Ability[411] = Item Mana Bonus (+2048)
      • Set Bonus_Ability[412] = Item Mana Bonus (+4096)
      • Set Bonus_Ability[413] = Item Mana Bonus (+8192)
      • Set Bonus_Ability[414] = Item Mana Bonus (+16384)
      • Set Bonus_Ability[415] = Item Mana Bonus (+32768)
      • Set Bonus_Ability[500] = Item Strength Bonus (+1)
      • Set Bonus_Ability[501] = Item Strength Bonus (+2)
      • Set Bonus_Ability[502] = Item Strength Bonus (+4)
      • Set Bonus_Ability[503] = Item Strength Bonus (+8)
      • Set Bonus_Ability[504] = Item Strength Bonus (+16)
      • Set Bonus_Ability[505] = Item Strength Bonus (+32)
      • Set Bonus_Ability[506] = Item Strength Bonus (+64)
      • Set Bonus_Ability[507] = Item Strength Bonus (+128)
      • Set Bonus_Ability[508] = Item Strength Bonus (+256)
      • Set Bonus_Ability[509] = Item Strength Bonus (+512)
      • Set Bonus_Ability[600] = Item Agility Bonus (+1)
      • Set Bonus_Ability[601] = Item Agility Bonus (+2)
      • Set Bonus_Ability[602] = Item Agility Bonus (+4)
      • Set Bonus_Ability[603] = Item Agility Bonus (+8)
      • Set Bonus_Ability[604] = Item Agility Bonus (+16)
      • Set Bonus_Ability[605] = Item Agility Bonus (+32)
      • Set Bonus_Ability[606] = Item Agility Bonus (+64)
      • Set Bonus_Ability[607] = Item Agility Bonus (+128)
      • Set Bonus_Ability[608] = Item Agility Bonus (+256)
      • Set Bonus_Ability[609] = Item Agility Bonus (+512)
      • Set Bonus_Ability[700] = Item Intelligence Bonus (+1)
      • Set Bonus_Ability[701] = Item Intelligence Bonus (+2)
      • Set Bonus_Ability[702] = Item Intelligence Bonus (+4)
      • Set Bonus_Ability[703] = Item Intelligence Bonus (+8)
      • Set Bonus_Ability[704] = Item Intelligence Bonus (+16)
      • Set Bonus_Ability[705] = Item Intelligence Bonus (+32)
      • Set Bonus_Ability[706] = Item Intelligence Bonus (+64)
      • Set Bonus_Ability[707] = Item Intelligence Bonus (+128)
      • Set Bonus_Ability[708] = Item Intelligence Bonus (+256)
      • Set Bonus_Ability[709] = Item Intelligence Bonus (+512)
      • Set Bonus_Ability[800] = Item Move Speed Bonus (+1)
      • Set Bonus_Ability[801] = Item Move Speed Bonus (+2)
      • Set Bonus_Ability[802] = Item Move Speed Bonus (+4)
      • Set Bonus_Ability[803] = Item Move Speed Bonus (+8)
      • Set Bonus_Ability[804] = Item Move Speed Bonus (+16)
      • Set Bonus_Ability[805] = Item Move Speed Bonus (+32)
      • Set Bonus_Ability[806] = Item Move Speed Bonus (+64)
      • Set Bonus_Ability[807] = Item Move Speed Bonus (+128)
      • Set Bonus_Ability[808] = Item Move Speed Bonus (+256)
      • Set Bonus_Ability[809] = Item Move Speed Bonus (+512)
      • -------- Preload abilities --------
      • Custom script: set udg_u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'hfoo', 0.00, 0.00, 0.00 )
      • Set i2 = ((Bonus_Number x 100) + 50)
      • For each (Integer i) from 0 to i2, do (Actions)
        • Loop - Actions
          • Unit - Add Bonus_Ability[i] to u
      • Unit - Remove u from the game
  • Bonus SetStatsSingle
    • Events
    • Conditions
    • Actions
      • -------- Save udg_i so it won't fuck up --------
      • Custom script: local integer i = udg_i
      • -------- Find number of bonus abilities for type --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bonus_Type Not equal to 1
          • Bonus_Type Not equal to 3
          • Bonus_Type Not equal to 4
        • Then - Actions
          • Set r = 9.00
        • Else - Actions
          • Set r = 15.00
      • -------- Remove old abilities --------
      • For each (Integer i) from 0 to (Integer(r)), do (Actions)
        • Loop - Actions
          • Unit - Remove Bonus_Ability[(i + (Bonus_Type x 100))] from u
      • -------- Loop from biggest to smallest bonus --------
      • Custom script: loop
      • -------- If still abilities and bonus left --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Greater than 0
          • Bonus_Value Greater than 0
        • Then - Actions
          • -------- Decrease loop count --------
          • Set i = (i - 1)
          • -------- Get ability bonus --------
          • Set r = (Power(2.00, (Real(i))))
          • -------- If ability bonus smaller then left over bonus --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Real(Bonus_Value)) Greater than or equal to r
            • Then - Actions
              • -------- Add bonus ability --------
              • Unit - Add Bonus_Ability[(i + (Bonus_Type x 100))] to u
              • -------- Decrease left over bonus --------
              • Set Bonus_Value = (Bonus_Value - (Integer(r)))
            • Else - Actions
        • Else - Actions
          • -------- Exit loop --------
          • Custom script: exitwhen true
      • Custom script: endloop
      • -------- restore udg_i --------
      • Custom script: set udg_i = i
  • Bonus SetStatsUnit
    • Events
    • Conditions
    • Actions
      • -------- Set all stats to 0 --------
      • For each (Integer i) from 0 to Bonus_Number, do (Actions)
        • Loop - Actions
          • Set Bonus_Stats[i] = 0
      • -------- Loop through inventory --------
      • For each (Integer i) from 0 to (Inventory_ButtonNumber - 1), do (Actions)
        • Loop - Actions
          • -------- Load items in current inventory slot --------
          • Custom script: set udg_i2 = GetHandleId(udg_u)
          • Set item = (Load i2 of i in Inventory_Hashtable)
          • -------- If slot is not empty --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Inventory_Button[0] Not equal to (Destructible-type of (Load i of i2 in Inventory_Hashtable))
            • Then - Actions
              • -------- Loop through item types --------
              • For each (Integer i2) from 1 to Inventory_ItemNumber, do (Actions)
                • Loop - Actions
                  • -------- If current item type = item type of current item --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of item) Equal to Inventory_ItemType[i2]
                    • Then - Actions
                      • -------- Load number of bonus type --------
                      • Custom script: set udg_i2 = udg_Inventory_ItemType[udg_i2]
                      • -------- Loop through bonus types provided by that item --------
                      • For each (Integer i3) from 1 to (Load 0 of i2 from Inventory_Hashtable), do (Actions)
                        • Loop - Actions
                          • -------- Increase specific bonus value --------
                          • Set Bonus_Stats[(Load ((i3 x 2) - 1) of i2 from Inventory_Hashtable)] = (Bonus_Stats[(Load ((i3 x 2) - 1) of i2 from Inventory_Hashtable)] + (Load (i3 x 2) of i2 from Inventory_Hashtable))
                      • -------- Exit loop --------
                      • Custom script: exitwhen true
                    • Else - Actions
            • Else - Actions
      • -------- Loop through bonus types --------
      • For each (Integer i) from 0 to Bonus_Number, do (Actions)
        • Loop - Actions
          • -------- Apply bonus for current bonus type --------
          • Set Bonus_Value = Bonus_Stats[i]
          • Set Bonus_Type = i
          • Trigger - Run Bonus SetStatsSingle <gen> (ignoring conditions)


Keywords:
inventory, unlimited slots, slots, more slots, extension, bag, system
Contents

Inventory Extension (Map)

Reviews
Moderator
10:59, 4th Sep 2010 TriggerHappy: Thanks for improving what I've asked, I suppose this could be approved on the grounds of it can be a useful demo map for users wanting to make GUI things in GUI. The system itself doesn't seem to be very...
  1. 10:59, 4th Sep 2010
    TriggerHappy:

    Thanks for improving what I've asked, I suppose this could be approved on the grounds of it can be a useful demo map for users wanting to make GUI things in GUI. The system itself doesn't seem to be very practical for any maps unless the user made some modifications. Systems like these should be done in vJASS.
     
  2. BotLoot

    BotLoot

    Joined:
    Jul 11, 2010
    Messages:
    80
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    :D

    Your inventory system is funny :grin:, that mean:fp: !good!:thumbs_up:
     
  3. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Gosh use Earth-Fury's bonus mod instead of creating your own GUI version :D

    If I remember correctly doesn't GetWorldBounds() leak a rect?

    If that's the case you should remove the unit enters entire map and change it to enters playablemap area as that wont leak.

    This quote is old but I think it's correct.
     
  4. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    if I start using jass someone will tell me to make this and that in jass, too and so on and in the end it will be like every other jass inventory system out there

    on noes :hohum:
    blizzard sux
    I spent 1 day already just to figure out that either pan camera to loc for player or set camera angle of attack for player disconnects although they were written by blizzard and shouold not cause net traffic

    and it is a pain in the ass to edit something in between a few hundred lines of text because the spell section upload editor is horrible -.-

    thanks anyway
    testet it and GetWorldBounds() != GetWorldBounds() is true
     
    Last edited: Aug 24, 2010
  5. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    how is the something not equal to the exact same thing?
     
  6. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    imagine this:
    Code (vJASS):
    function something takes nothing returns real
        set global_real_variable = global_real_variable + 1
        return global_real_variable
    endfunction

    or in this case it is more like
    1. create something
    2. return something
    since it is created new again every time it will be different

    Code (vJASS):

    function GetPlayableMapRect takes nothing returns rect
        return bj_mapInitialPlayableArea
    endfunction
     
    returns a global variable so it is fine
     
  7. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    cant test yet, but this will occupy some space in the map?
     
  8. Prince.Zero

    Prince.Zero

    Joined:
    Jun 6, 2010
    Messages:
    217
    Resources:
    3
    Spells:
    3
    Resources:
    3
    i'll only give you +rep for the courage of making so many custom items and abilities to make this system work.

    lol

    that's what i hate in custom inventories... that i have to make like 2-3 items that look like the primary item. I'm not so friendly with the object editor... i suck at it. MY map lacks items because i'm lazy of making them.
     
  9. Chamillionaire

    Chamillionaire

    Joined:
    Aug 13, 2008
    Messages:
    38
    Resources:
    0
    Resources:
    0
    I get a fatal error when i start the map i dont know why?
     
  10. Nillere

    Nillere

    Joined:
    Aug 9, 2009
    Messages:
    219
    Resources:
    0
    Resources:
    0
    This Inventory is a win, as i really do not like to use JNGP. Keep up the good work, but maybe, you should fix the camera, and i can walk on the inventory :0 But prolly we can fix that ourselves. But again, keep it up! ;)
     
  11. Prince.Zero

    Prince.Zero

    Joined:
    Jun 6, 2010
    Messages:
    217
    Resources:
    3
    Spells:
    3
    Resources:
    3
    mac user?
     
  12. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    you don't have to create additional items at all
    the thing with the abilites sucks though (I made 100!!!!)
    easiest thing would be to export/import all the abilities but that would overwrite the ones which are there already
    someone has to make an object data merger or something

    what's wrong with it?

    sure you can
    other players can't see it so why should it block them?

    changed compression type (reduced size by 10 kb :)
    someone with mac check if it works now
     

    Attached Files:

    Last edited: Aug 26, 2010
  13. Nillere

    Nillere

    Joined:
    Aug 9, 2009
    Messages:
    219
    Resources:
    0
    Resources:
    0
    Well, i should not have said "fix", more like change it. And with that i mean something like adding the camera "Every (Put in a number) Seconds of game time", so that you do not accidentally scroll out or whatsoever.
     
    Last edited: Aug 27, 2010
  14. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,514
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    wow nice inventory system lol
    5/5 + approve and keep up the good work ;p
     
  15. Zealon

    Zealon

    Joined:
    Mar 13, 2010
    Messages:
    1,142
    Resources:
    0
    Resources:
    0
    A little bit weird, how you can walk on the inventory. But I love it! 5/5
     
  16. GhostThruster

    GhostThruster

    Joined:
    Jul 24, 2009
    Messages:
    4,847
    Resources:
    34
    Models:
    7
    Icons:
    21
    Packs:
    1
    Skins:
    1
    Maps:
    3
    Spells:
    1
    Resources:
    34
    Nice system, but a bit useless. Don't take it badly.
    It is like a Flight Simulator I saw. Very, very awesome, but unuseable in WC3.
    But I guess users could borrow the techniques used in the system.

    It is quite complicated, even for me(which means it could still be easy to learn :p) and I don't like the right-clicks. Otherwise, good job.
    4/5, but I don't wanna lower the current rating.

    @TriggerHappy(the guy who moderated this but probably won't notice this post): This wasn't meant to be a FSI.
     
  17. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    you are right

    if someone will ever ask again if it is possible to have more than 6 inventory slots I want to answer the question was "yes"
    that was my intention
    sure I could change it to something like a fullscreen inventory in diablo or some other rpg but this has been done good enough before so there is no need for it
     
  18. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6
    This system + a nother 'useless' system im going to use together and modify them so they work together. This is the kind on things i love to look for.

    PS: i hate vJASS as i can never get it to work so yea... +rep
     
  19. AndreiMolnar

    AndreiMolnar

    Joined:
    Dec 8, 2009
    Messages:
    59
    Resources:
    0
    Resources:
    0
    it supports custom items? can you use the items stored in the extra inventory?