Advertisement
Guest User

once more with feeling

a guest
Aug 20th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. str weapons[3] = { "weapon0", "weapon1", "weapon2", "weapon3" }; /* array to store all your weapon names in, remember arrays start at 0 */
  2.  
  3. int tics; /* variable for tic counter */
  4.  
  5. script 1 OPEN /* script to keep track of tics */
  6. {
  7. while(TRUE){
  8. Delay(1);
  9. ++tics; }
  10. }
  11.  
  12. Script 2 (void)
  13. {
  14. int x, y, z, ang, tid;
  15.  
  16. /* get the spawner actor's position */
  17. x = GetActorX(0);
  18. y = GetActorY(0);
  19. z = GetActorZ(0);
  20.  
  21. /* and angle */
  22. ang = GetActorAngle (0);
  23.  
  24. while(TRUE){ /* this is just the main loop that will be forever looped forever */
  25. tid = UniqueTID(); /* grab a new unique tid for the weapon we're about to spawn */
  26. /* 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 */
  27. SpawnForced (weapons[Random(0, 3);], x, y, z , tid, ang); /* spawn the random weapon at the position of the spawning actor with the uniquetid */
  28. /* loop until the item you just spawned is picked up */
  29. while(ThingCount(T_NONE, tid)) { /* this will return true until it is picked up */
  30. Delay(1); } /* we need such a short delay if we are approximating sv_weaponstay, but with random weapons */
  31.  
  32. if(!GetCVar("SV_WeaponStay") /* if sv_weaponstay is not on */
  33. && GetCVar("SV_ItemRespawn")){ /* and items are set to respawn */
  34.  
  35. /* then we recreate the awful respawn timer for items found here : https://doomwiki.org/wiki/Spawning
  36. because there is no such thing as sv_itemrespawntime for zandronum apparently and I can't find a concrete respawn time */
  37. Delay(428); /* wait 12 seconds */
  38. /* we recreate this */
  39. /* "Is the current tic value a multiple of 32? If not, do not respawn." */
  40. /* and "Choose a random number from 0 to 255. Is it less than or equal to 4? If so, respawn." */
  41. While((tics % 32) != 0){
  42. Delay(1); }
  43. /* now we recreate "Choose a random number from 0 to 255. Is it less than or equal to 4? If so, respawn." */
  44. while(Random(0,255)>5){
  45. Delay(32);} }
  46. while(!GetCVar("SV_ItemRespawn")){ /* In case items aren't set to respawn */
  47. 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 */
  48.  
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement