• 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] Loop-de-Loop

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2009
Messages
397
Soooo, I made this really cool combat trigger
and it doesn't work :(

  • CombatStart
    • Events
    • Conditions
      • ((Owner of (Triggering unit)) controller) Not equal to (!=) User
    • Actions
      • Unit Group - Add (Triggering unit) to Combat[(Custom value of (Targeted unit))]
      • Unit Group - Add (Targeted unit) to Combat[(Custom value of (Triggering unit))]
      • Unit Group - Add (Triggering unit) to CombatGroup
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatCheck[(Custom value of (Targeted unit))] Equal to (==) 0
          • Then - Actions
            • Set CombatCheck[(Custom value of (Targeted unit))] = 1
            • Set PlayerGroup = (Player group((Owner of (Targeted unit))))
            • Set TempLoc = ((Position of (Targeted unit)) offset by (Left, 0.00))
            • Floating Text - Create floating text that reads *Entering Combat* at TempLoc with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and Trans% transparency
            • Floating Text - Hide (Last created floating text) for (All players)
            • Floating Text - Show (Last created floating text) for PlayerGroup
            • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
            • Floating Text - Change (Last created floating text): Disable permanence
            • Custom script: call RemoveLocation(udg_TempLoc)
            • Custom script: call DestroyForce(udg_PlayerGroup)
          • Else - Actions
      • Trigger - Turn on Combat Cycle <gen>
  • Combat Cycle
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CombatGroup and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Is (Picked unit) near Creep_Loc[(Custom value of (Picked unit))] and within a range of 800.00) Equal to (==) False
              • ((Picked unit) is An Ancient) Equal to (==) False
            • Then - Actions
              • Unit Group - Remove (Picked unit) from CombatGroup
              • Unit - Order (Picked unit) to Stop
              • Unit - Order (Picked unit) to Move To Creep_Loc[(Custom value of (Picked unit))]
              • Unit - Make (Picked unit) Invulnerable
              • Unit - Set (Picked unit) acquisition range to 0.00
              • Unit - Set life of (Picked unit) to 100.00%
              • Unit - Set mana of (Picked unit) to 100.00%
              • Unit Group - Add (Picked unit) to WaitReturn
              • Trigger - Turn on Combat End <gen>
              • Set TempUnit = (Picked unit)
              • Unit Group - Pick every unit in Combat[(Custom value of TempUnit)] and do (Actions)
                • Loop - Actions
                  • Unit Group - Remove TempUnit from Combat[(Custom value of (Picked unit))]
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of units in Combat[(Custom value of (Picked unit))]) Equal to (==) 0
                      • Then - Actions
                        • Set CombatCheck[(Custom value of (Picked unit))] = 0
                        • Set PlayerGroup = (Player group((Owner of (Picked unit))))
                        • Set TempLoc = ((Position of (Picked unit)) offset by (Left, 0.00))
                        • Floating Text - Create floating text that reads *Leaving Combat* at TempLoc with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and Trans% transparency
                        • Floating Text - Hide (Last created floating text) for (All players)
                        • Floating Text - Show (Last created floating text) for PlayerGroup
                        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                        • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                        • Floating Text - Change (Last created floating text): Disable permanence
                        • Custom script: call DestroyForce(udg_PlayerGroup)
                        • Custom script: call RemoveLocation(udg_TempLoc)
                      • Else - Actions
              • Unit Group - Remove all units from Combat[(Custom value of TempUnit)]
              • Set TempUnit = No unit
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Is (Picked unit) near Creep_Loc[(Custom value of (Picked unit))] and within a range of 1000.00) Equal to (==) False
                  • ((Picked unit) is An Ancient) Equal to (==) True
                • Then - Actions
                • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in CombatGroup) Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
  • Combat End
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in WaitReturn and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Position of (Picked unit)) matches Creep_Loc[(Custom value of (Picked unit))]) Equal to (==) True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from WaitReturn
              • Unit - Make (Picked unit) Vulnerable
              • Unit - Set (Picked unit) acquisition range to (Default acquisition range of (Picked unit))
              • Unit - Make (Picked unit) face Creep_Angle[(Custom value of (Picked unit))] over 0.00 seconds
            • Else - Actions
              • Unit - Order (Picked unit) to Move To Creep_Loc[(Custom value of (Picked unit))]
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in WaitReturn) Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
  • Respawn Creeps Copy
    • Events
      • Unit - A unit Dies
    • Conditions
      • Multiple ConditionsOr - Any (Conditions) are true
        • Conditions
          • (Owner of (Dying unit)) Equal to (==) Neutral Hostile
          • (Owner of (Dying unit)) Equal to (==) Player 12 (Brown)
          • (Owner of (Dying unit)) Equal to (==) Player 11 (Dark Green)
          • (Owner of (Dying unit)) Equal to (==) Neutral Passive
    • Actions
      • Set CombatCheck[(Custom value of (Dying unit))] = 0
      • Unit Group - Remove (Dying unit) from Regen_Timer_Group
      • Unit Group - Remove (Dying unit) from Regen_Group
      • Unit Group - Remove (Dying unit) from CombatGroup
      • Set TempUnit = (Dying unit)
      • Unit Group - Pick every unit in Combat[(Custom value of TempUnit)] and do (Actions)
        • Loop - Actions
          • Unit Group - Remove TempUnit from Combat[(Custom value of (Picked unit))]
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Number of units in Combat[(Custom value of (Picked unit))]) Equal to (==) 0
              • Then - Actions
                • Set CombatCheck[(Custom value of (Picked unit))] = 0
                • Set PlayerGroup = (Player group((Owner of (Picked unit))))
                • Set TempLoc = ((Position of (Picked unit)) offset by (Left, 0.00))
                • Floating Text - Create floating text that reads *Leaving Combat* at TempLoc with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and Trans% transparency
                • Floating Text - Hide (Last created floating text) for (All players)
                • Floating Text - Show (Last created floating text) for PlayerGroup
                • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                • Floating Text - Change (Last created floating text): Disable permanence
                • Custom script: call DestroyForce(udg_PlayerGroup)
                • Custom script: call RemoveLocation(udg_TempLoc)
              • Else - Actions
      • Unit Group - Remove all units from Combat[(Custom value of (Dying unit))]
      • Set TempUnit = No unit
      • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at Creep_Loc[(Custom value of (Dying unit))] facing Creep_Angle[(Custom value of (Dying unit))] degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Dying unit))
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Hide (Last created unit)
      • Unit - Make (Last created unit) Invulnerable
      • Unit Group - Add (Last created unit) to InvisUnits
      • Trigger - Add to CombatStart <gen> the event (Unit - (Last created unit) Acquires a target)
      • Hashtable - Save 40 as (Key timer) of (Custom value of (Last created unit)) in CreepRespawn
      • Trigger - Turn on RespawnTimer <gen>
The system consists of a unit group for each unit - inside are the units they are in combat with

When a unit dies, or leashes they pick each unit they were in combat with, and have that unit remove them from their list, then destroy their own list.

The part where they leash (stop, and run back) works

So, a couple problems
1 the unit stays in the unit group of the hero (Custom value 1) in any case death or leash

2 after the unit leashes it won't come uninvul and seems it never can reach the point that it was at when it was saved with initial trigger.


Theory for 1st - I can't put a loop in a loop :/ But when the unit dies, it isn't in a loop of a loop so... it doesn't even work then still...

Theory for 2nd - The unit somehow can't get exactly in the same spot.

3rd Theory, there is a Point Value of unit instead of a Custom Value of unit somewhere and me and notepad's search feature are blind :(
 
Level 8
Joined
Dec 9, 2009
Messages
397
No, that part is removing the unit that died/leashed, from the combat groups of the other players.

The picked unit will be removed when the unit group of the dying/leashed unit is emptied. (right after the loop)



I've looked these triggers over so many times... Every time I do, it looks like they should be working :/

I added a command that I could type to see which units I'm in combat with, and they are just not being removed from the other units group from death or leashing...
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
So, anyone see anything that would cause this to not work?

I really don't see how it isn't working... I've gone over it so many times
It doesn't seem to enter the loop to remove units when something dies/leashes.
 
Level 8
Joined
Dec 9, 2009
Messages
397
I already added text to the triggers, it seems they don't get to the loop part, but the respawn trigger works, and the leash trigger works (the enemies run away go invul, and heal)
I changed the condition for leaving waitreturn to current order of unit is stop, and it still isn't working.
I'll put this in a map but don't have time atm will do it later tonight.
 
Level 8
Joined
Dec 9, 2009
Messages
397
Here is a test map with my combat triggers in it, it's doing the same thing as in my actual map.

*Download Map here*

I'd like it to work as the triggers should... because I want it to work on NPC vs NPC fighting as well not just the players.
 
Status
Not open for further replies.
Top