HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need an event that detects if a unit is "defending" (Footman defend)

04-25-2007, 05:11 PM#1
olavo
I need to add a periodical mana cost to defend... just like the immolation thing...
any suggestions?

this is how it looks like: And it's not working

Trigger:
Defend Cast
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Defend
Phalanxed[(Player number of (Owner of (Triggering unit)))] Equal to False
Collapse Actions
Set Phalanxed[(Player number of (Owner of (Triggering unit)))] = True
Unit Group - Add (Casting unit) to Phalanxed_Group
Trigger:
Remove Mana
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in Phalanxed_Group and do (Actions)
Collapse Loop - Actions
Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 5.00)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Mana of (Picked unit)) Equal to 0.00
Then - Actions
Collapse Else - Actions
Unit Group - Remove (Picked unit) from Phalanxed_Group
Unit - Order (Triggering unit) to Human Footman - Stop Defend
Set Phalanxed[(Player number of (Owner of (Triggering unit)))] = False
Trigger:
Defend Uncast
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Defend
Phalanxed[(Player number of (Owner of (Triggering unit)))] Equal to True
Collapse Actions
Unit Group - Remove (Casting unit) from Phalanxed_Group
Unit - Order (Triggering unit) to Human Footman - Stop Defend
Set Phalanxed[(Player number of (Owner of (Triggering unit)))] = False
04-25-2007, 05:14 PM#2
Conquestor
Add units to an array when they cast defend, remove them when they cancel it. Then remove mana from every unit in the array, periodically.

Or if you don't have too many units on the map, you could create a new trigger for every unit that is casting defend in JASS, and destroy it once the unit dies/cancels defend.
04-25-2007, 05:18 PM#3
olavo
The Trigger atill isn't detecting that the unit activated defend...
04-25-2007, 05:28 PM#4
tamisrah
If that helps ok, but I have tried your trigger and the event seems not to catch defend. If I change it to
Trigger:
Unit - A unit Issued Order
end changed the condition to
Trigger:
Conditions
(Issued order) Equal to (Order(defend))
it works fine.
04-25-2007, 05:31 PM#5
olavo
Thx a lot dude!
04-26-2007, 04:16 AM#6
Pyrogasm
You can also detect when it stops defending by replacing "defend" in the above condition with "undefend".
04-26-2007, 08:44 AM#7
[VDM]Amn
Trigger:
Remove Mana
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in Phalanxed_Group and do (Actions)
Collapse Loop - Actions
Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 5.00)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Mana of (Picked unit)) Equal to 0.00
Then - Actions
Collapse Else - Actions
Unit Group - Remove (Picked unit) from Phalanxed_Group
Unit - Order (Triggering unit) to Human Footman - Stop Defend
Set Phalanxed[(Player number of (Owner of (Triggering unit)))] = False

If unit's mana is not zero they'll cancel the skill ?