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

[Solved] How to detect multiplies?

Level 18
Joined
Jun 2, 2009
Messages
1,233
Hello everyone. I want to do something like this in a practical way and i will be happy if you can share any method you know. I need more than 1 solution for some reason

x equal to 3
run trigger

x equal to 6
run trigger

x equal to 9
run trigger

goes like this.
 
Level 24
Joined
Feb 27, 2019
Messages
833
Math modulo can be used to make sure x is dividable by 3. If x is dividable by 3 it returns 0.
  • (X mod 3) Equal to 0
Examples: The first causes X to rotate between numbers 1, 2 and 0. The second causes X to keep incrementing. Both give the same result in the condition.
  • Set VariableSet X = ((X + 1) mod 3)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X Equal to 0
    • Then - Actions
      • Trigger - Run Trigger <gen> (ignoring conditions)
    • Else - Actions
  • Set VariableSet X = (X + 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (X mod 3) Equal to 0
    • Then - Actions
      • Trigger - Run Trigger <gen> (ignoring conditions)
    • Else - Actions
Another option is to set x back to 0 each time its equal to 3.
  • Set VariableSet X = (X + 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X Equal to 3
    • Then - Actions
      • Set VariableSet X = 0
      • Trigger - Run Trigger <gen> (ignoring conditions)
    • Else - Actions
I suppose x doesnt have to be reset if another variable is added that also increments to fit for the next condition.
  • Actions
    • Set VariableSet X = (X + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • X Equal to Y
      • Then - Actions
        • Set VariableSet Y = (Y + 3)
        • Trigger - Run Trigger <gen> (ignoring conditions)
      • Else - Actions
 
Last edited:
Top