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

Little help, GUI mini-system

Status
Not open for further replies.
Level 10
Joined
Nov 28, 2008
Messages
655
  • Get Magic Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Unit - Add |cffff0000Magic Hammer|r (Q) to (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] + 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
        • Else - Actions
          • Unit - Add |cffff0000Magic Hammer|r (W) to (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] + 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
  • Lose Magic Hammer
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 2
        • Then - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (W) from (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] - 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
        • Else - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (Q) from (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] - 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))

  • Get Firebolt
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Firebolt|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Unit - Add |cffff0000Firebolt|r (Q) to (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] + 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
        • Else - Actions
          • Unit - Add |cffff0000Firebolt|r (W) to (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] + 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
  • Lose Firebolt
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Firebolt|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 2
        • Then - Actions
          • Unit - Remove |cffff0000Firebolt|r (W) from (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] - 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
        • Else - Actions
          • Unit - Remove |cffff0000Firebolt|r (Q) from (Triggering unit)
          • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] - 1)
          • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))




So the idea is, if you don't have an item, and you pick one up, it adds the skill for the Q key. If you do have an item, then it adds the ability for the W key. Both are in the right spots on the command card thing, x,y = (0,2) for Q and x,y = (1,2) for W.

The system doesn't work right though, and I can't see the error.

When you have no items, it adds the first item's Q, all good.
Then you pick up the second item, and it adds that item's W, not good.
Then you drop either item, and neither ability disappears, not good.
If you pick up the items a second time, it adds the W, and takes it away the right way, kinda good?


I can post the map if no one can see a blaring whole in my logic, but I think it works?
 
Level 6
Joined
Mar 20, 2008
Messages
208
Double check on the array, also consider removing things based on the item dropped. Unless a player can obtain more than 1 of the item, you can safely try to remove both.
 
Level 6
Joined
Mar 20, 2008
Messages
208
Cleaned it up a little, might help.

  • Get Magic Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] + 1)
      • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 1
        • Then - Actions
          • Unit - Add |cffff0000Magic Hammer|r (Q) to (Triggering unit)
          • Else - Actions
            • Unit - Add |cffff0000Magic Hammer|r (W) to (Triggering unit)
  • Lose Magic Hammer
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • Set Player_Items[(Player number of (Owner of (Triggering unit)))] = (Player_Items[(Player number of (Owner of (Triggering unit)))] - 1)
      • Game - Display to (All players) the text: (String(Player_Items[(Player number of (Owner of (Triggering unit)))]))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items[(Player number of (Owner of (Triggering unit)))] Equal to 2
        • Then - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (W) from (Triggering unit)
        • Else - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (Q) from (Triggering unit)
 
Level 10
Joined
Nov 28, 2008
Messages
655
EDIT: I'm going to edit this soon.

Just to make sure. You want to add the Q ability when you have one item. When you have two items, you don't want to have that Q ability at all, only the W ability?



Close, :grin:

When you pick up the first item, it gives you the ability in the 0,2 spot, with the hotkey Q. If you have an item, and pick up a second one, it gives you the ability in the 1,2 spot, with the hotkey Q.

Then removing them should remove he right ones, in the right order.


Shyhalu: You took out the int(#) -1 every time, so every item will still add one to it, and never minus.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
If I understood you correctly, this does the trick:

  • Untitled Trigger 047
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Set Temp_Integer_1 = (Temp_Integer_1 + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer_1 Equal to 1
        • Then - Actions
          • Unit - Add Holy Light Q to (Triggering unit)
        • Else - Actions
          • Unit - Add Holy Light W to (Triggering unit)
  • Untitled Trigger 047 Copy
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Set Temp_Integer_1 = (Temp_Integer_1 - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer_1 Equal to 0
        • Then - Actions
          • Unit - Remove Holy Light Q from (Triggering unit)
        • Else - Actions
          • Unit - Remove Holy Light W from (Triggering unit)
 
Level 10
Joined
Nov 28, 2008
Messages
655
Edit:

I got it, :thumbs_up:

With a little work, you could hashtable the hell out of it and make it mui, but that might require two of them? Not sure, but here it is, for two items, works perfectly as intended:

Set up this way:

array items 1
array items 2

and each item will have a number.

hammer = 1,
firebolt = 2,
stomp = 3,
etc...



Pick up hammer:
items1(#) = 0, becomes items1(#) = 1 \* items1(#) "gets" hammer *\
or
items1(#) =/= 0, so items2(#) = 1 \* items2(#) "gets" hammer *\


With some more effort and use of hashtables, could be a solid system I think, but don't really feel like doing that, anyone is free to do it, I might do it if I get bored though.


  • Get Magic Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items_1[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Unit - Add |cffff0000Magic Hammer|r (Q) to (Triggering unit)
          • Set Player_Items_1[(Player number of (Owner of (Triggering unit)))] = 1
        • Else - Actions
          • Unit - Add |cffff0000Magic Hammer|r (W) to (Triggering unit)
          • Set Player_Items_2[(Player number of (Owner of (Triggering unit)))] = 1
  • Lose Magic Hammer
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff0000Magic Hammer|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Items_1[(Player number of (Owner of (Triggering unit)))] Equal to 1
        • Then - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (Q) from (Triggering unit)
          • Set Player_Items_1[(Player number of (Owner of (Triggering unit)))] = 0
        • Else - Actions
          • Unit - Remove |cffff0000Magic Hammer|r (W) from (Triggering unit)
          • Set Player_Items_2[(Player number of (Owner of (Triggering unit)))] = 0
 
Last edited:
Status
Not open for further replies.
Top