| 11-11-2007, 02:53 PM | #1 |
How can i make a passive ability ,that allows the hero to have a x% chance to cast an ability on the unit that is attacked by him?? with other words that hero has a x% chance to cast Shadow Strike , Frost Nova ... on the unit that is attacked by him . So ,how can i do it ? |
| 11-11-2007, 03:27 PM | #2 |
There are two events usable for this: 1) Units is attacked. It has one main disadvantage - it triggers when the unit STARTS attacking - when the ATTACK ANIMATION BEGINS. -> the attack can be canceled and the ability will still fire. 2) Unit takes damage. This event has to be mapped to EVERY possiblle target for the ability (all units on the map most times) - look for damage detection system. Then you simply generate random integer from 1 to 100 and make siple condition (let's say the chance is 20%) if the random number is > 80 -> do something (usually cast a spell using dummy caster). You can also use some orb ability (like Maelstrom in dota), but then the ability doesn't fire if the attack's target was autoacquired. |
| 11-11-2007, 03:41 PM | #3 |
| 11-11-2007, 04:42 PM | #4 |
| 11-11-2007, 05:02 PM | #5 |
i have already seen that On Attack Template but i don't understand it so i can't create new attack templates like he did. |
| 11-11-2007, 05:31 PM | #6 |
Attack templates are not necessary. Classical OnAttack event works just fine. (It is not 100% precise but who cares, it is a game after all...) |
| 11-11-2007, 07:46 PM | #7 |
You could use a variation of Orb of Slow. That can cast abilities on attack with a % chance. |
| 11-11-2007, 07:50 PM | #8 |
Or of Slow AFAIK doesn't fire on attacks on autoacquired targets |
| 11-11-2007, 07:55 PM | #9 |
Ah, right. I forgot about that issue. Don't use Orb of Slow, then. |
