SHARE
TWEET

zombie_temple_sq_bttp

a guest Dec 14th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* zombie_temple_sq_bttp.gsc
  2.  *
  3.  * Purpose :    Sidequest declaration and side-quest logic for zombie_temple stage 7.
  4.  *                      Back to the past.
  5.  *     
  6.  *
  7.  * Author :     Dan L
  8.  *
  9.  */
  10.  
  11.  
  12.  
  13. #include maps\_utility;
  14. #include common_scripts\utility;
  15. #include maps\_zombiemode_utility;
  16. #include maps\_zombiemode_sidequests;
  17.  
  18. init()
  19. {
  20.  
  21.     declare_sidequest_stage("sq", "bttp", ::init_stage, ::stage_logic, ::exit_stage);
  22.     set_stage_time_limit("sq", "bttp", 5 * 60); // 5 minute limit.
  23. //  declare_stage_title("sq", "bttp", &"ZOMBIE_TEMPLE_SIDEQUEST_STAGE_6_TITLE");
  24.     declare_stage_asset_from_struct("sq", "bttp", "sq_bttp_glyph", undefined, ::bttp_damage_thread);
  25.    
  26.     PreCacheModel("p_ztem_glyphs_01_unfinished");
  27.     PreCacheModel("p_ztem_glyphs_02_unfinished");
  28.     PreCacheModel("p_ztem_glyphs_03_unfinished");
  29.     PreCacheModel("p_ztem_glyphs_04_unfinished");
  30.     PreCacheModel("p_ztem_glyphs_05_unfinished");
  31.     PreCacheModel("p_ztem_glyphs_06_unfinished");
  32.     PreCacheModel("p_ztem_glyphs_07_unfinished");
  33.     PreCacheModel("p_ztem_glyphs_08_unfinished");
  34.     PreCacheModel("p_ztem_glyphs_09_unfinished");
  35.     PreCacheModel("p_ztem_glyphs_10_unfinished");
  36.     PreCacheModel("p_ztem_glyphs_11_unfinished");
  37.     PreCacheModel("p_ztem_glyphs_12_unfinished");
  38. }
  39.  
  40. init_stage()
  41. {
  42.     if(IsDefined(level._sq_skel))
  43.     {
  44.         level._sq_skel Hide();
  45.     }
  46.     level._num_done = 0;
  47.  
  48.     maps\zombie_temple_sq_brock::delete_radio();       
  49.    
  50.     trap = GetEnt("sq_spiketrap", "targetname");
  51.     trap thread trap_thread();
  52.    
  53.     level thread delayed_start_skit();
  54. }
  55.  
  56. delayed_start_skit()
  57. {
  58.     wait(.5);
  59.     level thread maps\zombie_temple_sq_skits::start_skit("tt6");
  60. }
  61.  
  62. trap_trigger()
  63. {
  64.     level endon("sq_bttp_over");
  65.    
  66.     while(1)
  67.     {
  68.         self waittill( "damage", amount, attacker, direction, point, dmg_type, modelName, tagName );
  69.         if( isplayer( attacker ) && (   dmg_type == "MOD_EXPLOSIVE" || dmg_type == "MOD_EXPLOSIVE_SPLASH"
  70.                                                                 ||  dmg_type == "MOD_GRENADE" || dmg_type == "MOD_GRENADE_SPLASH" ) )
  71.         {
  72.             self.owner_ent notify("triggered", attacker);
  73.             return;
  74.         }
  75.     }
  76. }
  77.  
  78. trap_thread()
  79. {
  80.     level endon("sq_bttp_over");
  81.    
  82.     self.trigger = Spawn( "trigger_damage", self.origin, 0, 32, 72 );
  83.     self.trigger.height = 72;
  84.     self.trigger.radius = 32;
  85.    
  86.     self.trigger.owner_ent = self;
  87.     self.trigger thread trap_trigger();
  88.    
  89.     self waittill("triggered", who);
  90.    
  91.     who thread maps\_zombiemode_audio::create_and_play_dialog( "eggs", "quest1", undefined, 7 );
  92.     self.trigger playsound( "evt_sq_bttp_wood_explo" );
  93.    
  94.     self Hide();
  95.    
  96.     flag_set("trap_destroyed");
  97.  
  98.    
  99. }
  100.  
  101. bttp_debug()
  102. {
  103.     self endon("death");
  104.     self endon("done");
  105.     level endon("sq_bttp_over");
  106.    
  107.     while(1)
  108.     {
  109.         Print3d(self.origin, "+", (0,255,0), 1);
  110.         wait(0.1);
  111.     }
  112. }
  113.  
  114. bttp_damage_thread()
  115. {
  116.     self endon("death");
  117.    
  118.     hits = 0;
  119.    
  120.     //self thread glyph_debug();
  121.    
  122.     self.owner_ent thread bttp_debug();
  123.    
  124.     while(1)
  125.     {
  126.         self waittill("damage", amount, attacker, dir, point, type);
  127.        
  128.         self playsound( "evt_sq_bttp_carve" );
  129.        
  130.         if(type == "MOD_MELEE")
  131.         {
  132.             hits ++;
  133.            
  134.             if(hits >= 1)
  135.             {
  136.                 break;
  137.             }
  138.         }
  139.     }
  140.    
  141.     self.owner_ent SetModel(self.owner_ent.tile);
  142.     self.owner_ent notify("done");
  143.    
  144.     level._num_done ++;
  145.    
  146.     if( isdefined( attacker ) && isPlayer( attacker ) )
  147.     {
  148.         if( level._num_done < level._bttp_num_goal )
  149.         {
  150.             if( randomintrange(0,101) <= 75 )
  151.             {
  152.                 attacker thread maps\_zombiemode_audio::create_and_play_dialog( "eggs", "quest6", undefined, randomintrange(0,4) );
  153.             }
  154.         }
  155.         else
  156.         {
  157.             attacker thread maps\_zombiemode_audio::create_and_play_dialog( "eggs", "quest6", undefined, 4 );
  158.         }
  159.     }
  160. }
  161.  
  162. get_unfinished_tile_model(tile)
  163. {
  164.     retVal = "p_ztem_glyphs_01_unfinished";
  165.    
  166.     switch(tile)
  167.     {
  168.         case "p_ztem_glyphs_01_unlit":
  169.             retVal = "p_ztem_glyphs_01_unfinished";
  170.             break;
  171.         case "p_ztem_glyphs_02_unlit":
  172.             retVal = "p_ztem_glyphs_02_unfinished";
  173.             break;
  174.         case "p_ztem_glyphs_03_unlit":
  175.             retVal = "p_ztem_glyphs_03_unfinished";    
  176.             break;
  177.         case "p_ztem_glyphs_04_unlit":
  178.             retVal = "p_ztem_glyphs_04_unfinished";    
  179.             break;
  180.         case "p_ztem_glyphs_05_unlit":
  181.             retVal = "p_ztem_glyphs_05_unfinished";    
  182.             break;
  183.         case "p_ztem_glyphs_06_unlit":
  184.             retVal = "p_ztem_glyphs_06_unfinished";    
  185.             break;
  186.         case "p_ztem_glyphs_07_unlit":
  187.             retVal = "p_ztem_glyphs_07_unfinished";    
  188.             break;
  189.         case "p_ztem_glyphs_08_unlit":
  190.             retVal = "p_ztem_glyphs_08_unfinished";    
  191.             break;
  192.         case "p_ztem_glyphs_09_unlit":
  193.             retVal = "p_ztem_glyphs_09_unfinished";    
  194.             break;
  195.         case "p_ztem_glyphs_10_unlit":
  196.             retVal = "p_ztem_glyphs_10_unfinished";    
  197.             break;
  198.         case "p_ztem_glyphs_11_unlit":
  199.             retVal = "p_ztem_glyphs_11_unfinished";    
  200.             break;
  201.         case "p_ztem_glyphs_12_unlit":
  202.             retVal = "p_ztem_glyphs_12_unfinished";    
  203.             break;
  204.     }
  205.    
  206.     return retVal;
  207. }
  208.  
  209. stage_logic()
  210. {
  211.    
  212.     level endon("sq_bttp_over");
  213.    
  214.     tile_models = array(    "p_ztem_glyphs_01_unlit", "p_ztem_glyphs_02_unlit", "p_ztem_glyphs_03_unlit", "p_ztem_glyphs_04_unlit",
  215.                                                 "p_ztem_glyphs_05_unlit", "p_ztem_glyphs_06_unlit", "p_ztem_glyphs_07_unlit", "p_ztem_glyphs_08_unlit",
  216.                                                 "p_ztem_glyphs_09_unlit", "p_ztem_glyphs_10_unlit", "p_ztem_glyphs_11_unlit", "p_ztem_glyphs_12_unlit" );
  217.    
  218.     tile_models = array_randomize(tile_models);
  219.  
  220.     ents = GetEntArray("sq_bttp_glyph", "targetname");
  221.     level._bttp_num_goal = ents.size;
  222.  
  223.     for(i = 0; i < ents.size; i ++)
  224.     {
  225.         ents[i].tile = tile_models[i];
  226.         ents[i] SetModel(get_unfinished_tile_model(tile_models[i]));
  227.        
  228.     }
  229.    
  230.     while(1)
  231.     {
  232.         if(level._num_done == ents.size)
  233.         {
  234.             break;
  235.         }
  236.         wait(0.1);
  237.     }
  238.    
  239.     flag_wait("trap_destroyed");
  240.     level notify( "suspend_timer" );
  241.    
  242.     wait(5);
  243.    
  244.     stage_completed("sq", "bttp");
  245. }
  246.  
  247. exit_stage(success)
  248. {
  249.  
  250.     trap = GetEnt("sq_spiketrap", "targetname");
  251.  
  252.     if(success)
  253.     {
  254.         maps\zombie_temple_sq::remove_skel();
  255.         maps\zombie_temple_sq_brock::create_radio(7, maps\zombie_temple_sq_brock::radio7_override);
  256.     }
  257.     else
  258.     {
  259.         if(IsDefined(level._sq_skel))
  260.         {
  261.             level._sq_skel Show();
  262.         }
  263.         maps\zombie_temple_sq_brock::create_radio(6);
  264.  
  265.         trap Show();   
  266.         level thread maps\zombie_temple_sq_skits::fail_skit(); 
  267.     }
  268.    
  269.    
  270.     if(IsDefined(trap.trigger))
  271.     {
  272.         trap.trigger Delete();
  273.     }      
  274. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top