HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Percentages!! Ahh!

02-19-2004, 07:52 AM#1
Cronanius
does anybody know of a percentage action (triggers)? I've been looking for the past couple hours but I can't find anything that works. I want a thing that works with

Action - For Each Integer A do <action(s)>

Where it says <action> I need something similar to this...

Action - Give +2% chance to hex attacking unit

...Or something like that. Or maybe I need to use a different action or something. If anyone can help me out, plz reply. (Or if you can't understand what I'm talking about, plz reply)
02-19-2004, 08:26 AM#2
Alakafizz
It's commonly done by setting an integer variable to a random number between 1 - 100, and then checking with an if-statement if it's below your needed percentage.

Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Set i = (Random integer number between 1 and 100)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                i Less than or equal to 2
            Then - Actions
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Last created unit)
            Else - Actions