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

Factor ?

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Is there is any math formula for factor in Trigger Editor ?
Example:
  • (Level of (Triggering unit)) Equal to *AllNumbersThatAreFactorsOf 2*
Or I MUST do it like this ?
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of (Triggering unit)) Equal to 2
          • (Level of (Triggering unit)) Equal to 4
          • (Level of (Triggering unit)) Equal to 6
    • Then - Actions
    • Else - Actions
 
I can't sort this out in GUI but I think you can get the idea in JASS:

JASS:
function CheckLevel takes nothing returns nothing
    local integer level = GetHeroLevel(GetTriggerUnit())
    if (level > 2 and ModuloInteger(level, 2) != 0) then
        // the number can be 3, 5, 7, 9, etc.
    endif
endfunction

Edit: Maker beat me to it :p
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Code:
((x mod 2) == 1)
If x = 3
3 mod 2 = 1
If x = 4
4 mod 2 = 0
if x = 5
5 mod 2 = 1

Alternative lol.
 
Last edited:
Status
Not open for further replies.
Top