Advertisement
Somedudewithawrench

ACS code

Aug 10th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.10 KB | None | 0 0
  1. (If you are a mapper reviewing this, certain codes that you can changed are wrapped in *'s)
  2.  
  3. #include "zcommon.acs"
  4. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  5. *
  6. * COOP Last Man Standing
  7. *
  8. * run this wad only in survival mode with maxlives 1
  9. * don't use Red Skull, it is used to help counting the players
  10. *
  11. * + - - - - - - - - - - - +
  12. * | start room | <--- START_ROOM_TAG
  13. * | |
  14. * + - - - - - - - - - -- + <--- Script Execute MAP_CONTROL_CYCLE
  15. * | crusher | <--- CRUSHER_TAG
  16. * + - - - - - - - - - -- +
  17. * | |
  18. * | main area o | <--- monster spawn point with spawn_tid
  19. * | |
  20. * | o | <--- monster spawn point with spawn_tid
  21. * + - - - - - - - - - -- +
  22. *
  23. *
  24. * _________________
  25. * < script by Krawa >
  26. * -----------------
  27. * \ ^__^
  28. * \ (@@)\_______
  29. * (__)\ )\/\
  30. * ||----w |
  31. * || ||
  32. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  33. */
  34.  
  35. // defines for scripts
  36. #define SC_DEBUG 1
  37. #define SC_PREPARE_BATTLE 2
  38. #define SC_MAP_CONTROL_CYCLE 3
  39. #define SC_PLAYER_CHECK 4
  40. #define SC_DEATH 7
  41.  
  42. //timer
  43. #define SEC 35 // 35 tics = 1 second (don't change)
  44. #define MONSTER_SPAWN_TICS 10 // time between monsters spawn (in tics)
  45. #define PREPARE_TIME 60 // time before the monsters are counted
  46.  
  47. //tags
  48. #define MONSTER_TID 666 // TID for counting monsters
  49.  
  50. ****************************************************************************
  51. #define MIN_MONSTERS 70 // minimum monsters
  52. ****************************************************************************
  53.  
  54. // TIDs for the spawn points of the monsters
  55. #define MAX_SPAWN_TID 9
  56. int spawn_tid[MAX_SPAWN_TID] = {4, 5, 6, 7, 8, 9, 10, 11, 12};
  57.  
  58. // monster defines: http://zdoom.org/wiki/Doom_spawn_numbers
  59. #define MAX_MONSTER_ARRAY 25 ^
  60. int monster[MAX_MONSTER_ARRAY] = | For if you can't find certain things
  61. **********************************************************************
  62. {(In these brackets you can put what monsters you want to spawn
  63. in your map EG:) T_IMP, T_DEMON};
  64. **********************************************************************
  65.  
  66. int numbers[10] =
  67. {"NUMB0", "NUMB1", "NUMB2", "NUMB3", "NUMB4",
  68. "NUMB5", "NUMB6", "NUMB7", "NUMB8", "NUMB9"};
  69.  
  70.  
  71.  
  72. int players;
  73. int monsters;
  74. bool prepare_done;
  75. bool map_control_active;
  76.  
  77. script SC_PREPARE_BATTLE (void)
  78. {
  79. ThingCount(0, MONSTER_TID);
  80. Delay(SEC*PREPARE_TIME);
  81. prepare_done = TRUE;
  82. }
  83.  
  84.  
  85. // spawns the monsters
  86. script SC_MAP_CONTROL_CYCLE (void)
  87. {
  88. int ran1;
  89. int ran2;
  90.  
  91. if (map_control_active)
  92. terminate;
  93. Print(s:"Welcome to Invasion!");
  94. Delay(SEC*3);
  95. Print(s:"To win you must be the last player alive");
  96. Delay(SEC*4);
  97. Print(s:"Good Luck!");
  98. Delay(SEC*2);
  99. Print(s:"Invasion begins in - 10");
  100. Delay(SEC);
  101. Print(s:"Invasion begins in - 9");
  102. Delay(SEC);
  103. Print(s:"Invasion begins in - 8");
  104. Delay(SEC);
  105. Print(s:"Invasion begins in - 7");
  106. Delay(SEC);
  107. Print(s:"Invasion begins in - 6");
  108. Delay(SEC);
  109. Print(s:"Invasion begins in - 5");
  110. Delay(SEC);
  111. Print(s:"Invasion begins in - 4");
  112. Delay(SEC);
  113. Print(s:"Invasion begins in - 3");
  114. Delay(SEC);
  115. Print(s:"Invasion begins in - 2");
  116. Delay(SEC);
  117. Print(s:"Invasion begins in - 1");
  118. Delay(SEC);
  119. LocalAmbientSound("lofight",128);
  120. Print(s:"Fight!");
  121.  
  122.  
  123. map_control_active = TRUE;
  124. ACS_Execute(SC_PREPARE_BATTLE, 0, 0, 0, 0);
  125.  
  126. while((Players > 1) || (prepare_done == false))
  127. {
  128. //print(s:"monsters left ", d:monsters); For debug purposes
  129. monsters = ThingCount(0, MONSTER_TID);
  130. if (monsters < MIN_MONSTERS)
  131. {
  132. ran1 = (Random(1, MAX_SPAWN_TID)-1); // 0..MAX_SPAWN_TID-1
  133. ran2 = (Random(1, MAX_MONSTER_ARRAY)-1); // 0..MAX_MONSTER_ARRAY-1
  134.  
  135. // This tells how many Archviles are allowed in the map
  136. ******************************************************************************
  137. if ((monster[ran2] == T_VILE) && (ThingCount(T_VILE, 0) >= 2))
  138. ******************************************************************************
  139. Thing_SpawnFacing(spawn_tid[ran1], T_IMP, FALSE, MONSTER_TID);
  140. else //normal
  141. Thing_SpawnFacing(spawn_tid[ran1], monster[ran2], FALSE, MONSTER_TID);
  142.  
  143. }
  144. Delay(MONSTER_SPAWN_TICS);
  145. }
  146.  
  147. monsters = ThingCount(0, MONSTER_TID);
  148.  
  149. while (monsters>0)
  150. {
  151. monsters = ThingCount(0, MONSTER_TID);
  152. Delay(SEC);
  153. }
  154. Delay(2*SEC);
  155.  
  156. while (PlayerCount() < 1)
  157. {
  158. Delay(SEC); // if Player dies after last monster,
  159. } // survial mode will restart round.
  160.  
  161. Exit_Normal(0);
  162. }
  163.  
  164. // counts the players
  165. script SC_PLAYER_CHECK open
  166. {
  167. players = PlayerCount();
  168. Delay(SEC);
  169. Restart;
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement