Warcraft III resources & community, 2003–2006 · archived

Percentage

5 posts
#1

Percentage

Hi all, i was creating a spell called Knockback. I got all the triggering correct except for the percentage. I'm trying to get a percentage to knockback an enemy unit. Here's my script:

This one is Knockback 1:

Event:
A unit is attacked
Condition:
Attacking unit = tauren
Action:
For each Integer 1 - 10 do action: Turn on Trigger <Knockback 2>
wait 0.2 seconds
Turn off Trigger <Knockback2>


If you guys need to know, Knockback 2 is this:
Event:
Every 0.01 seconds
Condition:
Action
Move <knockbacked> instantly to position of <knockbacked> with 5 offset towards <knockbacker> angle



is it me or is my integer thingy wrong? i can't figure it out! Any help is appreciated
#2
If u use abilities that have a percentage to be cast, always use this

Actions:
If: integer - math random number between 1 and 100 = XX
Then: 'knockback actions'
Else: Do Nothing
#3
wait hold up. What does the XX in "random number between 1-100 = XX" mean?
#4
% goes to 100, so 'a random number between 1 and 100 is XX' is a number from 1-99 (if u do 100 u dont have to use the change trigger)
#5
Just put that at the begining of the actions :
If ((Random integer number between 1 and 100) Less than or equal to 40) then do (Do nothing) else do (Skip remaining actions)
40 is the % chance. If you want it diffrent, change 40 to whatever you want