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

Plea for help

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
alright, im working on a gui multiboard inventory system. Ive started dropping items, and it doesnt work 100%. I think they stay hidden after theyre dropped...

  • Inventory Init
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set InvHash = (Last created hashtable)
      • For each (Integer B) from 1 to 10, do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer() == ConvertedPlayer(GetForLoopIndexB()) then
          • Multiboard - Create a multiboard with 2 columns and 20 rows, titled Inventory
          • Set Inventory[(Player number of (Picked player))] = (Last created multiboard)
          • Multiboard - Set the width for Inventory[(Integer B)] item in column 0, row 0 to 16.00% of the total screen width
          • Multiboard - Set the display style for Inventory[(Integer B)] item in column 0, row 0 to Show text and Hide icons
          • -------- Equipped stuff --------
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Multiboard - Set the width for Inventory[(Integer B)] item in column 2, row (Integer A) to 8.00% of the total screen width
              • Multiboard - Set the width for Inventory[(Integer B)] item in column 1, row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 1 to (Helm)
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 2 to (body)
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 3 to (Boots)
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 4 to (Gloves)
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 5 to (Left Hand)
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 2, row 6 to (Right Hand)
          • -------- description --------
          • Multiboard - Set the text for Inventory[(Integer B)] item in column 1, row 7 to Description:
          • -------- items --------
          • For each (Integer A) from 8 to 20, do (Actions)
            • Loop - Actions
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • Hashtable - Save True as (Integer A) of (Key (Picked player)) in InvHash
              • Multiboard - Set the width for Inventory[(Integer B)] item in column 1, row (Integer A) to 13.00% of the total screen width
              • Multiboard - Set the width for Inventory[(Integer B)] item in column 2, row (Integer A) to 3.00% of the total screen width
          • Multiboard - Minimize Inventory[(Integer B)]
          • Multiboard - Maximize Inventory[(Integer B)]
          • Custom script: endif
thats the initialization

  • invup
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
      • Player - Player 2 (Blue) Presses the Up Arrow key
      • Player - Player 3 (Teal) Presses the Up Arrow key
      • Player - Player 4 (Purple) Presses the Up Arrow key
      • Player - Player 5 (Yellow) Presses the Up Arrow key
      • Player - Player 6 (Orange) Presses the Up Arrow key
      • Player - Player 7 (Green) Presses the Up Arrow key
      • Player - Player 8 (Pink) Presses the Up Arrow key
      • Player - Player 9 (Gray) Presses the Up Arrow key
      • Player - Player 10 (Light Blue) Presses the Up Arrow key
    • Conditions
      • (Inventory[(Player number of (Triggering player))] is minimized) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • selectedrow[(Player number of (Triggering player))] Greater than 8
        • Then - Actions
          • Multiboard - Set the text for Inventory[(Player number of (Triggering player))] item in column 2, row selectedrow[(Player number of (Triggering player))] to <Empty String>
          • Set selectedrow[(Player number of (Triggering player))] = (selectedrow[(Player number of (Triggering player))] - 1)
          • Multiboard - Set the text for Inventory[(Player number of (Triggering player))] item in column 2, row selectedrow[(Player number of (Triggering player))] to <
        • Else - Actions
this trigger selects the item to manipulate

  • invdown
    • Events
      • Player - Player 1 (Red) Presses the Down Arrow key
      • Player - Player 2 (Blue) Presses the Down Arrow key
      • Player - Player 3 (Teal) Presses the Down Arrow key
      • Player - Player 4 (Purple) Presses the Down Arrow key
      • Player - Player 5 (Yellow) Presses the Down Arrow key
      • Player - Player 6 (Orange) Presses the Down Arrow key
      • Player - Player 7 (Green) Presses the Down Arrow key
      • Player - Player 8 (Pink) Presses the Down Arrow key
      • Player - Player 9 (Gray) Presses the Down Arrow key
      • Player - Player 10 (Light Blue) Presses the Down Arrow key
    • Conditions
      • (Inventory[(Player number of (Triggering player))] is minimized) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • selectedrow[(Player number of (Triggering player))] Less than 20
        • Then - Actions
          • Multiboard - Set the text for Inventory[(Player number of (Triggering player))] item in column 2, row selectedrow[(Player number of (Triggering player))] to <Empty String>
          • Set selectedrow[(Player number of (Triggering player))] = (selectedrow[(Player number of (Triggering player))] + 1)
          • Multiboard - Set the text for Inventory[(Player number of (Triggering player))] item in column 2, row selectedrow[(Player number of (Triggering player))] to <
        • Else - Actions
same as above

  • Inventory Add
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Distance between (Position of (Triggering unit)) and (Position of (Target item of issued order))) Less than or equal to 200.00
    • Actions
      • For each (Integer A) from 8 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Integer A) of (Key (Owner of (Triggering unit))) from InvHash) Equal to True
            • Then - Actions
              • Hashtable - Save False as (Integer A) of (Key (Owner of (Triggering unit))) in InvHash
              • Hashtable - Save Handle Of(Target item of issued order) as (Key (items + (String((Integer A))))) of (Key (Owner of (Triggering unit))) in InvHash
              • Multiboard - Set the text for Inventory[(Player number of (Owner of (Triggering unit)))] item in column 1, row (Integer A) to (Name of (Target item of issued order))
              • Hero - Drop (Target item of issued order) from (Triggering unit)
              • Item - Hide (Target item of issued order)
              • Skip remaining actions
            • Else - Actions
              • Set tempint = (Integer A)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tempint Equal to 20
                • Then - Actions
                  • Hero - Drop (Target item of issued order) from (Triggering unit)
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your inventory is f...
                • Else - Actions
that ones for picking items up

  • itemdebug
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 8 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Integer A) of (Key (Owner of (Triggering unit))) from InvHash) Equal to True
            • Then - Actions
              • Hashtable - Save False as (Integer A) of (Key (Owner of (Triggering unit))) in InvHash
              • Hashtable - Save Handle Of(Item being manipulated) as (Key (items + (String((Integer A))))) of (Key (Owner of (Hero manipulating item))) in InvHash
              • Multiboard - Set the text for Inventory[(Player number of (Owner of (Hero manipulating item)))] item in column 1, row (Integer A) to (Name of (Item being manipulated))
              • Hero - Drop (Item being manipulated) from (Hero manipulating item)
              • Item - Hide (Item being manipulated)
              • Skip remaining actions
            • Else - Actions
              • Set tempint = (Integer A)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tempint Equal to 20
                • Then - Actions
                  • Hero - Drop (Item being manipulated) from (Hero manipulating item)
                  • Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: Your inventory is f...
                • Else - Actions
this one fires if they actually acquire the item, eg buying it or being exactly on top of it

  • itemdrop
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
      • Player - Player 4 (Purple) Presses the Right Arrow key
      • Player - Player 5 (Yellow) Presses the Right Arrow key
      • Player - Player 6 (Orange) Presses the Right Arrow key
      • Player - Player 7 (Green) Presses the Right Arrow key
      • Player - Player 8 (Pink) Presses the Right Arrow key
      • Player - Player 9 (Gray) Presses the Right Arrow key
      • Player - Player 10 (Light Blue) Presses the Right Arrow key
    • Conditions
      • (Inventory[(Player number of (Triggering player))] is minimized) Equal to False
    • Actions
      • Set temppoint[(Player number of (Triggering player))] = (Position of Hero[(Player number of (Triggering player))])
      • Multiboard - Set the text for Inventory[(Player number of (Triggering player))] item in column 1, row selectedrow[(Player number of (Triggering player))] to <Empty String>
      • Item - Show (Load (Key (items + (String((selectedrow[(Player number of (Triggering player))] - 8))))) of (Key (Triggering player)) in InvHash)
      • Item - Move (Load (Key (items + (String((selectedrow[(Player number of (Triggering player))] - 8))))) of (Key (Triggering player)) in InvHash) to temppoint[(Player number of (Triggering player))]
      • Hashtable - Save True as selectedrow[(Player number of (Triggering player))] of (Key (Triggering player)) in InvHash
      • Custom script: call RemoveLocation(udg_temppoint[GetConvertedPlayerId(GetTriggerPlayer())])
and finally, the item drop trigger. thanks for any help.
(copy as text for the WIN)

youre also welcome to pick at the numerous other flaws im sure there are in my triggering. :D
 
  • Set Inventory[(Player number of (Picked player))] = (Last created multiboard)
That should be
  • Set Inventory[(Player number of (Player(IntegerB)))] = (Last created multiboard)
Plus, I don't know if it works for you, but I would not use this:
  • Hashtable - Save True as (Integer A) of (Key (Picked player)) in InvHash
I'd use
  • Hashtable - Save True as (Key((value) + (String(IntegerA))) of (Key (Picked player)) in InvHash
 
Level 8
Joined
Mar 3, 2009
Messages
327
  • Set Inventory[(Player number of (Picked player))] = (Last created multiboard)
That should be
  • Set Inventory[(Player number of (Player(IntegerB)))] = (Last created multiboard)

oh thanks :D missed that... It didnt fix the main problem though so noone think i dont need help still :D

Plus, I don't know if it works for you, but I would not use this:
  • Hashtable - Save True as (Integer A) of (Key (Picked player)) in InvHash
I'd use
  • Hashtable - Save True as (Key((value) + (String(IntegerA))) of (Key (Picked player)) in InvHash

nah it just gets in the way if i save a value with that... i still might if the need arises but I dont think it will.
 
Level 8
Joined
Mar 3, 2009
Messages
327
well,
i made it that when theyre picked up, theyre saved in the hashtable and put on the multiboard, then the physical item is hidden. When it is dropped, its removed from the hashtable, multiboard, the physical item is moved to the position of the hero and unhidden.

(i forgot to remove from the hashtable so just then i added
  • Hashtable - Save Handle OfNo item as (Key (items + (String(selectedrow[(Player number of (Triggering player))])))) of (Key (Triggering player)) in InvHash
to the drop trigger

i just realised something i might have done wrong, the handle id's in the drop trigger. I havnt changed them back when i moved around my add trigger... you probably wouldnt understand but it makes sense to me :p

ha it works :D as always, thanks for your undying support pharaoh, I'll probably have some more flawed GUI for you tomorrow :p
 
Level 8
Joined
Mar 3, 2009
Messages
327
bump / new problem

alright.. now theres a problem with items duplicating. Im testing for exact circumstances, but basically picking them up n dropping them a lot

edit: ok, my hypothesis is that the item is being picked up and written down on the multiboard and everything without disappearing...

alright, its something to do with the debug trigger...
 
By the way, for the drop thing, you could have an integer that increases every time your unit picks an item. Of course that integer is saved to your hero. Then, every item that it is picked up, it receives that unique value of the integer saved and gets its custom value changed to the integer value. This way, you can actually create an indexing system with Unique Ids per item that can affect many units at the same time.
 
Status
Not open for further replies.
Top