• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Equipment System Help

Status
Not open for further replies.
Level 5
Joined
Oct 12, 2004
Messages
109
Hey guys i was creating an equipment system in gui and ran into a problem i can't seem to find out whats wrong. It works perfectly except when you use an item that you have just used again it repeats the same process. Heres the triggers and you will see what im talking about.

This is the part of the trigger that doesn't work:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempItem Equal to kItem_Old[TempInteger]
    • Then - Actions
      • Skip remaining actions
    • Else - Actions
It continues on even if the condition is true. If you use an item it removes the item and then gives u an ability. Then you use a different item and it removes that ability and gives u the old item back but removes the new item and gives u a new ability. The problem i'm having is that when you use the same item while you already have its ability the item duplicates and you get an extra item. Thats because the part above isnt working properly. If any1 can help i appreciate it.


  • Events
    • Unit - A unit Uses an item
  • Conditions
    • (Triggering unit) Equal to hero
  • Actions
    • Set TempItem = (Item being manipulated)
    • Set TempInteger = (Player number of (Owner of TempItem))
    • Set kUnit[TempInteger] = (Hero manipulating item)
    • -------------THIS IS THE PART THAT DOESN'T WORK---------
      • -------- Check if item is already in spot --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempItem Equal to kItem_Old[TempInteger]
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
          • kItem_Old[TempInteger] = TempItem
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of TempItem) Equal to k A
                  • (Item-type of TempItem) Equal to k B
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • kOccupied[TempInteger] Equal to False
                • Then - Actions
                  • Set kItem_New[TempInteger] = TempItem
                  • Set kItem_Old[TempInteger] = kItem_New[TempInteger]
                  • Set kOccupied[TempInteger] = True
                  • Trigger - Run kEquip <gen> (checking conditions)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • kOccupied[TempInteger] Equal to True
                    • Then - Actions
                      • Set kItem_New[TempInteger] = TempItem
                      • Item - Create k[kNumber[TempInteger]] at (Center of (Playable map area))
                      • Hero - Give (Last created item) to kUnit[TempInteger]
                      • Unit - Remove Damage_Effect from kUnit[TempInteger]
                      • Unit - Remove kAbility_Old[TempInteger] from kUnit[TempInteger]
                      • Set kItem_Old[TempInteger] = kItem_New[TempInteger]
                      • Trigger - Run kEquip <gen> (checking conditions)
                    • Else - Actions
            • Else - Actions



k trigger

  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • kItem_New[TempInteger] Equal to (Item carried by hero of type k A)
      • Then - Actions
        • Set kNumber[TempInteger] = 1
        • Item - Remove kItem_New[TempInteger]
        • -------- Give Real Item --------
        • Unit - Add m42 to kUnit[TempInteger]
        • Set kAbility_Old[TempInteger] = m42
        • -------- -----------------------------------------------------EFFECTS----------------------------------------------------- --------
        • Unit - Add Item Damage Bonus (+5) to hero
        • Set Damage_Effect = Item Damage Bonus (+5)
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • kItem_New[TempInteger] Equal to (Item carried by hero of type k B)
          • Then - Actions
            • Set kNumber[TempInteger] = 2
            • Item - Remove kItem_New[TempInteger]
            • -------- Give Real Item --------
            • Unit - Add m43 to kUnit[TempInteger]
            • Set kAbility_Old[TempInteger] = m43
            • -------- -----------------------------------------------------EFFECTS----------------------------------------------------- --------
            • Unit - Add Item Damage Bonus (+20) to kUnit[TempInteger]
            • Set Damage_Effect = Item Damage Bonus (+20)
          • Else - Actions


UPADTE:
I added the map for everyone to look at:
 

Attachments

  • testmap-1.w3x
    932.4 KB · Views: 113
Last edited:
Status
Not open for further replies.
Top