Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
OldDoomMapper

Monster generator script

Question

Hello all,

GZDoom, Doom Builder 2, UDMF map.

I would like to:

1)Spawn a zombie at a map spot

2)Thrust it in a know direction

3)Repeat 25 times

Unfortunately my script seems not to work as expected: some zombies are thrusted, some are not.

 

        int NewZombieTid=UniqueTID(); //Unused TID
        for(int nSpawn=0;nSpawn<25;;)    
        {
            if(Thing_Spawn(SpotId,"T_ZOMBIE",180*256/360,ZombieTid)) 
            {
                ThrustThing(180*256/360,30,0,ZombieTid); //Thrust the just generated zombie in 180 degree direction
                ZombieTid=UniqueTID(); //Get another TID
                nSpawn++;
            }

            delay(70);
      }

Any idea?

Thank you!

 

Share this post


Link to post

1 answer to this question

Recommended Posts

  • 0

That script will not even complie because of syntax errors in your for loop, and even if it'd compile it would not spawn anything because you're supplying a wrong 2nd parameter to Thing_Spawn. Here's a working version:
 

#include "zcommon.acs"

script 1 OPEN
{
    int SpotId = 1;
    int ZombieTid = UniqueTID();

    for(int nSpawn=0; nSpawn<25; nSpawn++)
    {
        while(!Thing_Spawn(SpotId, T_ZOMBIE, 180*256/360, ZombieTid))
            Delay(70);

        ThrustThing(180*256/360, 30, 0, ZombieTid); // Thrust the just generated zombie in 180 degree direction
        ZombieTid = UniqueTID(); // Get another TID
    }
}

Note that the T_ZOMBIE is not in quotes, since it's a constant defined in one of the files included by zcommon.acs. If you want to spawn things by their class name you have to use SpawnSpot or one of it's variants.

 

Example WAD is attached.

zombiespawner.zip

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×