• 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.

detect if unit attacks

Status
Not open for further replies.
Level 9
Joined
May 27, 2006
Messages
498
i meant when the attack is launched exactly. like a ranged attacker first launched it's projectile and still didn't deal damage.
Imo 'Unit is attacked' would best fit your needs, altho this event is commonly known to bug. For example, you can order the unit to attack, trigger detects this and fires, but then you order your unit to stop. Actual attack didn't take place, but the trigger will still run. You would need to do some bulletproofing to prevent exploiting.

Well, what's your goal anyway? Maybe we'll find a better solution.
 
Level 16
Joined
Aug 20, 2009
Messages
1,554
at my point of view... he wants something like...

"when unit A (Ranged Unit) Launches a Missile at Unit B"
"the Trigger Detects!!Right after the missile is launched"
"Before Unit B Gets Damaged"

in this kind of case, then, use "a unit is attacked" event. it best fits as raft_pl mentioned.
 
Level 13
Joined
Sep 29, 2008
Messages
672
the reason why i don't like damage detection is because it abuses the detection. because i have so many damage per second skills that it would have to detect and check conditions every time DPS spells act. as they are most used maybe 15+ times in every .02 seconds and more when normal damage is done.
 
Level 13
Joined
Sep 29, 2008
Messages
672
i had another thought. Because I wanted to count how many times the unit attacks. I mean a spell like after a hero unleashes 5 attacks it releases a stronger damage. does that projectile system you're talking about can count attacks? unlike "a unit - is attacked it can be abused.
 
Level 16
Joined
Aug 20, 2009
Messages
1,554
if that's the case, why not use damage detection system?...

when "unit takes damage" thingy

just
http://www.hiveworkshop.com/forums/1668483-post8.html

change the damage floating text(The THIRD Trigger, just change it), into add +1 (attacks leashed) integer, (set AttackedLeashed = AttackLeashed + 1)

and if - (attacks leashed) integer is equals to 5
make damage source damage +extra bonus damage you wanted, to attacked unit,
of type normal or whatever.

then, set attacks leashed integer = 0.

easy?.\\the above triggers can't be abused, but cause some leak, when the attacked unit is killed.

it works perfectly, if the attacking unit didn't deals any damage, or landed an attack, it won't trigger.

so, if you attack it, then stop before hitting, it won't increase the integer,

however, skills casted by the hero will also increase the count.use some dummy tricks to deal with that.


SO...

it will come like this.

Copy the first 2 trigger in the link

link it to the third trigger which has no event

Condition
Level of 5AttackLeashCombo for attacking unit is greater than 0

Action -
Set AttackLeashed = AttackLeashed + 1
If AttackLeashed Greater than or equals to 5
Then -
make damage source damage +extra bonus damage you wanted, to attacked unit,
of type normal or whatever.
Set AttackLeashed = 0
Else -
-(leave it blank)

Yea! xD
 
Status
Not open for further replies.
Top