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

[Trigger] Problems with unit pause/unpause

Status
Not open for further replies.
Level 7
Joined
Nov 19, 2007
Messages
253
Hey all,

I made ability that creates field which freezes all enemy units who enter it and everything works fine except the units wont unfreeze when die or when field disappears..
  • Time Prison
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Time Prison
    • Actions
      • Set TimePrisonPoint[1] = (Target point of ability being cast)
      • Set TimePrisonCaster = (Casting unit)
      • Set TimePrisonDuration[1] = (((Real((Level of Time Prison for TimePrisonCaster))) x 1.00) + 4.00)
      • Set TimePrisonDuration[2] = 0.00
      • Unit - Create 1 Dummy Circle for (Owner of TimePrisonCaster) at TimePrisonPoint[1] facing Default building facing degrees
      • Set TimePrisonDummy = (Last created unit)
      • Animation - Play TimePrisonDummy's Large animation
      • Animation - Change TimePrisonDummy's animation speed to 0.00% of its original speed
      • Unit - Add a TimePrisonDuration[1] second Generic expiration timer to TimePrisonDummy
      • Custom script: call RemoveLocation(udg_TimePrisonPoint[1])
      • Set TimePrisonPoint[1] = (Position of TimePrisonDummy)
      • Set TimePrisonUnitGroup[1] = (Units within 400.00 of TimePrisonPoint[1] matching (((Matching unit) belongs to an enemy of (Owner of TimePrisonCaster)) Equal to True))
      • Unit Group - Pick every unit in TimePrisonUnitGroup[1] and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 0.01% of its original speed
          • Unit Group - Add (Picked unit) to TimePrisonUnitGroup[2]
      • Custom script: call DestroyGroup(udg_TimePrisonUnitGroup[1])
      • Trigger - Turn on Time Prison2 <gen>
      • Wait TimePrisonDuration[1] seconds
      • Trigger - Turn off Time Prison2 <gen>
  • Time Prison2
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Set TimePrisonDuration[2] = (TimePrisonDuration[2] + 0.04)
      • Set TimePrisonUnitGroup[1] = (Units within 400.00 of TimePrisonPoint[1] matching (((Matching unit) belongs to an enemy of (Owner of TimePrisonCaster)) Equal to True))
      • Unit Group - Pick every unit in TimePrisonUnitGroup[1] and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 0.01% of its original speed
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in TimePrisonUnitGroup[2]) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to TimePrisonUnitGroup[2]
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TimePrisonUnitGroup[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TimePrisonDuration[2] Greater than or equal to TimePrisonDuration[1]
        • Then - Actions
          • Unit Group - Pick every unit in TimePrisonUnitGroup[2] and do (Actions)
            • Loop - Actions
              • Unit - Unpause (Picked unit)
              • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
              • Trigger - Turn off (This trigger)
          • Custom script: call RemoveLocation(udg_TimePrisonPoint[1])
          • Custom script: call DestroyGroup(udg_TimePrisonUnitGroup[2])
        • Else - Actions
  • Time Prison3
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in TimePrisonUnitGroup[2]) Equal to True
    • Actions
      • Unit - Unpause (Dying unit)
      • Animation - Change (Dying unit)'s animation speed to 100.00% of its original speed
Can anyone tell me what i did wrong?
 
There is no reason to unpause a dead unit.
For the other part, delete these lines:
  • Wait TimePrisonDuration[1] seconds
    • Trigger - Turn off Time Prison2 <gen>
and make your other trigger look like this:
  • Time Prison2
  • Events
    • Time - Every 0.04 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TimePrisonDuration[2] Less than TimePrisonDuration[1]
      • Then - Actions
        • Set TimePrisonDuration[2] = (TimePrisonDuration[2] + 0.04)
        • Set TimePrisonUnitGroup[1] = (Units within 400.00 of TimePrisonPoint[1] matching (((Matching unit) belongs to an enemy of (Owner of TimePrisonCaster)) Equal to True))
        • Unit Group - Pick every unit in TimePrisonUnitGroup[1] and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) is in TimePrisonUnitGroup[2]) Equal to False
              • Then - Actions
                • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
                • Unit - Pause (Picked unit)
                • Unit Group - Add (Picked unit) to TimePrisonUnitGroup[2]
              • Else - Actions
        • Custom script: call DestroyGroup(udg_TimePrisonUnitGroup[1])
      • Else - Actions
        • Unit Group - Pick every unit in TimePrisonUnitGroup[2] and do (Actions)
          • Loop - Actions
            • Unit - Unpause (Picked unit)
            • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
            • Unit Group - Remove (Picked unit) from TimePrisonUnitGroup[2]
        • Custom script: call RemoveLocation(udg_TimePrisonPoint[1])
        • Trigger - Turn off (This trigger)
You don't need to destroy TimePrisonUnitGroup[2].
 
Level 7
Joined
Nov 19, 2007
Messages
253
Still does not work and when i kill hero who is pause and his animation speed is reduced it will revive paused and with 0% animation speed
 
Level 7
Joined
Nov 19, 2007
Messages
253
I found problem..
  • Set TimePrisonUnitGroup[2] = (Last created unit group)
I put this into initialization and it works fine now, anyway thanks for help!
 
Last edited:
Status
Not open for further replies.
Top