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

Inventory with more slots [GUI]

Status
Not open for further replies.
Level 19
Joined
Feb 4, 2009
Messages
1,313
Inventory with unlimited slots

system got released http://www.hiveworkshop.com/forums/spells-569/inventory-extension-176817/

I made an inventory extension which should be able to handle more than just 6 items. Since the code is rather long it is very likely to contain bugs so I upload it here first so you can play around with it. Feel free to tell me about any suggestions you would like to see. If I feel like and am able to add it I might do so.
Have fun :)

edit:
you drop an item by double-clicking it


edit2:
Awesome, however when you pick up an item, in the space where you show the inventory, if you cant see that area, blank inventory slots appear.
this is caused by blizzards vision system
they will vanish as soon as one gets vision over that area and looks at it in the same moment
a solution would be to reveal that area all the time but I think just ignoring it is easier than finding a workaround for it

edit3: nevermind, chaning the boolean value of "fog visibility" of the empty tile to "true" fixed it

edit4: update (v2)

edit5: screenshot, triggers


  • GIIni
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Number of supported item types --------
      • Set GI_ItemNumber = 8
      • -------- Number of inventory slots --------
      • Set GI_ButtonNumber = 50
      • -------- Visible region for inventory --------
      • Set rect = (Region(-1300.00, 512.00, -250.00, 1024.00))
      • 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 rect
          • Set GI_Vision[i] = (Last created visibility modifier)
          • Set P2G[i] = (Player group(p))
          • Trigger - Add to GIOpenClose <gen> the event (Player - p skips a cinematic sequence)
      • Custom script: call RemoveRect(udg_rect)
      • Set zLoc = (Point(0.00, 0.00))
      • Hashtable - Create a hashtable
      • Set GI_Hashtable = (Last created hashtable)
      • Set GI_Button[0] = war3mapImported\UdInvTile.blp
      • -------- ITEM SETUP --------
      • -------- ITEM SETUP --------
      • -------- ITEM SETUP --------
      • -------- Item index --------
      • Set i = 1
      • -------- Button type --------
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNBelt.blp
      • -------- Item type --------
      • Set GI_ItemType[i] = Belt of Giant Strength +6
      • -------- Convert item id to integer --------
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • -------- Number of stat modifications --------
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • -------- Type of stat modification --------
      • Hashtable - Save 5 as 1 of i in GI_Hashtable
      • -------- Ammount of added stats --------
      • Hashtable - Save 6 as 2 of i in GI_Hashtable
      • Set i = 2
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNClawsOfAttack.blp
      • Set GI_ItemType[i] = Claws of Attack +15
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • Hashtable - Save 1 as 1 of i in GI_Hashtable
      • Hashtable - Save 15 as 2 of i in GI_Hashtable
      • Set i = 3
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNHelmOfValor.blp
      • Set GI_ItemType[i] = Helm of Valor
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 2 as 0 of i in GI_Hashtable
      • Hashtable - Save 5 as 1 of i in GI_Hashtable
      • Hashtable - Save 4 as 2 of i in GI_Hashtable
      • Hashtable - Save 6 as 3 of i in GI_Hashtable
      • Hashtable - Save 4 as 4 of i in GI_Hashtable
      • Set i = 4
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNPendantOfMana.blp
      • Set GI_ItemType[i] = Pendant of Mana
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • Hashtable - Save 4 as 1 of i in GI_Hashtable
      • Hashtable - Save 250 as 2 of i in GI_Hashtable
      • Set i = 5
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNPeriapt.blp
      • Set GI_ItemType[i] = Periapt of Vitality
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • Hashtable - Save 3 as 1 of i in GI_Hashtable
      • Hashtable - Save 150 as 2 of i in GI_Hashtable
      • Set i = 6
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNPeriapt1.blp
      • Set GI_ItemType[i] = Khadgar's Gem of Health
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • Hashtable - Save 3 as 1 of i in GI_Hashtable
      • Hashtable - Save 300 as 2 of i in GI_Hashtable
      • Set i = 7
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNMedalionOfCourage.blp
      • Set GI_ItemType[i] = Medallion of Courage
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 2 as 0 of i in GI_Hashtable
      • Hashtable - Save 5 as 1 of i in GI_Hashtable
      • Hashtable - Save 4 as 2 of i in GI_Hashtable
      • Hashtable - Save 7 as 3 of i in GI_Hashtable
      • Hashtable - Save 4 as 4 of i in GI_Hashtable
      • Set i = 8
      • Set GI_Button[i] = ReplaceableTextures\CommandButtons\BTNRingGreen.blp
      • Set GI_ItemType[i] = Ring of Protection +5
      • Custom script: set udg_i = udg_GI_ItemType[udg_i]
      • Hashtable - Save 1 as 0 of i in GI_Hashtable
      • Hashtable - Save 0 as 1 of i in GI_Hashtable
      • Hashtable - Save 5 as 2 of i in GI_Hashtable
      • -------- ITEM SETUP END --------
      • -------- ITEM SETUP END --------
      • -------- ITEM SETUP END --------
      • -------- 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 GICreateInventory <gen> (ignoring conditions)
            • Else - Actions
      • Game - Display to (All players) for 0.00 seconds the text: Press Esc to open y...
  • GINewHero
    • Events
      • Unit - A unit enters (Entire map)
    • 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 GICreateInventory <gen> (ignoring conditions)
        • Else - Actions
  • GICreateInventory
    • Events
    • Conditions
    • Actions
      • -------- Get handle id of unit u --------
      • Custom script: set udg_i = GetHandleId(udg_u)
      • -------- Number of columns --------
      • Set i3 = 10
      • For each (Integer i2) from 0 to (GI_ButtonNumber - 1), do (Actions)
        • Loop - Actions
          • -------- -1150: x offset --------
          • Set x = ((Real(((i2 mod i3) x 64))) + -1150.00)
          • -------- 900: y offset --------
          • Set y = ((Real(((i2 / i3) x -64))) + 900.00)
          • Custom script: call MoveLocation(udg_zLoc, udg_x, udg_y)
          • -------- Create button --------
          • Destructible - Create a GI_Button[0] at zLoc facing 0.00 with scale 1.00 and variation 0
          • -------- Hide button --------
          • Custom script: call ShowDestructable(bj_lastCreatedDestructable, false)
          • -------- Save button --------
          • Hashtable - Save Handle Of(Last created destructible) as i2 of i in GI_Hashtable
  • GIOpenClose
    • Events
    • Conditions
    • Actions
      • Set p = (Triggering player)
      • 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 GI_Players) Equal to False
        • Then - Actions
          • -------- Pick all units selected by that player --------
          • Custom script: call GroupEnumUnitsSelected(udg_g, udg_p, null)
          • -------- Set u = first unit (unitgroups usually have the hero sorted to position 1 in a group) --------
          • Custom script: set udg_u = FirstOfGroup(udg_g)
          • -------- 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
              • -------- Save player to active inventory players --------
              • Player Group - Add p to GI_Players
              • -------- Save hero --------
              • Set GI_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 GI_Hashtable
              • -------- Reveal inventory area --------
              • Visibility - Enable GI_Vision[i3]
              • -------- Load first button --------
              • Set d = (Load 0 of i in GI_Hashtable)
              • Custom script: call MoveLocation(udg_zLoc, GetWidgetX(udg_d), GetWidgetY(udg_d))
              • -------- Apply top down view --------
              • Camera - Set p's camera Angle of attack to 270.00 over 0.00 seconds
              • -------- Pan cam to position of first button --------
              • Camera - Pan camera as necessary for p to zLoc over 0.00 seconds
              • -------- Show buttons for owner of hero --------
              • Set b = False
              • Custom script: if udg_p == GetLocalPlayer() then
              • Set b = True
              • Custom script: endif
              • For each (Integer i2) from 0 to GI_ButtonNumber, do (Actions)
                • Loop - Actions
                  • Set d = (Load i2 of i in GI_Hashtable)
                  • Custom script: call ShowDestructable(udg_d, udg_b)
            • Else - Actions
              • Game - Display to P2G[i3] the text: Please select a val...
        • Else - Actions
          • -------- Load hero --------
          • Set u = GI_Hero[i3]
          • -------- Get hero handle id --------
          • Custom script: set udg_i = GetHandleId(udg_u)
          • -------- Remove player from active inventory players --------
          • Player Group - Remove p from GI_Players
          • -------- Disable vision of inventory area --------
          • Visibility - Disable GI_Vision[i3]
          • Custom script: call MoveLocation(udg_zLoc, GetUnitX(udg_u), GetUnitY(udg_u))
          • -------- Reset cam --------
          • Camera - Reset camera for p to standard game-view over 0.00 seconds
          • -------- Pan cam to hero --------
          • Camera - Pan camera as necessary for p to zLoc over 0.00 seconds
          • -------- Destroy selection effect --------
          • Special Effect - Destroy (Load (Key Effect) of i in GI_Hashtable)
          • -------- Hide buttons --------
          • For each (Integer i2) from 0 to GI_ButtonNumber, do (Actions)
            • Loop - Actions
              • Destructible - Hide (Load i2 of i in GI_Hashtable)
  • GIOnSelect
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Owner of (Triggering unit)) is in GI_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 = GI_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 (GI_ButtonNumber - 1), do (Actions)
            • Loop - Actions
              • -------- Load button --------
              • Set d = (Load i2 of i in GI_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 GI_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 GI_Hashtable)
                      • -------- set d2 to last selected button --------
                      • Set d2 = (Load i3 of i in GI_Hashtable)
                      • -------- Set last button to false --------
                      • Hashtable - Save -1 as (Key Last) of i in GI_Hashtable
                      • Set item = (Load i of i2 in GI_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 GI_Button[0]
                            • Then - Actions
                              • -------- Set tile empty --------
                              • Destructible - Remove d
                              • Destructible - Create a GI_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 GI_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 GIAcquireItem <gen>
                              • Hero - Give item to u
                              • Trigger - Turn on GIAcquireItem <gen>
                              • -------- Update stats --------
                              • Trigger - Run BonusSetStatsAll <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 GI_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 GI_Hashtable
                          • Hashtable - Save Handle Of(Load i of i3 in GI_Hashtable) as i of i2 in GI_Hashtable
                          • Hashtable - Save Handle Ofitem as i of i3 in GI_Hashtable
                    • Else - Actions
                      • -------- Destroy old effect --------
                      • Special Effect - Destroy (Load (Key Effect) of i in GI_Hashtable)
                      • Hashtable - Save i2 as (Key Last) of i in GI_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 GI_Hashtable
                  • -------- Stop hero from walking around --------
                  • Wait 0.10 game-time seconds
                  • Unit - Order (Triggering unit) to Stop
                  • -------- 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
  • GIAcquireItem
    • 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 GI_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 GI_ItemType[i]
            • Then - Actions
              • -------- Loop through inventory slots --------
              • For each (Integer i2) from 0 to (GI_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 GI_Hashtable)) Equal to GI_Button[0]
                    • Then - Actions
                      • -------- Save item --------
                      • Hashtable - Save Handle Of(Item being manipulated) as i3 of i2 in GI_Hashtable
                      • Set d = (Load i2 of i3 in GI_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 GI_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 GI_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 GI_Players) Equal to True
                        • Then - Actions
                          • Custom script: if udg_p == GetLocalPlayer() then
                          • Set b = True
                          • Custom script: endif
                        • Else - Actions
                      • Custom script: call ShowDestructable(bj_lastCreatedDestructable, udg_b)
                      • -------- Update stats --------
                      • Trigger - Run BonusSetStatsAll <gen> (ignoring conditions)
                      • -------- Item got saved in inventory; stop doing stuff --------
                      • Skip remaining actions
                    • Else - Actions
            • Else - Actions
  • BonusIni
    • 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
  • BonusSetStats
    • 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
  • BonusSetStatsAll
    • 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 (GI_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 GI_Hashtable)
          • -------- If slot is not empty --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GI_Button[0] Not equal to (Destructible-type of (Load i of i2 in GI_Hashtable))
            • Then - Actions
              • -------- Loop through item types --------
              • For each (Integer i2) from 1 to GI_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 GI_ItemType[i2]
                    • Then - Actions
                      • -------- Load number of bonus type --------
                      • Custom script: set udg_i2 = udg_GI_ItemType[udg_i2]
                      • -------- Loop through bonus types provided by that item --------
                      • For each (Integer i3) from 1 to (Load 0 of i2 from GI_Hashtable), do (Actions)
                        • Loop - Actions
                          • -------- Increase specific bonus value --------
                          • Set Bonus_Stats[(Load ((i3 x 2) - 1) of i2 from GI_Hashtable)] = (Bonus_Stats[(Load ((i3 x 2) - 1) of i2 from GI_Hashtable)] + (Load (i3 x 2) of i2 from GI_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 BonusSetStats <gen> (ignoring conditions)
 

Attachments

  • InventoryExtensionV1.w3x
    32.1 KB · Views: 389
  • InventoryExtensionV2.w3x
    52.2 KB · Views: 507
  • InvExt.jpg
    InvExt.jpg
    670 KB · Views: 3,541
Last edited:
Level 7
Joined
Jun 14, 2009
Messages
235
Awesome, however when you pick up an item, in the space where you show the inventory, if you cant see that area, blank inventory slots appear.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

No it shouldn't for now! Because:

1 ) First of all you use the items inside the inventory with a right click. Double right click to drop it. But right click means also that the selected unit move to the point where you click and this isn't good.

2 ) You should change you trigger, that the hero picks up an item, even if the 6 normal inventory slots are full

3 ) If I select my hero and show the inventory with esc and then I select another hero of mine, then there's still the inventory of the last selected unit. Maybe you can do something like this.

Else it's very good ^^ - ok I'm not a fan of GUI anymore because vJass ( in this case you will need this ) is better, you have more "possibilities" with it and there can be much improvements with it, but anyway good job.

Greetings
~ The Bomb King > Dr. Boom
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
Moin moin =)

you are generating unnecessary overhead

This should be in the spells forum.
No it shouldn't for now! Because:

yeah right as I wrote in my first post it might contain bugs and I want to gather suggestions first

1 ) First of all you use the items inside the inventory with a right click. Double right click to drop it. But right click means also that the selected unit move to the point where you click and this isn't good.

issuing stop orders does not work for some reason
I though about saving the heroes x/y position and moving him back every now and then but this might be abuseable if some player wants to knockback that unit or something like that
I'll see what I can do about it
edit: wait solves

2 ) You should change you trigger, that the hero picks up an item, even if the 6 normal inventory slots are full

to do this I would have to create a second item for every other item of type powerup because only powerups can be picked up after inventory is full as far as I know

3 ) If I select my hero and show the inventory with esc and then I select another hero of mine, then there's still the inventory of the last selected unit. Maybe you can do something like this.

I thought it would be better since usually you don't have more than 1 hero and can have your inventory open all the time and also do other stuff (deselecting your hero for example)
and sincer double-pressing escape will bring you to your next hero....

Else it's very good ^^ - ok I'm not a fan of GUI anymore because vJass ( in this case you will need this ) is better, you have more "possibilities" with it and there can be much improvements with it, but anyway good job.

that's not challenging enough for me
it's fast enough so players won't notice any lag and I can do pretty much everything with GUI so I don't need JASS or vJASS
I still have to find some way to easily copy/generate 100 abilites at once but that's not a JASS but a JNGP feature anyway

Greetings
~ The Bomb King > Dr. Boom

you are generating unnecessary overhead again

thanks a lot for your feedback :thumbs_up:
 
Level 4
Joined
Aug 13, 2010
Messages
60
it more like the item become The book of Tome (stats book) which use it and dispear !!!

And we cant ever see the item i think !!
 
Level 8
Joined
Jun 30, 2010
Messages
259
I tried both versions but I still could not drop items, I could highlight 1 item 1 times, but thats it. Also, to make the hero stop, use "abyss" or boundary at the inventory and then do:
  • Inv no Move
    • Events
      • Unit - A unit is issued an order targeting a point
    • Conditions
      • (Target point of issued order) is of type walkability is off
    • Actions
      • Unit - Order (Triggering unit) to move to (Position of (Triggering unit))
That should work.
Also, make the cam lock in place when you open the inventory.
You could also change the backpack from ESC to an Item with a Backpack icon, this would seem more realistic.
Else it is a good map except for the bugs.
If I were to rate this, I would give it 3.5/5, because it is very advanced and the icons in the "backpack" is nice and the stat boosts work.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
having problems with desyncs in multiplayer EVEN AFTER DELETING ALL LOCAL PLAYER SCRIPTS
replacing the selected hero with a random hero did not work either (also SyncSelections() didn't)
if anyone has an idea why that happens please tell me

I tried both versions but I still could not drop items, I could highlight 1 item 1 times, but thats it. Also, to make the hero stop, use "abyss" or boundary at the inventory and then do:
  • Inv no Move
    • Events
      • Unit - A unit is issued an order targeting a point
    • Conditions
      • (Target point of issued order) is of type walkability is off
    • Actions
      • Unit - Order (Triggering unit) to move to (Position of (Triggering unit))
That should work.
Also, make the cam lock in place when you open the inventory.
You could also change the backpack from ESC to an Item with a Backpack icon, this would seem more realistic.
Else it is a good map except for the bugs.
If I were to rate this, I would give it 3.5/5, because it is very advanced and the icons in the "backpack" is nice and the stat boosts work.

you probably did test version 1 twice

to replacing esc with item:
I could do that but I also could make an ability and give it to the hero
both would use up space
escape key is rarely used so I thought it would be a good choice
since I can't cast items from the inventory yet I want to keep as many inventory slots free as possible


due to blizzards likings for disconnects I replaced esc with a spell :p
there you go
 
Last edited:
Level 5
Joined
Nov 22, 2009
Messages
181
would you mind rewriting this in vjass (as well)? i would love to study how it would work.

wait, JNGP uses vjass right?

Also, is there a way to modify it to work with spells instead of having to use spellbooks as well as for a talent tree sort of thing?
 
Last edited:
Level 19
Joined
Feb 4, 2009
Messages
1,313
would you mind rewriting this in vjass (as well)? i would love to study how it would work.

wait, JNGP uses vjass right?

vJASS can be written in JNGP but why should I write it in vjass?? the trick is that it's GUI, there are good ones in vJASS already
(and how do you think would it be easier to understand jass than gui? o_O)

Also, is there a way to modify it to work with spells instead of having to use spellbooks as well as for a talent tree sort of thing?

that would require a totaly different system
sorry

edit:
link
http://www.hiveworkshop.com/forums/spells.php?search=inventory&d=list&r=30
search is great
use it!
 
Last edited:
Level 5
Joined
Nov 22, 2009
Messages
181
1:I don't think it would be easier. im trying to learn jass which is why i want to study it, so that i may get better.

2:there are?

edit: can you post the link to one?

3:it is no problem. just curious.
 
Status
Not open for further replies.
Top