How do Monster Generators work?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

How do Monster Generators work?

Post by Remy »

I've got a query. From what I remember, monster generators are supposed to continuously spawn new monsters once they're activated. I might be wrong on that, but I thought that was what was supposed to happen.
But, as far as I can tell, monster_generator in DSB doesn't do that - it spawns once, then deactivates itself until ('regen') number of ticks - which is cool because it'll ignore any new M_ACTIVATEs or M_TOGGLEs during that time- then reactivates itself, but doesn't spawn again, unless it recieves a new M_ACTIVATE or M_TOGGLE message after that.
Again, I could be wrong, but I thought they were supposed to just keep spawning. I understand why, of course - this sort of thing can quickly fill an area with monsters if not handled carefully - in fact, because DSB doesn't care about the number of monsters on a tile, it could keep spawning monsters onto the same square, resulting in a "super group" of ugly baddies.
Also, if it did reactivate and spawn when it recieves an M_NEXTTICK, then it could never be shut off (M_DEACTIVATE would simply be reversed by the M_NEXTTICK still waiting in the Message Queue).
But as it's currently set up, a M_DEACTIVATE will kill it (assuming there's not an M_NEXTTICK waiting - but there likely isn't, since it only sends one). It will set the INACTIVE flag to true. A M_ACTIVATE after that first checks that flag - if it's true, it just bails out. The only way to bring it back is with a M_NEXTTICK (which sets INACTIVE to false), then a M_ACTIVATE to get it going again (well, to spawn one more time).
Again, I could be wrong about how it's supposed to behave.
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

No, monster generator never created monster continuously.

The current behavior is the supposed behavior of a monster generator : be disabled for a time, and only generate monster when triggered AND enabled.

I think the max number of monsters on a tile is 5, but I might be wrong.

I suppose that copying this exact behavior for a msg generator would be the best idea.
What Is Your Quest ?
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post by Remy »

The current behavior is the supposed behavior of a monster generator : be disabled for a time, and only generate monster when triggered AND enabled.
Alright, I'm wrong. :lol:
I suppose that copying this exact behavior for a msg generator would be the best idea.
Not quite - the msg_generator shouldn't require a new outside trigger to go again - it should trigger itself until M_DEACTIVATEd (or if it has a msg_counter, or whatever it's going to be called, that runs out).
I think the max number of monsters on a tile is 5, but I might be wrong.
There is no limit in DSB - the monster_generator caps a single 'generation' at 4 monsters, though. In DSB, you can spawn as many monsters on a single square as you'd like - which I suppose means you could create little tiny monsters if you animate them correctly, and attack your players with swarms.
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

Then, for a msg_generator, my idea would be to fire (target,msg,delay) for "count" times, with interval "regen" between each firings. Every time, count is decremented, and internal "tc" is incremented.
If the msg_generator gets ACTIVATED, it starts a cycle.
If it gets DEACTIVATED, it stops the cycle.
If count = -1, it never stops, unless DEACTIVATED.
If "count" reaches zero, it resets and stops.
What Is Your Quest ?
Post Reply