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

weapon spawning?

Recommended Posts

I'm mapping in zdoom (udmf) format is there a way to make weapons and health kits respawn like they do say in zdaemon multiplayer? And how would I go about doing this. I was thinking with ACS script but was wondering if there was any easier way.

Share this post


Link to post

Item Re spawn is a console variable you set either through the game menu under game play options or through the console window. If you don't want (or trust) those who play your map to set the proper settings, you could try passing console var settings via command line parameters so they initialize properly. I'm not very adept at using these zdoom features, so I can't write out the commands you would need.

Look up the wiki for more help.

Share this post


Link to post

Another option is SpawnSpot. It requires simple acs scripting and can be activated via switch. Just copy and paste:

#include "zcommon.acs"

script 1 (void)

{
SpawnSpot ("Shotgun", 1, 200);
SpawnSpot ("TeleportFog", 1);
delay(900);
}

This will allow the player to flip a switch, spawning a shotgun, and the switch will be unusable for 900 tics. You just need to place a Mapspot thing somewhere with a thing id of 1. And make a switch that activates script 1. The new shotgun will also have a new tid of 200. If you don't want this, just erase it. The TelportFog is the green shiny stuff that comes when something teleports. There's a way to loop it so you don't need a switch, but it's complicated and I'm not familiar with it.

Share this post


Link to post

Is it possible to not have the player press a switch? More like when they pick up the weapon or ammo, etc, that after 900 tics it would respawn in the same spot, I did it with ACS Script but it only respawned once, I would like it to repeat whenever you pick up the item.
The reason why I would like to be able to do this was because I was thinking of a survival map, where they would have to respawn.

Share this post


Link to post

I figured it out, really quite simple I just did this:

#include "zcommon.acs"

Script 1 (void)
{
Delay(300);
Thing_SpawnFacing(1, 28, 0, 999);
Restart;
}

I made it spawn the chaingun but you can do any item/weapon/thing you want. Thank you for the replies.

Share this post


Link to post

The problem with your script is that it will just keep piling on weapons. I bet that if the game runs long enough, your map will crash. Also, their is no down period after pickup. Finally, its of type (void). It would most preferable if it ran from the start of the map. If you really want to re spawn items through ACS, you can use this script I made:

/*
DISCLAIMER: THIS ITEM RESPAWN SCRIPT WAS WRITTEN BY fiend-o-hell (aka
FoH) AND THUS YOU MUST GIVE CREDIT WHERE CREDIT IS DO. DO NOT REMOVE
THIS DISCLAIMER WHEN PORTING OR MODIFYING THIS SCRIPT. OTHERWISE, I
WILL BE DISPLEASED WITH YOU! OTHER THAN THAT, USE TO YOUR HEARTS
CONTENT!
*/

//item spawn script
#define ITEM_START 100        //TID start range of respawn item
#define ITEM_END 102          //TID end range of respawn item
#define RESPAWN_START 1       //spawn spot start
#define RESPAWN_END 3         //spawn spot end (for reference only)
/*LEAVE ALONE*/#define ITEM_AMT ITEM_END-ITEM_START+1 //amount of items to respawn

/*OPTIONAL*/#define ITEM_CHECK 100      //length of time before respawn script restarts
/*OPTIONAL*/#define ITEM_DOWN 8       //amount of item checks that go by until item is respawned

str respawnItems[ITEM_AMT] = {"Shotgun","Chaingun","Clip"};

int  downTime[ITEM_AMT]; //acts as both a tracker and a counter of downed items.
                        //0 means item has not been picked up.
                        
script 950 OPEN
{
    int itemPos = 0;
    int spawnPos = RESPAWN_START;
        
    for( int i=ITEM_START; i <= ITEM_END; i++)
    {
        str item = respawnItems[itemPos];

        //if item is down (counter not at zero)
        if( (downTime[itemPos] < ITEM_DOWN) && downTime[itemPos] )
            downTime[itemPos]++;
        else downTime[itemPos] = 0; //reset counter
                
        //check if item exsists & not down
        if( !ClassifyActor(i) && !downTime[itemPos] )
        {
            SpawnSpot( item, spawnPos, i, 0 );
            downTime[itemPos]++;  //start down time          
        }
        
        itemPos++;
        spawnPos++;
    }
    
    delay(ITEM_CHECK);
    restart;
}
Its ready to copy paste into any map. Here is a quick explanation on how to use:

1. set the constants (the #define lines) first unless those lines have LEAVE ALONE warnings.

The spawn spots and the items will each have to have their own TID assigned. Make sure the TID ranges you pick are free and are consecutive.

Assign Spawn spots their TID in the editor. You should not assign weapons a TID since they do not exist yet. That is done by SpawnSpot(). Just make sure to reserve a range with ITEM_START and ITEM_END.

You can modify the down period (period after item pickup) if you want (note the OPTIONAL).

2.Fill respawnItems[ITEM_AMT] string array with items you want to spawn. The order in the array corresponds to the spawn spot TID order

3.(optional)add additional effects to the SpawnSpot() line (such as sound and or spawn fx).

And their you go!

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
×