HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Help: Any Unit's Life Event

06-28-2006, 08:04 PM#1
Zurg
Hey, I've got another triggering problem.
I want to change a units ownership to the attacker when its life becomes less than, say 700. I worked a trigger out like this:
Trigger:
Towns Capture
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
(Life of (Attacked unit)) Less than or equal to 1000.00
((Attacked unit) is A town-hall-type unit) Equal to True
Collapse Actions
Unit - Make (Triggering unit) Invulnerable
Game - Display to (All players) for 20.00 seconds the text: ((Name of (Owner of (Attacking unit))) + ( has captured + (TownNames[(Custom value of (Triggering unit))] + ( from + ((Name of (Owner of (Triggering unit))) + .)))))
Unit Group - Pick every unit in (Units in TownLimits[(Custom value of (Attacked unit))] matching (((Matching unit) is A structure) Equal to True)) and do (Unit - Change ownership of (Picked unit) to (Owner of (Attacking unit)) and Change color)
If (((Attacked unit) is in (Units owned by (Owner of (Attacking unit)))) Equal to True) then do (Do nothing) else do (Player - Add TownVillagerCount[(Custom value of (Attacked unit))] to (Owner of (Attacking unit)) Food cap)
Player - Add (TownVillagerCount[(Custom value of (Attacked unit))] - 0) to (Owner of (Attacked unit)) Food cap
Unit Group - Add TownsHalls[(Custom value of (Attacked unit))] to PlayerTownsOwned[(Player number of (Owner of (Attacking unit)))]
Cinematic - Ping minimap for (All players) at (Position of (Attacked unit)) for 2.00 seconds, using a Simple ping of color (100.00%, 100.00%, 0.00%)
Wait 1.00 game-time seconds
Unit - Make (Triggering unit) Vulnerable
Unit - Set life of TownsHalls[(Custom value of (Attacked unit))] to 50.00%

However, when the unit's life is brought below 700 by catapults attacking ground on it, it will not run the trigger.
My question: Is there anyway to do "Any unit's life becomes less than 700"?
There is only a specific unit event of that nature.

Edit: Sorry, new to the new forums. Fixed the trigger tags.
06-28-2006, 08:11 PM#2
PipeDream
You could hook every single unit with the specific event, but this is madness.
Try using unit is damaged instead of unit is attacked. Your event responses will have to change a bit, hopefully just attacked unit -> trigger unit and attacker -> damage source
06-28-2006, 08:13 PM#3
The)TideHunter(
Firstly, trigger tags are nice:

Trigger:
Towns Capture
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
(Life of (Attacked unit)) Less than or equal to 700.00
((Attacked unit) is A town-hall-type unit) Equal to True
Collapse Actions
Unit - Make (Triggering unit) Invulnerable
Game - Display to (All players) for 20.00 seconds the text: ((Name of (Owner of (Attacking unit))) + ( has captured + (TownNames[(Custom value of (Triggering unit))] + ( from + ((Name of (Owner of (Triggering unit))) + .)))))
Unit Group - Pick every unit in (Units in TownLimits[(Custom value of (Attacked unit))] matching (((Matching unit) is A structure) Equal to True)) and do (Unit - Change ownership of (Picked unit) to (Owner of (Attacking unit)) and Change color)
If (((Attacked unit) is in (Units owned by (Owner of (Attacking unit)))) Equal to True) then do (Do nothing) else do (Player - Add TownVillagerCount[(Custom value of (Attacked unit))] to (Owner of (Attacking unit)) Food cap)
Player - Add (TownVillagerCount[(Custom value of (Attacked unit))] - 0) to (Owner of (Attacked unit)) Food cap
Unit Group - Add TownsHalls[(Custom value of (Attacked unit))] to PlayerTownsOwned[(Player number of (Owner of (Attacking unit)))]
Cinematic - Ping minimap for (All players) at (Position of (Attacked unit)) for 2.00 seconds, using a Simple ping of color (100.00%, 100.00%, 0.00%)
Wait 1.00 game-time seconds
Unit - Make (Triggering unit) Vulnerable
Unit - Set life of TownsHalls[(Custom value of (Attacked unit))] to 50.00%

And secondly, yes you can.

Trigger:
Events
Unit - 'SomeUnits' life becomes Less than 50.00

Please look in future, i wasent hard to find at all.
06-28-2006, 08:15 PM#4
Zurg
Yeah, but thats only for specific units as well. Would a looping trigger that checks all of the buildings' life ammounts be too laggy?
Edit: @TideHunter: I am on patch 1.18, have the triggers changed? Because with specific units I can only select "No Unit" or a unit already on the map.
06-28-2006, 08:20 PM#5
PipeDream
Shadow wrote a generic unit is damaged event. Recent discussion here: http://www.wc3campaigns.net/showthread.php?t=84240

But yes, looping through the buildings, while a dirty hack, would work.