• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] General Unit Event

Status
Not open for further replies.
Level 9
Joined
Oct 3, 2006
Messages
302
Hello, I'm trying to make this trigger
Needed:
-Any kind of unit's (meaning any of all the units in map) HP gets lower than 10%

Effect:
-Change the ownership of the "triggering unit" (the unit that has <10%hp) to player 5 (a neutral player)
-Make "triggering unit" invulnerable
-Issue order on "triggering unit" to hold position
-Play "triggering unit's" death animation
 
Level 4
Joined
Feb 2, 2009
Messages
71
Hmm, I think there's no efficient way of doing this.

This is me being lazy:
Events:
Every 1 sec

conditions:
niet/null/nada/nothing

Actions:
Pick every unit matching (percentage life of (matching unit) less then (10)%) <--- this is a 'real comparison'
Do the shit with Picked Unit
 
Level 9
Joined
Oct 3, 2006
Messages
302
Tnx for that....I think I get the picture about your trigger.... +rep
ANybody got other options about how to do it...just for future knowledge for me. :D

EDIT:I can't find the appropriate triggers for it.
It doesn't work at all...I've been looking for the triggers that says "Pick every unit matching (percentage life of (matching unit) less then (10)%)"

EDIT: Ah,no wait...found it..."real comparison" tnx...
 
Last edited:
Level 11
Joined
Nov 15, 2007
Messages
800
There's no way in GUI to track non-specific units taking damage. They'd have to be preset. I'm sure someone could give you some JASS help with it if you're willing to experiment, otherwise the periodic event should work fine as long as the timer is low enough.
 
Level 2
Joined
Aug 8, 2008
Messages
17
It took some looking but you can always use this:

Event: Unit is Attacked

Condition: Percent Life of (Triggering Unit) is equal to or less than 10.00

Events: Change Ownership of (Triggering Unit) to neutral and change color to color of (Triggering Unit)
Events: Make (Triggering Unit) Invulnerable
Events: Issue order on (Triggering Unit) to Hold Position
Events: Play (Triggering Units) Death animation
 
Level 13
Joined
Mar 16, 2008
Messages
941
To do this, you need to know the action "Trigger - Add event to xyz", duno the exact name. It adds an event to a trigger.
a) On map init, pick all units on the map and to "Trigger - Add "picked unit takes damage" to "Mydamagedetection"
b) a second trigger that fires when a unit enters map and to "Trigger - Add "triggering unit takes damage" to "Mydamagedetection"

The damage detection trigger itself has no event, but conditions/actions :)
Same works with hp gets lower then 10% (with any specific event).
 
Level 4
Joined
May 4, 2008
Messages
113
No, it isn't the best way. Check the post above yours :p.

Speaking of that post, http://www.hiveworkshop.com/forums/pastebin.php?id=jehavo

Demo map for the trigger that he's talking about. Then you can make a trigger

Code:
Events:
N/A, added by trigger of course

Conditions
Life of (Triggering unit) Less than or Equal to (Max life of (Triggering unit)) / 10

Actions
<do stuff>

Hope that helps
 
Status
Not open for further replies.
Top