Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- str weapons[3] = { "weapon0", "weapon1", "weapon2", "weapon3" }; /* array to store all your weapon names in, remeber array start at 0 */
- Script 1 (void)
- {
- int x, y, z, ang, tid, rand;
- /* get the spawner actor's position */
- x = GetActorX(0);
- y = GetActorY(0);
- z = GetActorZ(0);
- /* and angle */
- ang = GetActorAngle (0);
- while(TRUE){ /* this is just the main loop that will be forever looped forever */
- rand = Random(0, 3); /* choose random weapon, min should be 0, max should be same as array to get all things in array, in this case 0 to 3 */
- /* you can actually do without the rand variable, feel free to replace rand with the Random function in the array below, kept it in for ease of explanation */
- tid = UniqueTID(); /* grab a new unique tid for the weapon we're about to spawn */
- SpawnForced (weapons[rand], x, y, z , tid, ang); /* spawn the random weapon at the position of the spawning actor with the uniquetid */
- while(ThingCount(T_NONE, tid)) { /* loop until the item you just spawned is picked up */
- Delay(1); }
- if(!GetCVar("SV_WeaponStay") /* if sv_weaponstay is not on */
- && GetCVar("SV_ItemRespawn")){ /* and items are set to respawn */
- /* then we recreate the awful respawn timer for items found here : https://doomwiki.org/wiki/Spawning
- because there is no such thing as sv_itemrespawn for zandronum apparently and I can't find a concrete respawn time */
- Delay(428); /* wait 12 seconds */
- /* we approximate this */
- /* "Is the current tic value a multiple of 32? If not, do not respawn." */
- /* by random initial delay, and then a check every 32, instead of having to have a tic counter running somewhere */
- Delay(Random(0, 31));
- /* now we recreate "Choose a random number from 0 to 255. Is it less than or equal to 4? If so, respawn." */
- while(Random(0,255)<5){
- Delay(32);} }
- while(!GetCVar("SV_ItemRespawn")){ /* In case items aren't set to respawn */
- Delay(5); } /* wait around and see if they are so that maps aren't broken if people accidentally set flags the wrong way or change their mind */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement