• 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, creating a percent based spell, that applies buffs based on the rolled percent!

Level 1
Joined
Sep 16, 2024
Messages
1
Any kind of guidance would be appreciated as I'm quite new to this.

I want to create a passive spell, that every 20 seconds and upon learning, rolls a 1-100 check and applies a buff based on the values of the roll(>=33,66,100).
I have the framework of how to have the effects themselves apply, via dummy's and level layered spells. However I can't understand how to have the triggers check the value, determine the result, apply, then move on.

Preferably, I'd like it to check the current buff applied, and omit it from the pool, so the same buff can not refresh itself immediately.
From reading other posts it seems the [wait] action is very prone to problematic behaviors so I've been attempting to avoid using it.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You will use an integer variable to store the number you 'roll' and then compare it multiple times. You can't just compare to a random number directly in if-conditions because that won't be the same random number for all the checks.
  • Set YourInt = (Random number from 1 to 100)
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • YourInt Greater Equal to 100
    • Then - Actions
      • -------- do 100 things here --------
    • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • YourInt Greater than or Equal to 66
        • Then - Actions
          • -------- do 66-99 things here --------
        • Else - Actions
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • YourInt Greater than or Equal to 33
            • Then - Actions
              • -------- do 33-65 things here --------
            • Else - Actions
              • -------- if you end up here the roll was 1-32 since it failed everything above --------
By checking in reverse-order with nested if-blocks (the 'next' one is part of the Else block of the 'previous' one) you avoid having to compare the variable to two values (since these are single boolean checks and you've nested in *Else*s, the inverse of the 'previous' checks in the chain are implicitly true 'down' the chain), but you could do so just as easily:
  • Set YourInt = (Random number from 1 to 100)
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • YourInt Greater than or Equal to 33
      • YourInt Less than 66
    • Then - Actions
      • -------- do 33-65 things here --------
    • Else - Actions
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • YourInt Greater than or Equal to 66
      • YourInt Less than 99
    • Then - Actions
      • -------- do 66-99 things here --------
    • Else - Actions
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • YourInt Equal to 100
    • Then - Actions
      • -------- do 100 things here --------
    • Else - Actions
 
Top