• 🏆 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 Trigger Mayhem... meh

Status
Not open for further replies.
Level 3
Joined
May 11, 2009
Messages
42
My item system is really nice and cool and all that, but i can't do shit about the gui triggers laughing at my misunderstanding :p

probably the worst case scenario. first, i got the damned thing to work... then i decided to "improve" the whole thing, and i remade it and then it stopped working.

ive had an item, which isn't even in the variables show up when not specifically called for... ive got interger loops going haywire spamming out item types which isn't matching their conditions... i have no f***ing idea what to do, but to come here that is ^^

so frustrated, here take a look!

  • Uses a weapon
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeMeleeleader[1]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeMeleeleader[2]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeMeleeleader[3]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeMeleeleader[4]
        • Then - Actions
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to ItemTypeMelee[(Integer A)]
                  • (Item-type of (Item being manipulated)) Not equal to ItemTypeMelee[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]]
                • Then - Actions
                  • Hero - Create ItemTypeMelee[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] Not equal to 0
                    • Then - Actions
                      • Unit - Remove AbilityMeleeweapons[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] from (Hero manipulating item)
                    • Else - Actions
                      • Do nothing
                  • Set IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] = (Integer A)
                  • Unit - Add AbilityMeleeweapons[(Integer A)] to (Hero manipulating item)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item being manipulated)) Equal to ItemTypeMelee[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]]
                    • Then - Actions
                      • Hero - Create ItemTypeMelee[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                    • Else - Actions
                      • Do nothing
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to ItemTypeRanged[(Integer A)]
                • Then - Actions
                  • Set TempInterger2 = (Integer A)
                  • Hero - Create ItemTypeMelee[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                  • Set IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] = (Integer A)
                  • Set TempPoint1 = (Center of killzone <gen>)
                  • Set TempPoint2 = (Position of (Hero manipulating item))
                  • Set TempUnit1 = (Hero manipulating item)
                  • Unit - Move TempUnit1 instantly to TempPoint1
                  • For each (Integer B) from 1 to 4, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Hero manipulating item)) Equal to UnitTypeMeleeleader[(Integer B)]
                        • Then - Actions
                          • Unit - Create 1 UnitTypeRangedleader[(Integer B)] for (Owner of (Hero manipulating item)) at TempPoint2 facing (Facing of TempUnit1) degrees
                          • Unit - Add AbilityRangedweapons[TempInterger2] to (Last created unit)
                          • Set UnitLeader[(Player number of (Owner of (Hero manipulating item)))] = (Last created unit)
                          • Unit - Set life of (Last created unit) to (Life of TempUnit1)
                          • Selection - Select (Last created unit) for (Owner of (Hero manipulating item))
                          • For each (Integer IntergerC) from 1 to 6, do (Actions)
                            • Loop - Actions
                              • Hero - Create (Item-type of (Item carried by TempUnit1 in slot IntergerC)) and give it to (Last created unit)
                          • For each (Integer IntergerC) from 1 to 4, do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of AbilitySkillpack[IntergerC] for (Hero manipulating item)) Equal to 1
                                • Then - Actions
                                  • Unit - Add AbilitySkillpack[IntergerC] to (Last created unit)
                                • Else - Actions
                                  • Do nothing
                        • Else - Actions
                          • Do nothing
                  • Unit - Change ownership of TempUnit1 to Neutral Hostile and Change color
                  • Unit - Kill TempUnit1
                  • Custom script: call RemoveLocation(udg_TempPoint1)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Set TempUnit1 = No unit
                • Else - Actions
                  • Do nothing
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeRangedleader[1]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeRangedleader[2]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeRangedleader[3]
              • (Unit-type of (Hero manipulating item)) Equal to UnitTypeRangedleader[4]
        • Then - Actions
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to ItemTypeRanged[(Integer A)]
                  • (Item-type of (Item being manipulated)) Not equal to ItemTypeRanged[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]]
                • Then - Actions
                  • Hero - Create ItemTypeRanged[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] Not equal to 0
                    • Then - Actions
                      • Unit - Remove AbilityRangedweapons[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] from (Hero manipulating item)
                    • Else - Actions
                      • Do nothing
                  • Set IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] = (Integer A)
                  • Unit - Add AbilityRangedweapons[(Integer A)] to (Hero manipulating item)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item being manipulated)) Equal to ItemTypeRanged[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]]
                    • Then - Actions
                      • Hero - Create ItemTypeRanged[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                    • Else - Actions
                      • Do nothing
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to ItemTypeMelee[(Integer A)]
                • Then - Actions
                  • Set TempInterger2 = (Integer A)
                  • Hero - Create ItemTypeRanged[IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))]] and give it to (Hero manipulating item)
                  • Set IntCurrentweapon[(Player number of (Owner of (Hero manipulating item)))] = (Integer A)
                  • Set TempPoint1 = (Center of killzone <gen>)
                  • Set TempPoint2 = (Position of (Hero manipulating item))
                  • Set TempUnit1 = (Hero manipulating item)
                  • Unit - Move TempUnit1 instantly to TempPoint1
                  • For each (Integer B) from 1 to 4, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Hero manipulating item)) Equal to UnitTypeRangedleader[(Integer B)]
                        • Then - Actions
                          • Unit - Create 1 UnitTypeMeleeleader[(Integer B)] for (Owner of (Hero manipulating item)) at TempPoint2 facing (Facing of TempUnit1) degrees
                          • Unit - Add AbilityMeleeweapons[TempInterger2] to (Last created unit)
                          • Set UnitLeader[(Player number of (Owner of (Hero manipulating item)))] = (Last created unit)
                          • Unit - Set life of (Last created unit) to (Life of TempUnit1)
                          • Selection - Select (Last created unit) for (Owner of (Hero manipulating item))
                          • For each (Integer IntergerC) from 1 to 6, do (Actions)
                            • Loop - Actions
                              • Hero - Create (Item-type of (Item carried by TempUnit1 in slot IntergerC)) and give it to (Last created unit)
                          • For each (Integer IntergerC) from 1 to 4, do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of AbilitySkillpack[IntergerC] for (Hero manipulating item)) Equal to 1
                                • Then - Actions
                                  • Unit - Add AbilitySkillpack[IntergerC] to (Last created unit)
                                • Else - Actions
                                  • Do nothing
                        • Else - Actions
                          • Do nothing
                  • Unit - Change ownership of TempUnit1 to Neutral Hostile and Change color
                  • Unit - Kill TempUnit1
                  • Custom script: call RemoveLocation(udg_TempPoint1)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Set TempUnit1 = No unit
                • Else - Actions
                  • Do nothing
        • Else - Actions
          • Do nothing
 
Level 3
Joined
May 11, 2009
Messages
42
In your first If/Then/Else

The Then and Else are doing the same thing. Try having Else - Do Nothing. I think it repeats itself a few times going down too

don't really get at what you mean... both the first and second else in line does nothing

EDIT: But yeah, it does repeat itself, and i dont see where T_T
The thing is, as i use a condition checking which item-type was used first thing in the loop, i dont see where it goes wrong :p
 
Level 3
Joined
Sep 11, 2004
Messages
63
Everything is messed up if integer A, B, C is used by other trigger or other instance of this trigger.

Either make them global variables in GUI or local in jass should fix that.
 
Status
Not open for further replies.
Top