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

Help in % Chance to Cast Spells

Status
Not open for further replies.
Level 3
Joined
Jun 25, 2006
Messages
32
Hello to all. I was just wondering, how do you trigger a unit to have a chance to cast a spell when it attacks? Example, the Hero has a 35% chance to cast Chain Lightning when he attacks. Please also tell me how to increase its chances per level. Thanks :D
 
Level 13
Joined
Jun 22, 2004
Messages
783
I think I explained thise before ones, but here goes another try to let you guys understand it, the only thing, you need is an integer variable, and lets call that chance to make things more clear.

With that done we are going to build the trigger, first we need the event that will trigger when our unit attacks
  • events
    • If a unit is attacked
Then we need to check if the units is equal to the unit that has the spell, you can use a unit-type condition for it.
  • conditions
    • unit type of attacking unit is equal to of "your unit type"
Then we need the set the chance (which should be 100% so you can use 35%)
  • Set Chance = (Random integer number between 1 and 100)
Than following up to that we are going to make another condition like this to make sure it will only hit 35% of the time.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Chance Less than or equal to 35
    • Then - Actions
      • Unit - Order (Attacking unit) to Orc Far Seer - Chain Lightning (Attacked unit)
    • Else - Actions
That would be it
 
Level 7
Joined
Nov 12, 2005
Messages
299
once again i suggest that you do not use triggers. for example the above trigger will not work unless your unit has chain lightning.
find the spell "orb of lightning (new)", change the spell cast from purge to chain lightning and chance to whatever you want. then just give it to some unit and there you have it.
 
Status
Not open for further replies.
Top