Temporarily halt/change an 'every x' spawn rule depending on attribute
Sooo, I have a rule in my game that changes a game attribute to a random number between 1-15 every 1.5 seconds using the methods explained in the 'timers are for chumps' post. It's something like this:
if game.timermod > self.time%1.5
set game.enemies to random(1, 15)
Then I have different enemies spawning according to the random number.
My problem is that I want to stop a certain actor spawning if he was spawned just before or if a certain other enemy is around. I.E If enemy1 was just spawned, do not spawn him again 1.5 seconds later (as the spawn rule normally dictates). Or if enemy12 was just spawned, do not spawn enemy14 on the next spawn, for example.
I want the normal random spawning to continue after these exceptions though, so if enemy1 was just spawned I don't mind him spawning again 2 spawns later (3 seconds), but not immediately after.
Does this make sense? Am I missing something really obvious? Should I be doing my spawning in some other way?
Any help would be much appreciated!
if game.timermod > self.time%1.5
set game.enemies to random(1, 15)
Then I have different enemies spawning according to the random number.
My problem is that I want to stop a certain actor spawning if he was spawned just before or if a certain other enemy is around. I.E If enemy1 was just spawned, do not spawn him again 1.5 seconds later (as the spawn rule normally dictates). Or if enemy12 was just spawned, do not spawn enemy14 on the next spawn, for example.
I want the normal random spawning to continue after these exceptions though, so if enemy1 was just spawned I don't mind him spawning again 2 spawns later (3 seconds), but not immediately after.
Does this make sense? Am I missing something really obvious? Should I be doing my spawning in some other way?
Any help would be much appreciated!
Comments
A
B
C
D
E
Choose a random row with random(1,tableRowCount(tableName)) and then based on the value (e.g. "B"), you would spawn that particular actor. If you spawn B, you would remove that row:
A
C
D
E
Let's say you spawn "D" next:
A
C
E
So 1.6 seconds after you spawned B, you would add the spawned actor name back in and repeat the process:
A
C
E
B
[Let's say you spawn "A" next.] So 1.6 seconds after you spawned D, you would add it back in:
C
E
B
D
And so on...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User