home *** CD-ROM | disk | FTP | other *** search
/ Ultra Collection Level Ad…e, Duke, Warcraft 2, C&C / ULTRA_Collection_Level_AddOn_-_Quake_Duke.iso / hexenlev / prg59.zip / FLAGHEX.ACS next >
Text File  |  1996-03-26  |  15KB  |  465 lines

  1. //-------------------------------------------------------------------
  2. // TAGHEX01.ACS
  3. // Script file for TAGHEX.WAD
  4. //-------------------------------------------------------------------
  5.  
  6. // The Gem team has the gem for it's flag.
  7. // The Skull team has the skull for it's flag.
  8.  
  9. #include "specials.acs"
  10. #include "defs.acs"
  11. #include "wvars.acs"
  12.  
  13. int gemscore;   // Score for gem/pedestal team.
  14. int skullscore; // Score for statue skull/team.
  15. int gemid;      // TID of Big Gem puzzle item.
  16. int skullid;    // TID of Skull puzzle item.
  17. int skulloc;    // TID of Skull location.
  18. int gemloc;     // TID of Gem location.
  19. int nplayers;   // Number of players.
  20. int monstdoor;  // Monster (boss) door sector ID.
  21. int skulluse;   // 1=Skull sitting there; 2=Skull being carried.
  22. int gemuse;     // 1=Gem sitting there; 2=Gem being carried.
  23. int skulltime;  // Time when skull is picked up.
  24. int gemtime;    // Time when gem is picked up.
  25. int gentime;    // Use to time random generator.
  26. int genloc;     // Random thing generator location.
  27. int gswin;      // Someone won, don't open the other door.
  28. int bossrel;    // Boss moster release flag.
  29. int dscore;     // 0=Don't do anything; 1=Skull scored; 2=Gem scored.
  30. int timeann;    // Time announcement for next random respawn.
  31.  
  32. //-------------------------------------------------------------------
  33. // Initialization
  34. //-------------------------------------------------------------------
  35. script 0 OPEN
  36. {
  37.     gemscore   = 0;
  38.     skullscore = 0;
  39.         gemid = 4;
  40.         skullid = 3;
  41.         skulloc = 5;
  42.         gemloc = 6;
  43.         skulluse = 1;
  44.         gemuse = 1;
  45.         nplayers = PlayerCount();
  46.         monstdoor = 1; // Sector tag. The doors have to have sequential tags.
  47.         gentime = timer();
  48.         genloc = 30;
  49.         gswin = 0;
  50.         bossrel = 0;
  51.         dscore = 0;
  52.  
  53.         ACS_Execute(const:1,1,0,0,0); // Main processing loop.
  54. }
  55.  
  56. //-------------------------------------------------------------------
  57. // Called from: script 0
  58. // Calls      : script 5,6,11,50
  59. //-------------------------------------------------------------------
  60. script 1 (void)
  61. {
  62. int mynoise;
  63. while (1==1)
  64.     {
  65. //-----------------------------------------------
  66. // Here is the way it's looking. When a player picks up the skull/gem,
  67. // the thingcount will equal 0. You can't track what the player is carrying.
  68. // So, how about this? Respawn a skull/gem in 5 minutes if it hasn't been
  69. // used yet.
  70. //-----------------------------------------------
  71.  
  72. // Extra important note!!! With this kind of loop (i.e. 1==1), there has to
  73. // be a delay. Otherwise it hogs up all the processing time. Talk about non-
  74. // multitasking. You can also use "Restart". Just watch variable initialization.
  75.  
  76.         delay(2*35); // Check once every 2 seconds.
  77.  
  78.         if (random(1,4) == 1) // Make noise in swamp room.
  79.             {
  80.             mynoise = random(1,4);
  81.             Switch(mynoise) // Swamp room
  82.                 {
  83.                 Case 1:
  84.                     {
  85.                     thingsound(55,"Ambient1",64); // Insects1
  86.                     break;
  87.                     }
  88.                 Case 2:
  89.                     {
  90.                     thingsound(55,"Ambient2",64); // Crickets
  91.                     break;
  92.                     }
  93.                 Case 3:
  94.                     {
  95.                     thingsound(55,"Ambient3",64); // Crickets1
  96.                     break;
  97.                     }
  98.                 Case 4:
  99.                     {
  100.                     thingsound(55,"Ambient5",64); // Frogs
  101.                     break;
  102.                       }
  103.                 }
  104.             }
  105.         if (random(1,4) == 1)
  106.             {
  107.             mynoise = random(1,3);
  108.             Switch(mynoise) // Steel rooms.
  109.                 {
  110.                 Case 1:
  111.                     {
  112.                     thingsound(56,"Ambient12",48); // Chains
  113.                     break;
  114.                     }
  115.                 Case 2:
  116.                     {
  117.                     thingsound(56,"Ambient14",48); // Steel1
  118.                     break;
  119.                     }
  120.                 Case 3:
  121.                     {
  122.                     thingsound(56,"Ambient15",48); // Steel2
  123.                     break;
  124.                     }
  125.                 }
  126.             }
  127.  
  128.         // Skull has been picked AND it's been more than 5 minutes.
  129.         if (skulluse == 2)
  130.             {
  131.             if (timer() > (skulltime + 10500))
  132.                 {
  133.                 ACS_Execute(const:5,1,0,0,0); // Run script 5 to respawn skull.
  134.                 }
  135.             }
  136.         // Gem has been picked AND it's been more than 5 minutes.
  137.         if (gemuse == 2)
  138.             {
  139.             if (timer() > (gemtime + 10500))
  140.                 {
  141.                 ACS_Execute(const:6,1,0,0,0); // Run script 5 to respawn gem.
  142.                 }
  143.             }
  144.  
  145.         // Somebody scored. Release the next mage/fighter/cleric boss.
  146.         if (bossrel == 1)
  147.             {
  148.             bossrel = 0;
  149.             ACS_Execute(const:11,1,0,0,0); // Run release boss script.
  150.             }
  151.  
  152.     if (gswin != 0) // 0-Nothing; 1-Gem wins; 2-Skull wins; 3-All done.
  153.         {
  154.         if (gswin <=2)
  155.             {
  156.             Switch(gswin)
  157.                 {
  158.                 Case 1:
  159.                     {
  160.                     gswin = 3; // Lock them out! Only one team gets their door open.
  161.                     Print(s:"GEM TEAM WINS!");
  162.                     Delay(3*35);
  163.                     Print(s:"SKULL TEAM, BE PREPARED TO DIE...");
  164.                     Door_Raise(31,200,0);
  165.                     Delay(4*35);
  166.                     Break;
  167.                     }
  168.                 Case 2:
  169.                     {
  170.                     gswin = 3; // Lock them out! Only one team gets their door open.
  171.                     Print(s:"SKULL TEAM WINS!");
  172.                     Delay(3*35);
  173.                     Print(s:"GEM TEAM, BE PREPARED TO DIE..");
  174.                     Door_Raise(30,200,0);
  175.                     Delay(4*35);
  176.                     Break;
  177.                     }
  178.                 }
  179.             }
  180.         }
  181.  
  182.         Switch(dscore) // Display scores.
  183.             {
  184.             Case 1:
  185.                 {
  186.                 dscore = 0;
  187.                 Print(s:"GEM TEAM SCORES!");
  188.                 Delay(3*35);
  189.                 Print(s:"SCORE IS NOW, ");
  190.                 Delay(3*35);
  191.                 Print(s:"SKULL TEAM: ",d:skullscore,s:" GEM TEAM: ",d:gemscore);
  192.                 Break;
  193.                 }
  194.             Case 2:
  195.                 {
  196.                 dscore = 0;
  197.                 Print(s:"SKULL TEAM SCORES!");
  198.                 Delay(3*35);
  199.                 Print(s:"SCORE IS NOW, ");
  200.                 Delay(3*35);
  201.                 Print(s:"SKULL TEAM: ",d:skullscore,s:" GEM TEAM: ",d:gemscore);
  202.                 Break;
  203.                 }
  204.             }
  205.  
  206.     }
  207. }
  208.  
  209.  
  210. //-------------------------------------------------------------------
  211. // Gem team scores using skull
  212. // Called from: usepuzzleitem
  213. // Calls      : script 20
  214. //
  215. //  It looks like we will need 5 statues. Oh, well. How about
  216. //  showing the item as used? Then the statue disappears!
  217. //  Statue IDs 20,21,22,23,24
  218. //-------------------------------------------------------------------
  219.  
  220. Script 2 (int stid)
  221. {
  222.     Thing_Activate(stid);
  223.     Thing_Remove(stid);
  224.     gemscore += 1;
  225.     bossrel = 1;
  226.     dscore = 1;
  227.     ACS_Execute(5,1,0,0,0);
  228.  
  229.     if ((gemscore >= 5) && (gswin == 0))
  230.         {
  231.         gswin = 1;
  232.         }
  233. }
  234.  
  235. //-------------------------------------------------------------------
  236. // Skull team scores using gem
  237. // Called from: usepuzzleitem (linedef)
  238. // Calls      : script 20
  239. // See note in script 2.
  240. //
  241. // Gem Pedestal IDs: 25,26,27,28,29
  242. //-------------------------------------------------------------------
  243. Script 3 (int gmid)
  244. {
  245.     Thing_Activate(gmid);
  246.     Thing_Remove(gmid);
  247.     skullscore += 1;
  248.     bossrel = 1;
  249.     dscore = 2;
  250.     ACS_Execute(6,1,0,0,0);
  251.  
  252.     if ((skullscore >= 5) && (gswin == 0))
  253.        {
  254.        gswin = 2;
  255.        }
  256. }
  257. //-------------------------------------------------------------------
  258. // Respawn skull. Player died, or skull was used.
  259. // Called from: script 1
  260. // Calls      : none
  261. //-------------------------------------------------------------------
  262. Script 5 (void)
  263. {
  264.     skulluse = 1;
  265.     // Only spawn if there are no skulls.
  266.     if (ThingCount(T_PUZZSKULL,0) == 0)
  267.         {
  268.         Thing_SpawnNoFog(skulloc,T_PUZZSKULL,0);
  269.         }
  270. }
  271.  
  272. //-------------------------------------------------------------------
  273. // Respawn big gem. Player died, or gem was used.
  274. // Called from: script 1
  275. // Calls      : none
  276. //-------------------------------------------------------------------
  277. Script 6 (void)
  278. {
  279.     gemuse = 1;
  280.     // Only spawn if there are no gems.
  281.     IF (ThingCount(T_PUZZGEMBIG,0) == 0)
  282.         {
  283.         Thing_SpawnNoFog(gemloc,T_PUZZGEMBIG,0);
  284.         }
  285. }
  286.  
  287. //-------------------------------------------------------------------
  288. // Pick up Big Gem
  289. // Called from: thing special (when gem is picked up)
  290. // Calls      : none
  291. //-------------------------------------------------------------------
  292. Script 8 (void)
  293. {
  294.     gemtime = timer();
  295.     gemuse = 2;
  296.     Thing_Remove(gemid);
  297. }
  298.  
  299. //-------------------------------------------------------------------
  300. // Pick up Skull
  301. // Called from: thing special (when skull is picked up)
  302. // Calls      : none
  303. //-------------------------------------------------------------------
  304. Script 9 (void)
  305. {
  306.     skulltime = timer();
  307.     skulluse = 2;
  308.     Thing_Remove(skullid);
  309. }
  310.  
  311. //-------------------------------------------------------------------
  312. // Release the dogs! Will open the door and wake up the boss.
  313. // Called from: 1
  314. // Calls      : none
  315. //-------------------------------------------------------------------
  316.  
  317. Script 11 (void)
  318. {
  319.     if (monstdoor <= 3) // If you want more bosses, YOU put them in!
  320.         {
  321.         // Even with thing_activate, I think the boss needs a sound to
  322.         // actually start running around.
  323.         Thing_Activate(6+monstdoor); // 6 is the base TID for boss monsters.
  324.         Door_Open(monstdoor,200);
  325.         monstdoor += 1;
  326.         }
  327. }
  328.  
  329. //-------------------------------------------------------------------
  330. // Random item/monster generator.
  331. // Will randomly generate things. Biased of course, towards monsters.
  332. // Can only do this once every 2 minutes.
  333. //
  334. // Called from: Line special (switch)
  335. // Calls      : none
  336. //-------------------------------------------------------------------
  337. Script 15 (void)
  338. {
  339.     int gentype, whichone;
  340.  
  341.     if (timer() >= gentime )
  342.         {
  343.         gentime = Timer() + 4200; // 2 minutes.
  344.         // Monster or thing? 1-13 is monster.
  345.         if (Random(1,20) <= 13)
  346.             {
  347.             // Big, mean, nasty, or just another monster.
  348.             if (Random(1,20) <= 15)
  349.                 {
  350.                 // Normal.
  351.                 whichone = Random(1,6);
  352.                 Switch(whichone)
  353.                     {
  354.                     case 1:
  355.                         gentype = T_CENTAUR;
  356.                         break;
  357.                     case 2:
  358.                         gentype = T_DEMON;
  359.                         break;
  360.                     case 3:
  361.                         gentype = T_ETTIN;
  362.                         break;
  363.                     case 4:
  364.                         gentype = T_FIREGARGOYLE;
  365.                         break;
  366.                     case 5:
  367.                         gentype = T_BISHOP;
  368.                         break;
  369.                     case 6:
  370.                         gentype = T_ICEGOLEM;
  371.                     }
  372.  
  373.                 }
  374.             else // Nasty monster.
  375.                 {
  376.                 whichone = Random(1,2);
  377.                 Switch (whichone)
  378.                     {
  379.                     case 1:
  380.                         gentype = T_CENTAURLEADER;
  381.                         break;
  382.                     case 2:
  383.                         gentype = T_WRAITH;
  384.                     }
  385.                 }
  386.             }
  387.         else // Their luck held. Spawn item.
  388.             {
  389.             whichone = Random(1,20);
  390.             Switch (whichone)
  391.                 {
  392.                 case 1:
  393.                     gentype = T_MANA1;
  394.                     break;
  395.                 case 2:
  396.                     gentype = T_MANA2;
  397.                     break;
  398.                 case 3:
  399.                     gentype = T_ITEMBOOTS;
  400.                     break;
  401.                 case 4:
  402.                     gentype = T_ITEMEGG;
  403.                     break;
  404.                 case 5:
  405.                     gentype = T_ITEMFLIGHT;
  406.                     break;
  407.                 case 6:
  408.                     gentype = T_ITEMSUMMON;
  409.                     break;
  410.                 case 7:
  411.                     gentype = T_ITEMTPORTOTHER;
  412.                     break;
  413.                 case 8:
  414.                     gentype = T_ITEMTELEPORT;
  415.                     break;
  416.                 case 9:
  417.                     gentype = T_DRAGONSKINBRACERS;
  418.                     break;
  419.                 case 10:
  420.                     gentype = T_ITEMHEALTHPOTION;
  421.                     break;
  422.                 case 11:
  423.                     gentype = T_ITEMHEALTHFLASK;
  424.                     break;
  425.                 case 12:
  426.                     gentype = T_ITEMHEALTHFULL;
  427.                     break;
  428.                 case 13:
  429.                     gentype = T_ITEMBOOSTMANA;
  430.                     break;
  431.                 case 14:
  432.                     gentype = T_MESHARMOR;
  433.                     break;
  434.                 case 15:
  435.                     gentype = T_FALCONSHIELD;
  436.                     break;
  437.                 case 16:
  438.                     gentype = T_PLATINUMHELM;
  439.                     break;
  440.                 case 15:
  441.                     gentype = T_AMULETOFWARDING;
  442.                     break;
  443.                 case 17:
  444.                     gentype = T_ITEMFLECHETTE;
  445.                     break;
  446.                 case 18:
  447.                     gentype = T_ITEMTORCH;
  448.                     break;
  449.                 case 19:
  450.                     gentype = T_ITEMREPULSION;
  451.                     break;
  452.                 case 20:
  453.                     gentype = T_MANA3;
  454.                 }
  455.             }
  456.         Thing_Spawn(genloc,gentype,0);
  457.         }
  458.         else
  459.             {
  460.             timeann = (gentime - Timer())/35; // Should give seconds.
  461.             Print(s:"YOU NEED TO WAIT ",d:timeann,s:" SECONDS");
  462.             }
  463. }
  464.  
  465.