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

Script Help

Recommended Posts

Hi,

I was wondering if I could pick some brains?
I have setup the following script that is activated when the player enters a sector;

//Monster Spawner
script 13 (Void)
{
while (norepeat < 1)
    {
    Floor_MoveToValue (70, 32, 0, 0);
    int repeat = 1;
    while (repeat < 10)
        {
        Thing_Spawn (73, 4, 250);
        Thing_Spawn (74, 4, 135);
        Delay (3*35);
        ++repeat;
        norepeat = 1;
        }
    }
}
I would like to expand upon this script so that it spawns different monsters as the loop gets higher, say up to 50 iterations. It would start by spawning basic zombies then shotgunners and then chaingunners.

What would be the best way for me to expand the above script?

Thanks,

Dave

NOTE: The 'norepeat' variable is there to stop the script from triggering each time the sector is entered and has been declared as a global variable.

Share this post


Link to post

hope i am not too late, if you are going to make it zdoom compatible you can use the spawnspot action: http://zdoom.org/wiki/SpawnSpot

SpawnSpot (str classname, int spottid [, int tid [, int angle]])
instead of "classname" you can set a string array (http://zdoom.org/wiki/Arrays) that contains the various names of the monsters you want to spawn, also you can recall a specific slot of the array with a simple counter.

a script like this could fit (using your acs as base):
int monster1 = 1;

int monster2 = 1;

int monster3 = 1;

//repeat up to how many monsters class you want to spawn at once

int norepeat = 1;

int repeat = 1;

str monsters[ N ] = {"ZombieMan", "ShotgunGuy", "ChaingunGuy", "..." , "MonsterYouWantHereNumberN" }; // N means the number of the slots that the array will have.

//Monster Spawner
script 13 (Void)
{
while (norepeat < 1)
    {
    Floor_MoveToValue (70, 32, 0, 0); //don't know why you have putted that inside the while, you can move it ouside.

    repeat = 1;  //pretty useless imo. norepeat removed for great justice.

    while (repeat < 10)
        {
        SpawnSpot (monsters[ monster1 ], 73 , 0, 250);
        SpawnSpot (monsters[ monster2 ], 74 , 0, 135);

        //insert how many spawnspot you want here...        

        Delay (3*35);
        ++repeat;

            if (repeat = 2)
               {
                monster1++;
                monster2++;
                //etc.
                }

             else if (repeat = 3)
                    {
                     monster1++;
                     monster2++;
                     //etc.
                     }
             else; //etc. etc. etc. modify it as you wish.   
        }

     if([condition to stop the waves met])
        norepeat = 1;

     else
         {
          repeat = 1;
          monster1 = 1;
          monster2 = 1;
          //etc.
         }
    }
}

i think (hope) i have forgot anything...
hope it helped.

Share this post


Link to post

Wow that's great! I'll have a play with that and see what results I get. A few months ago I would've avoided scripting and just used conveyors and teleporters but I much prefer to use ACS when I can now :D

Thanks,

Dave

Share this post


Link to post

Maybe you could refer to Demon Defense, since it uses a script like that, I'm sure. There's a link to it on the "If Doom Was Made Today" thread.

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
×