• 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.

how to make a chance on hit?

Status
Not open for further replies.
Level 8
Joined
Aug 8, 2008
Messages
340
Hello can someone tell/explain to me how i can make a chance on hit spell, that gets higher when the spell gets a higher leavel?
(Using triggers)
Like this:
Leavel 1 Heros attacks has a 15% chance to (Do my effect)
Leavel 2 Heros attacks has a 20% chance to (Do my effect)
Leavel 3 Heros attacks has a 25% chance to (Do my effect)
 
Level 18
Joined
Sep 27, 2005
Messages
2,069
unit begins the effect of an ability ( Lets say your spell does 100 damage okay )
ability being cast = your spell
set a ( integer variable ) = random number 1 - 100
if a > 15 then:
dmg target of ability being cast for 100
else
do nothing



and for levels just use
if a > 15 and level of abiltiy being cast = 1
then dmg 100
else
if a > 15 and level of abiltiy being cast = 2
then dmg 200
else
if a > 15 and level of abiltiy being cast = 3
then dmg 300
else
do nothing

Understand?
 
Seriously, you guys are on the right track, but take this example map into acount. The best way to make your spell look good is to find the perfect fitting event to trigger the spell. The event "Starts the effect of an ability" fires right when the mana is used and the caster is unable to be stopped from casting the spell. It is right when the projectile is created, so dealing damage before the projectile hits would look rediculous.
But you where on the right track with the random integer.
View attachment Spell On Hit Example.w3x
 
Level 8
Joined
Aug 8, 2008
Messages
340
Well... It still dosen't work
My spell:
Events - Unit Starts the effect of an ability
Conditions - Ability begin cast equal to Orb of lightning (New)
Random integer number between 1 and 100 less then or equal to 15
Actions - If/Then/Else
If Conditions - leavel of Orb of lightning (New) for casting unit equal to 1
Then Actions - (The effect)
Else Actions - If/Then/Else (and so one)
What am i doing wrong? (It has to be chance on auto attack)
 
Level 18
Joined
Sep 27, 2005
Messages
2,069
Random integer number between 1 and 100 less then or equal to 15
Actions - If/Then/Else
If Conditions - leavel of Orb of lightning (New) for casting unit equal to 1
Then Actions - (The effect)
Else Actions - If/Then/Else (and so one)
What am i doing wrong? (It has to be chance on auto attack)

set a = math random number between 1 and 100

if then else

if a < 15
and if level = 1

then...

Don't forget the and function: if a and if level
 
Level 8
Joined
Aug 8, 2008
Messages
340
Ohh i can see the mistake now the orb spell does not count as a spell. so it can't use the trigger... But how can I then make a chance on auto attack (The arrows do also not work)
 
Level 6
Joined
May 3, 2006
Messages
81
Just stick with the orb of lightning new ability. It's pretty much impossible to make a chance on hit passive spell without JASS or something.

I used to do it like this:

Event: A unit is attacked

Condition: Attacking unit = Your Hero
Level of PASSIVE = blah blah X amount
Random Integer between 1-100 greater than or equal to 75 (that 25% for all you kiddies out there)

Action: wait 0.25 seconds (just a little wait so that your guy actually hits the enemy with his attack)
Deal 1000 spell damage to attacked unit (this is just an example you can put any triggers here and use ATTACKED UNIT as the target of the attack)

THIS is buggy though, if you pull your unit back and cancel the attack during his animation the trigger will still go off sadly.
 
Level 11
Joined
Jul 28, 2007
Messages
920
Cant he just stop unit if chance is equal to false, lets call integral "chance"
When unit begins casting an ability
set chance to 1-100
if chance is greater than 15, pause unit,stop unit,unpause unit... that will prevent unit from casting a spell.
 
Status
Not open for further replies.
Top