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

Math Expression Issue (Multiple Intervals)

Status
Not open for further replies.
Level 8
Joined
Mar 26, 2009
Messages
301
I am planning to make a new creep spawn system that spawns random creeps based on random number between 0-100. The table is something like this:
0-25 = Zombie
26-33 = Mutated Bat
34-65 = Ghoul
66-72 = Forgotten One
73-80 = Abomination
81-85 = Fiend
86-90 = Stalker
90-95 = Glowing One
96-100 = Dreadlord

I was planning to use If/Then/Else function to achieve what I want. But then, it occured to me that -for instance- using ... equal or greater than 34, it is going to spawn Ghouls as well as anything else above integer value 34. So how should I make this system? Is it possible to tell game engine to check if X integer fulfills following condition (in GUI?): 34 < x z 65 in
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • 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 30
      • Then - Actions
        • -------- spawn unit 1 --------
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • i Less than 60
          • Then - Actions
            • -------- spawn unit 1 --------
          • Else - Actions
            • -------- spawn unit 3 --------
1-29 unit 1
30-59 unit 2
60-100 unit 3
 
Level 8
Joined
Mar 26, 2009
Messages
301
  • 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 30
      • Then - Actions
        • -------- spawn unit 1 --------
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • i Less than 60
          • Then - Actions
            • -------- spawn unit 1 --------
          • Else - Actions
            • -------- spawn unit 3 --------
1-29 unit 1
30-59 unit 2
60-100 unit 3
Briliant idea. I haven't been able to test it yet but looks logical =)
 
Status
Not open for further replies.
Top