• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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