- Joined
- Sep 19, 2020
- Messages
- 190
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I don't want this, I make trigger but is now work goodUse an existing trap like goblin landmines and modify it so that when the trap goes off (dies)
Bear Trap Loop

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


For each (Integer BearTrap_LoopIndex) from 1 to BearTrap_Index, do (Actions)



Loop - Actions




Unit Group - Pick every unit in (Units within 50.00 of (Position of BearTrap_Trap[BearTrap_LoopIndex]) matching (((Matching unit) belongs to an enemy of (Owner of BearTrap_Caster)) Equal to True)) and do (Actions)





Loop - Actions






Game - Display to (All players) the text: 1






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








BearTrap_Traped[BearTrap_LoopIndex] Equal to False







Then - Actions








Set BearTrap_Traped[BearTrap_LoopIndex] = True








Set BearTrap_Target[BearTrap_LoopIndex] = (Random unit from (Units within 50.00 of (Position of BearTrap_Trap[BearTrap_LoopIndex]) matching (((Matching unit) belongs to an enemy of (Owner of BearTrap_Caster)) Equal to True)))








Unit - Remove BearTrap_Dummy[BearTrap_LoopIndex] from the game








Unit - Create 1 Dummy for (Owner of BearTrap_Caster) at (Position of BearTrap_Trap[BearTrap_LoopIndex]) facing Default building facing degrees








Set BearTrap_Dummy[BearTrap_LoopIndex] = (Last created unit)








Unit - Add a 2.00 second Generic expiration timer to BearTrap_Dummy[BearTrap_LoopIndex]








Unit - Add Trap to BearTrap_Dummy[BearTrap_LoopIndex]








Unit - Order BearTrap_Dummy[BearTrap_LoopIndex] to Orc Raider - Ensnare BearTrap_Target[BearTrap_LoopIndex]








Animation - Play BearTrap_Trap[BearTrap_LoopIndex]'s spell animation








Unit - Remove Ghost from BearTrap_Trap[BearTrap_LoopIndex]







Else - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(BearTrap_Trap[BearTrap_LoopIndex] is dead) Equal to True





Then - Actions






Unit - Remove Bear Trap (Air) buff from BearTrap_Target[BearTrap_LoopIndex]






Unit - Remove Bear Trap (Ground) buff from BearTrap_Target[BearTrap_LoopIndex]






Set BearTrap_Dummy[BearTrap_LoopIndex] = BearTrap_Dummy[BearTrap_Index]






Set BearTrap_Target[BearTrap_LoopIndex] = BearTrap_Target[BearTrap_Index]






Set BearTrap_Trap[BearTrap_LoopIndex] = BearTrap_Trap[BearTrap_Index]






Set BearTrap_Traped[BearTrap_LoopIndex] = BearTrap_Traped[BearTrap_Index]






Set BearTrap_Traped[BearTrap_LoopIndex] = BearTrap_Traped[BearTrap_Index]






Set BearTrap_Index = (BearTrap_Index - 1)






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








BearTrap_Index Equal to 0







Then - Actions








Trigger - Turn off (This trigger)







Else - Actions





Else - Actions
Set BearTrap_Traped[BearTrap_LoopIndex] = BearTrap_Traped[BearTrap_Index]
Unit - Create 1 Dummy for (Owner of BearTrap_Caster) at (Position of BearTrap_Trap[BearTrap_LoopIndex]) facing Default building facing degrees
Set BearTrap_Dummy = (Last created unit)
Game - Display to (All players) the text: Integer(BearTrap_LoopIndex)
Set BearTrap_Target[BearTrap_LoopIndex] = (Random unit from (Units within 50.00 of (Position of BearTrap_Trap[BearTrap_LoopIndex]) matching (((Matching unit) belongs to an enemy of (Owner of BearTrap_Caster)) Equal to True)))
bear trap is hide, when enemy is around, he's trapped and trap is show and have 10 HP, trap duration is 0 and enemy is need to destroy trap to be freeAlso, how does the spell work exactly? Can the Bear Trap be attacked and killed? Is the idea that the enemy can break out of the trap early if they destroy it?
5) You may not be Indexing it properly in your other trigger. You should post that one too.
Bear Trap Fnish

Events


Unit - A unit Finishes casting an ability

Conditions


(Ability being cast) Equal to Bear Trap

Actions


Set BearTrap_Index = (BearTrap_Index + 1)


Unit - Create 1 Bear Trap for (Owner of BearTrap_Caster) at BearTrap_Point facing Default building facing degrees


Set BearTrap_Trap[BearTrap_Index] = (Last created unit)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




BearTrap_Index Equal to 1



Then - Actions




Trigger - Turn on Bear Trap Loop <gen>



Else - Actions
BearTrap Cast

Events


Unit - A unit Begins casting an ability

Conditions


(Ability being cast) Equal to Bear Trap

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




BearTrap_Index Equal to 10



Then - Actions




Unit - Order (Triggering unit) to Stop



Else - Actions
Bear Trap Start

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Bear Trap

Actions


Set BearTrap_Caster = (Triggering unit)


Set BearTrap_Point = (Target point of ability being cast)
just 1 trap work when I have 2 trap in ground it is not workSo what exactly doesn't work about it? Do the traps not activate? Does ensnare not work?
Bear Trap create

Events


Unit - A unit enters (Playable map area)

Conditions


(Unit-type of (Triggering unit)) Equal to Bear Trap

Actions


Set VariableSet TrapLimit = (TrapLimit + 1)


-------- A slight delay before the trap "arms" (OPTIONAL) --------


Wait 2.00 seconds


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




((Triggering unit) is alive) Equal to True



Then - Actions




Unit Group - Add (Triggering unit) to TrapGroup




Trigger - Turn on Bear Trap timer <gen>



Else - Actions
Bear Trap cancel

Events


Unit - A unit Begins casting an ability

Conditions


(Ability being cast) Equal to Bear Trap

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




TrapLimit Equal to 10



Then - Actions




Unit - Order (Triggering unit) to Stop.



Else - Actions
Bear Trap timer

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


Unit Group - Pick every unit in TrapGroup and do (Actions)



Loop - Actions




Set VariableSet Trap = (Picked unit)




Set VariableSet TrapPoint = (Position of Trap)




Set VariableSet TrapEnemyGroup = (Units within 50.00 of TrapPoint.)




-------- --------




-------- Remove unwanted units from TrapEnemyGroup --------




Unit Group - Pick every unit in TrapEnemyGroup and do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








((Picked unit) is alive) Equal to True








((Picked unit) belongs to an enemy of (Owner of Trap).) Equal to True








((Picked unit) is invulnerable) Equal to False








((Picked unit) is A structure) Equal to False







Then - Actions








-------- It's a valid target - do nothing --------







Else - Actions








Unit Group - Remove (Picked unit) from TrapEnemyGroup.




-------- --------




-------- Try to get a random nearby enemy target --------




Set VariableSet TrapTarget = No unit




Set VariableSet TrapTarget = (Random unit from TrapEnemyGroup)




-------- --------




-------- If a target was found then cast Ensnare --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






TrapTarget Not equal to No unit





Then - Actions






Unit - Remove Ghost from Trap






Animation - Play Trap's attack animation






Set VariableSet TrapTargetSaved[(Custom value of Trap)] = TrapTarget






Set VariableSet TrapTargetCV = (Custom value of TrapTarget)






Set VariableSet TrapTargetCount[TrapTargetCV] = (TrapTargetCount[TrapTargetCV] + 1)






Trigger - Run Bear Trap fix animation <gen> (ignoring conditions)






Unit Group - Remove Trap from TrapGroup.






-------- --------






Unit - Create 1 Dummy for (Owner of Trap) at TrapPoint facing Default building facing degrees






Set VariableSet TrapDummy = (Last created unit)






Unit - Add a 1.00 second Generic expiration timer to TrapDummy






Unit - Add Ensnare (Bear Trap) to TrapDummy






Unit - Order TrapDummy to Orc Raider - Ensnare TrapTarget





Else - Actions




-------- --------




Custom script: call DestroyGroup (udg_TrapEnemyGroup)




Custom script: call RemoveLocation (udg_TrapPoint)


-------- --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Number of units in TrapGroup) Equal to 0



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions
Bear Trap fix animation

Events

Conditions

Actions


Custom script: local unit u = udg_Trap


Wait 0.50 seconds


-------- Freeze the traps animation --------


Custom script: if (IsUnitAliveBJ(u)) then


Custom script: call SetUnitTimeScalePercent( u, 0.00 )


Custom script: endif
Bear Trap trap dies

Events


Unit - A unit Dies

Conditions


(Unit-type of (Triggering unit)) Equal to Bear Trap

Actions


Set VariableSet Trap = (Triggering unit)


Set VariableSet TrapLimit = (TrapLimit - 1)


Set VariableSet TrapCV = (Custom value of Trap)


Animation - Change Trap's animation speed to 100.00% of its original speed


Unit Group - Remove Trap from TrapGroup.


-------- --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




TrapTargetSaved[TrapCV] Not equal to No unit



Then - Actions




Set VariableSet TrapTarget = TrapTargetSaved[TrapCV]




Set VariableSet TrapTargetCV = (Custom value of TrapTarget)




-------- --------




-------- Reduce the number of Bear Traps the target is affected by (but never below 0) --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






TrapTargetCount[TrapTargetCV] Greater than 0





Then - Actions






Set VariableSet TrapTargetCount[TrapTargetCV] = (TrapTargetCount[TrapTargetCV] - 1)





Else - Actions




-------- --------




-------- If the target isn't affected by any other Bear Traps then set it free --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






TrapTargetCount[TrapTargetCV] Equal to 0





Then - Actions






Unit - Remove All buffs from TrapTarget





Else - Actions




-------- --------




Set VariableSet TrapTargetSaved[TrapCV] = No unit



Else - Actions
Bear Trap enemy dies

Events


Unit - A unit Dies

Conditions


TrapTargetCount[(Custom value of (Triggering unit))] Greater than 0

Actions


Set VariableSet TrapTargetCount[(Custom value of (Triggering unit))] = 0
