Random monster spawning

Discuss programming in the QuakeC language.
Post Reply
Biodude
Posts: 186
Joined: Wed Aug 27, 2008 7:17 pm

Random monster spawning

Post by Biodude »

Hey, what would it take to make a box in world craft, and inside that box monsters randomly spawn on a timer. The box would be invisable ingame, but what could I do to make this? would the only way be making a ton of random monster spawns on timers or what?

thanks
Alex
Posts: 24
Joined: Sun Feb 13, 2011 6:24 pm

Re: Random monster spawning

Post by Alex »

I think part of the problem there would be making sure monsters don't spawn in places that they can't (like inside a wall) or places that they shouldn't (over some lava, or a corner where they get stuck).

Maybe you can populate the area you are looking at with something like a bunch of info_player_deathmatch's and use some of the code in client.qc for random monster respawns.

Not sure exactly how you wanted to use this, but if your aim was to add some randomness to the monster placing (since, if you play a level enough you get to know where all the badguys are and it gets predictable and boring), you could always do this:

In worldcraft, if you know you want to have a monster dog in a certain room, place 4 of them in different spots. Rename them all to monster_dog_random. In the dog.qc, copy void () mosnter_dog and rename it monster_dog_random. Add in a random function that determines whether the dog spawn actually takes place (as is seen in weapons.qc for the axe animation).
if (r > .25) {
return;
}
else {
spawn the dog.

On average you'll get 1 dog in that room. Sometimes there might be 0, other times, 4. That's a basic way of doing it, but it helps shake things up a bit and ad some randomness.

Alex
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

Re: Random monster spawning

Post by goldenboy »

I know two things that would get you halfway there.

1. Hordespawn. The code for func_hordespawn is both in Chapters and RMQ. Originally from Scourge of Armagon, IIRC. You would have to expand the code so the spawned monsters use a randomly selected classname and spawn function (out of a list), and basically set the count or duration to infinite. Would do what you asked, but it's a point entity, not a box. Simply continuously spawns (spams?) monsters in a certain interval and basically swamps the player in monsters. Infamously used in some Quoth maps to hordespawn Vorelings.

2. Pineapple's Randomizer. Part of RMQ (don't know if this was released standalone). This requires pre-selection and placement of the monsters you want to spawn. This would work if you only wanted a limited amount of monsters to spawn. It is more aimed at (pseudo-) randomly populating a map every time you play than continuous spawning.

This isn't quite what you asked for, but you could probably use it to get there. You didn't say what you wanted it for, though. :wink:
hondobondo
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am
Contact:

Re: Random monster spawning

Post by hondobondo »

Biodude wrote:Hey, what would it take to make a box in world craft, and inside that box monsters randomly spawn on a timer. The box would be invisable ingame, but what could I do to make this? would the only way be making a ton of random monster spawns on timers or what?

thanks
i do that in sdquake. the code is in dmsp.qc

http://www.moddb.com/mods/bondos-superduper-quake-25

you prob know that already. make sure to check defs.qc for all the globals
Biodude
Posts: 186
Joined: Wed Aug 27, 2008 7:17 pm

Re: Random monster spawning

Post by Biodude »

I'll check it out, thanks guys :)
Post Reply