HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Chance to Cast

11-11-2007, 02:53 PM#1
zetanno
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
CommanderZ
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
cohadar
Trigger:
onAttack
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
(Level of Ability for (Attacked unit)) Greater than 0
(Random integer number between 1 and 100) Less than or equal to 30
Collapse Actions
Custom script: Use dummy caster to cast whatever....
11-11-2007, 04:42 PM#4
TEC_Ghost
http://wc3campaigns.net/showthread.php?t=91354

There ya go bud, exactly what you're looking for.
11-11-2007, 05:02 PM#5
zetanno
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
cohadar
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
Pyrogasm
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
CommanderZ
Or of Slow AFAIK doesn't fire on attacks on autoacquired targets
11-11-2007, 07:55 PM#9
Pyrogasm
Ah, right. I forgot about that issue.

Don't use Orb of Slow, then.