• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] On attack event

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
Im making a spell that after X attacks it will expire, thou this isnt the problem. The problem is the best way to detect that attack. EVENT_PLAYER_UNIT_ATTACKED, we know this event can be bugged, by ordering that unit to stop ect. and the problem with a damage detection system is if the unit is ranged you may get a extra attack out of it (since if wont detect it untill the projectile hits the unit). So my question is how would you do it. A perfect attack detection that is :D
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Shouldn't you try using Orb of Slow's base ability, change it to fire off 100%, make it in a disabled spellbook, change the triggered ability to something else and see if you can actualy check that ability fired off in the triggers?

If you can check the dummy spell actualy firing off, you could probably use it.

Just an idea :p
 
Level 7
Joined
May 3, 2007
Messages
210
JASS:
EVENT_UNIT_DAMAGED
Doesn't bug. It requires a global unit reference though, so you better recycle units if you want to use it.

And if I remember correctly. Player Unit Attacked procs when the unit actuall goes through with the attack order, that is to say, they're issued the order, then they actual do the order, the event fires when they do the order. It doesn't "bug".

Also, i've never heard of a damage detection (like IDDS) bugging on ranged units. Could be wrong on that though.
 
Level 9
Joined
Aug 21, 2008
Messages
533
It only bugs in this case:
let us say the unit have 1 attack with +100 damage. it attacks and while the missle flys it attacks again.After the second attack the attacked unit is damaged , but the second missles still have the +100damage.

Maybe a solution would be triggering the damage. So instead og giving the unit actually a +100damage buff,you damage every unit for 100 which is damaged from a attack of the buffed unit.
 
Level 9
Joined
Aug 21, 2008
Messages
533
Very complicated way:
Make all range units to have instant attacks(now the normal damage detection cant bugg)
When they do damage save the life off the damaged unit give it a ability which gives it +100klife(or something)-Save damage somewhere(use any kind of storage like hashtables )
make a timer with 0.00
when timer expires remove ablitity and set unit life to saved life(this makes that it dont take damage)
Now create a dummy with a 1-1 attackd amage(you need the 1 damage so your systems till can filter spells with 0 damage)
Set the custom value of the dummy to the saved damage
order it to attack the damaged unit(make sure that it still look like that the missle is the one from the attacker)
when the attacked unit gets the damage from the dummy damage it for the custom value of the dummy in pure damage and remove the dummy
At this point you can also do everything you needed to do :grin:
you also could give the unit orb effects(so maybe you give a unit a chance of 50% to make a attack which lowers armor etc.)

well this should be bugfree and exactly what you like:grin:
This is better than just using a damage detect system cause the dummys only attack once so they cant bug
if i confused you just tell me =)
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
You could just do the following:
A unit starts an attack, make a dummy, issue the unit to attack it.
Check the dmg dummy took and aply it to the real target if the dummy didn't suffer damage from the attacking unit in the next 2-3 seconds, remove it.

Should be leak free and all, also you could use this as a smart way of damage detection as you could store the damaging entity in a struct and check the source of damage on the dummy unit, if it checks out to be ok just calculate the damage and aply it to the real target and remove the dummy.

Just a thought though :p
 
Level 13
Joined
Mar 16, 2008
Messages
941
There are only damage detection and the normal attack detection... sorry, but there isn't another solution, you have to use a system using both if them.
But, afaik, the damage done isn't saved in the missle.
The damage is calculated with the stats on damage, at least the passiv from viper (+damage in a height related to the missing life of the target) increases vipers damage in the moment the missle hits its target :O
 
Level 9
Joined
Aug 21, 2008
Messages
533
o sry
but it isnt easily aviodable cause damage is calcucated when the missle is fired. Only if you make custom damage, the damage is calculated when it acually hits the target, thats wy vipers netotoxin damage calculate its damage when it actually hits. The bonus damage is triggered!
and i already mentioet that you could aviode this bug with triggered damage but he need something different
 
Status
Not open for further replies.
Top