- Joined
- Jun 27, 2010
- Messages
- 3,260
if a spell is cast on a unit, make that unit invulnerable?
else if ability effect fades make vulnerable?
else if ability effect fades make vulnerable?
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.
You could add the Invulnerable ability to the unit, there's also a GUI action that makes a unit invulnerable.
Untitled Trigger 001

Events


Unit - Paladin 0000 <gen> Starts the effect of an ability

Conditions


(Ability being cast) Equal to Divine Protection

Actions


Unit - Make (Target unit of ability being cast) Invulnerable
Events

Einheit - A unit starts the effect of an ability
Conditions

(Ability being cast) == YourAbility
Actions

Custom script: local unit u

Custom script: set u = GetSpellTargetUnit()

Set Duration = ((Real((Level of (Ability being cast) for (Triggering unit)))) x 5.00)

Custom script: call SetUnitInvulnerable( u, true )

Wait Duration seconds

Custom script: call SetUnitInvulnerable( u, false )
btw, for buffs there is a simple boolean comparrison, if unit has buff = true


Cast

Events


Unit - Paladin 0000 <gen> Starts the effect of an ability

Conditions


(Ability being cast) Equal to Divine Protection

Actions


Unit - Make (Target unit of ability being cast) Invulnerable
paladins

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


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



If - Conditions




(Paladin 0000 <gen> has buff Divine Protection) Equal to False



Then - Actions




Unit - Make Paladin 0000 <gen> Vulnerable



Else - Actions
archmages

Events


Time - Every 0.10 seconds of game time

Conditions


(Archmage 0001 <gen> has buff Divine Protection) Equal to False

Actions


Unit - Make Archmage 0001 <gen> Vulnerable
Looks like someone already posted the complex method and you didn't want it stan so I will post exactly what you seem to want. The way your doing it now is bad and uses up un-required RAM. Try to use a way that you don't need so many triggers like the way that is shown in the attachment below. Fyi my other method did work unless you wanted to use purge in your map. Then I am not sure still it was a good method too.
gruopstanivul

Events


Time - Every 1.00 seconds of game time

Conditions


(Number of units in invulgroup) Greater than 0

Actions


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



Loop - Actions




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





If - Conditions






((Triggering unit) has buff Divine Shield) Equal to True





Then - Actions





Else - Actions






Unit - Make (Picked unit) Vulnerable






Unit Group - Remove (Picked unit) from invulgroup
remove invul

Events


Time - Every 0.12 seconds of game time

Conditions

Actions


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



Loop - Actions




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





If - Conditions






((Triggering unit) has buff Divine Protection) Equal to True





Then - Actions






Unit - Make (Picked unit) Vulnerable






Unit Group - Remove (Picked unit) from DIVINE_PROT





Else - Actions
remove invul

Events


Time - Every 0.12 seconds of game time

Conditions

Actions


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



Loop - Actions




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





If - Conditions






((Picked unit) has buff Divine Protection) Equal to True





Then - Actions






Unit - Make (Picked unit) Vulnerable






Unit Group - Remove (Picked unit) from DIVINE_PROT





Else - Actions
