• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,552
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
671
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
671
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,552
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