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

Random effects?

Status
Not open for further replies.
Level 1
Joined
Aug 17, 2005
Messages
5
hi i was just wondering how i could make a spell have like a 50% chance to do one action and a 50% chance to do another? for example i want to make spells in my new map "failable" and if a unit fails a spell i want them to take damage but if it doesnt fail i want the regular spell efect to happen, i also need to be able to do this in some triggers that arnt spell related so can someone give me a hand? :roll:
 
Level 8
Joined
Nov 27, 2004
Messages
251
Code:
Trigger
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Your Ability
    Actions
        Set Chance = (Random integer number between 1 and 2)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Chance Equal to 0
            Then - Actions
                -------- then actions --------
            Else - Actions
                -------- else actions --------

this will work
 
Status
Not open for further replies.
Top