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

GUI Click to equip system

Status
Not open for further replies.
I have decided to add the click to equip system to one of my maps, and I was wondering which was the best way to do it. I'd like to do this in GUI.

Basically I want the hero to have a weapon item in his/her inventory that can be clicked to equip the weapon.
After that I want to add a damage bonus and remove the item from the inventory or possibly just store it somewhere else for the time being (such as an interactable inventory).

This is for a map similar to LOAP so it doesn't really have to be super complex, and also I will be constructing the system.
All I am really looking for is some suggestions for the best way.
What I am NOT looking for is comments about the nature of GUI. Do us all a favor and KEEP IT TO YOURSELF! Thanks in advance.
Also anything helpful will result in +REP. =]
 
The best way is to "Use item" event.
  • Trigger
  • Events
    • Unit - A unit uses an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to X
  • Actions
    • Item - Remove (Item being manipulated) //Might require some wait first, don't remember correctly
    • Unit - Add Bonus damage to (Triggering unit)
In order to keep tracking of a list of items, you can do something like this:
  • Triggerm
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Items[1] = X
    • Set Items[2] = Y
    • Set Items[3] = XX
    • Set Items[4] = YY
    • Set Abilities[1] = Boots of Speed //The corresponding abilities
    • Set Abilities[2] = Gloves of Haste
    • Set Abilities[3] = Damage Bonus
    • Set Abilities[4] = Poison Sting
  • TriggerG
  • Events
    • Unit - A unit uses an item
  • Conditions
  • Actions
    • Trigger - Turn off (This trigger)
    • For each (IntegerA) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Item-type of (Item being manipulated)) Equal to Items[(IntegerA)]
          • Then - Actions
            • Set Integer = (Integer + 1)
          • Else - Actions
    • Item - Remove (Item being manipulated)
    • Unit - Add Abilities[Integer] to (Triggering unit)
    • Trigger - Turn on (This trigger)
 
Status
Not open for further replies.
Top