• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Percentage

Status
Not open for further replies.
Level 3
Joined
Oct 30, 2005
Messages
51
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
 
Level 3
Joined
Mar 2, 2006
Messages
40
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
 
Status
Not open for further replies.
Top