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, remember arrays start at 0 */
- int tics; /* variable for tic counter */
- script 1 OPEN /* script to keep track of tics */
- {
- while(TRUE){
- Delay(1);
- ++tics; }
- }
- Script 2 (void)
- {
- int x, y, z, ang, tid;
- /* 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 */
- tid = UniqueTID(); /* grab a new unique tid for the weapon we're about to spawn */
- /* for Random() function to 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 */
- SpawnForced (weapons[Random(0, 3);], x, y, z , tid, ang); /* spawn the random weapon at the position of the spawning actor with the uniquetid */
- /* loop until the item you just spawned is picked up */
- while(ThingCount(T_NONE, tid)) { /* this will return true until it is picked up */
- Delay(1); } /* we need such a short delay if we are approximating sv_weaponstay, but with random weapons */
- 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_itemrespawntime for zandronum apparently and I can't find a concrete respawn time */
- Delay(428); /* wait 12 seconds */
- /* we recreate this */
- /* "Is the current tic value a multiple of 32? If not, do not respawn." */
- /* and "Choose a random number from 0 to 255. Is it less than or equal to 4? If so, respawn." */
- While((tics % 32) != 0){
- Delay(1); }
- /* 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