Guest User

_motd_wolves_draft.gsc

a guest
Aug 9th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.33 KB | None | 0 0
  1. // SCRIPT IS ORIGINALLY BY BLUNTSTUFFY ON UGX-MODS
  2. #include maps\_utility;
  3. #include common_scripts\utility;
  4. #include maps\_zombiemode_utility;
  5. #include maps\_anim;
  6. #using_animtree( "blst_soul_chest" );
  7.  
  8. PreCache_soul_chest()
  9. {
  10.     level._effect["blst_chest_soul"] = loadfx("blst_custom/blst_fx_chest_soul");
  11.     level._effect["blst_chest_idle"] = loadfx("blst_custom/blst_fx_chest_idle");
  12.  
  13.     precachemodel( "blst_soul_chest_active" );
  14.     precachemodel( "blst_soul_chest" );
  15. }
  16.  
  17. main()
  18. {
  19.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_open" ] = %blst_soul_chest_open;
  20.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_close_notfull" ] = %blst_soul_chest_close_notfull;
  21.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_close_full" ] = %blst_soul_chest_close_full;
  22.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle01" ] = %blst_soul_chest_idle01;
  23.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle02" ] = %blst_soul_chest_idle02;
  24.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle03" ] = %blst_soul_chest_idle03;
  25.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle04" ] = %blst_soul_chest_idle04;
  26.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle05" ] = %blst_soul_chest_idle05;
  27.     level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle06" ] = %blst_soul_chest_idle06;
  28.  
  29.     reward_trigger = getentarray( "soul_chest_reward" , "targetname" );
  30.     for(i=0;i<reward_trigger.size;i++)
  31.     {
  32.     reward_trigger[i] disable_trigger();
  33.     }
  34.  
  35.    
  36.     soul_chest_area = getentarray( "soul_chest_area" , "targetname") ;
  37.     for(i=0;i<soul_chest_area.size;i++)
  38.     {
  39.     soul_chest_area[i] thread spawn_initial_model();
  40.     }
  41.    
  42.  level.chest_amount = soul_chest_area.size;
  43.  level.chest_active = true;
  44.  level.chest_completed = 0;
  45.  level.chest_counting = 0;
  46. }
  47.  
  48. spawn_initial_model()
  49. {
  50.     self.idle_anim = undefined;
  51.     chest_idle = Spawn( "script_model" , self.origin-(0,0,16) );
  52.     chest_idle.angles = self.angles;
  53.     chest_idle SetModel( "blst_soul_chest" );
  54.     wait 5;
  55.     self.death_count = 0;
  56.     self waittill( "chest_activated" );
  57.     chest_idle delete();
  58. }
  59.  
  60.  
  61.  
  62.  
  63. chest_anims()
  64. {
  65. /////////////////////////////////////////////////////  EDIT AMOUNT OF KILLS NEEDED HERE /////////////////////////////////////////////////////////////////////////////
  66.     chest_1_kills = 2;
  67.     chest_2_kills = 2;
  68.     chest_3_kills = 2;
  69.     chest_4_kills = 2;
  70.     chest_5_kills = 5;
  71.     chest_6_kills = 140;
  72. /////////////////////////////////////////////////////  EDIT AMOUNT OF KILLS NEEDED HERE /////////////////////////////////////////////////////////////////////////////
  73.  
  74.     chest_clip = getentarray( "soul_chest_clip" , "targetname" );
  75.     self.max_count = undefined;
  76.    
  77. if( level.chest_completed == 0 )
  78. {  
  79.     if( level.chest_counting == 1   )              
  80.     {
  81.     self.max_count = chest_1_kills;
  82.     }
  83.    
  84.     else if( level.chest_counting == 2 )
  85.     {
  86.     self.max_count = chest_2_kills;
  87.     }
  88.  
  89.     else if( level.chest_counting == 3 )
  90.     {
  91.     self.max_count = chest_3_kills;
  92.     }
  93.    
  94.     else if( level.chest_counting == 4 )
  95.     {
  96.     self.max_count = chest_4_kills;
  97.     }
  98.  
  99.     else if( level.chest_counting == 5 )
  100.     {
  101.     self.max_count = chest_5_kills;
  102.     }
  103.  
  104.     else if( level.chest_counting == 6 )
  105.     {
  106.     self.max_count = chest_6_kills;
  107.     }
  108.  
  109. }
  110.  
  111. else if( level.chest_completed >= 1 )
  112. {
  113.     if( level.chest_counting + level.chest_completed == 2   )              
  114.     {
  115.     self.max_count = chest_2_kills;
  116.     }
  117.  
  118.     if( level.chest_counting + level.chest_completed == 3   )              
  119.     {
  120.     self.max_count = chest_3_kills;
  121.     }
  122.  
  123.     if( level.chest_counting + level.chest_completed == 4   )              
  124.     {
  125.     self.max_count = chest_4_kills;
  126.     }
  127.    
  128.     if( level.chest_counting + level.chest_completed == 5   )              
  129.     {
  130.     self.max_count = chest_5_kills;
  131.     }
  132.  
  133.     if( level.chest_counting + level.chest_completed == 6   )              
  134.     {
  135.     self.max_count = chest_6_kills;
  136.     }
  137.  
  138. }
  139.  
  140.     chest = Spawn( "script_model" , self.origin-(0,0,16) );
  141.     chest.angles = self.angles;
  142.     chest SetModel( "blst_soul_chest_active" );
  143.     chest.animName = "blst_chest_anim";
  144.     chest UseAnimTree(#animtree);
  145.     chest SetAnim(%blst_soul_chest_open);
  146.     chest playsound( "chest_close_lid" );
  147.     wait 0.2;
  148.     chest playsound( "chest_open");
  149.     self chest_idle_fx( chest );
  150.     wait 2;
  151.     self thread soul_chest_idle_anims( chest );
  152.     self waittill( "chest_full" );
  153.    
  154.     if( self.max_count == self.death_count || self.death_count >= 9000 )
  155.     {
  156.     level.chest_counting--;
  157.     chest playsound( "chest_full") ;
  158.     wait 0.3;
  159.     chest playsound( "chest_full") ;
  160.     wait 1;
  161.     chest playsound( "chest_full2") ;
  162.     chest playsound( "chest_close_lid" );
  163.     for(i=0;i<chest_clip.size;i++)
  164.     {
  165.     if(  chest IsTouching( chest_clip[i] ) == true )
  166.     {
  167.    
  168.     chest_clip[i] delete();
  169.     }
  170.     }
  171.     chest clearAnim( self.idle_anim ,0);   
  172.     chest SetAnim(%blst_soul_chest_close_full);
  173.     wait 1;
  174.     chest playsound( "chest_full2" );
  175.     wait 2.1;
  176.     chest delete();
  177.     self delete();
  178.     }
  179.    
  180.     else if( self.max_count < self.death_count )
  181.     {
  182.     iprintlnbold( "death count exceeded due to timeout" );
  183.     }
  184.    
  185.     else if( self.max_count > self.death_count )
  186.     {
  187.     level.chest_counting--;
  188.     self.death_count = -10;    
  189.     chest playsound( "chest_close_lid" );
  190.     chest clearAnim( self.idle_anim ,0);   
  191.     chest SetAnim(%blst_soul_chest_close_notfull);
  192.     wait 0.7;
  193.     chest delete();
  194.     self thread spawn_initial_model();
  195.     }
  196.  
  197. }
  198.  
  199.  
  200. chest_death_count( last_origin, area_radius )
  201. {
  202.     self notify( "chest_kill" );
  203.    
  204.     self_origin = self.origin;
  205.     self.death_count++;
  206.  
  207.     if( self.death_count == -9 || self.death_count >= 9000)
  208.     {
  209.     self.death_count--;
  210.     }
  211.    
  212.     else if( self.death_count == 1)
  213.     {
  214.     level.chest_counting++;
  215.     self notify( "chest_activated" );
  216.     self thread chest_anims();
  217.     thread chest_death_fx( last_origin, self_origin, area_radius );
  218.     self thread time_out();
  219.     }
  220.  
  221.     else if( self.death_count >= 2 && self.death_count <= self.max_count-1 )
  222.     {
  223.     thread chest_death_fx( last_origin, self_origin, area_radius );
  224.     self thread time_out();
  225.     }
  226.  
  227.     else if( self.death_count == self.max_count )
  228.     {
  229.     self.death_count = 9000;
  230.     thread chest_death_fx( last_origin, self_origin, area_radius );
  231.     level.chest_completed++;
  232.     thread progres_check();
  233.     self notify( "time_out" );
  234.     wait 2;
  235.     self notify( "chest_full" );
  236.     }
  237.  
  238. }
  239.  
  240. time_out()
  241. {
  242. self endon( "chest_kill" );
  243. self endon( "chest_full" );
  244. self endon( "disconnect" );
  245. self.timer = 50;                                                        //////////////////////////////// EDIT TIME-OUT TIMER HERE ////////////////////////////////////////////////
  246.  
  247. while(1)
  248. {
  249.     if( self.timer <= 50 && self.timer >= 6 )               ////////////////////////////////                AND HERE                //////////////////////////////////////////////////
  250.     {
  251.     self.timer-= 5;
  252.     wait 5;
  253.     }
  254.    
  255.     else if( self.timer <= 5 )
  256.     {  
  257.     self.timer-= 0.2;
  258.     wait 0.2;
  259.    
  260.    
  261.     if( self.timer <= 0 )
  262.     {
  263.     self notify( "time_out" );
  264.     wait 2;
  265.     self notify( "chest_full" );
  266.     }
  267.    
  268.     }
  269. }
  270. }
  271.  
  272. soul_chest_idle_anims( chest )
  273. {
  274. self endon( "time_out" );
  275.  
  276. wait 0.5;
  277. last_anim = %blst_soul_chest_open;
  278.  
  279. while(1)
  280. {
  281.     rand = randomintrange( 1, 7 );
  282.     if( rand == 1)
  283.     {
  284.     self.idle_anim = %blst_soul_chest_idle01;
  285.     }
  286.    
  287.     else if( rand == 2 )
  288.     {
  289.     self.idle_anim = %blst_soul_chest_idle02;
  290.     }
  291.    
  292.     else if( rand == 3 )
  293.     {
  294.     self.idle_anim = %blst_soul_chest_idle03;
  295.     }
  296.    
  297.     else if( rand == 4 )
  298.     {
  299.     self.idle_anim = %blst_soul_chest_idle04;
  300.     }
  301.    
  302.     else if( rand == 5 )
  303.     {
  304.     self.idle_anim = %blst_soul_chest_idle05;
  305.     }
  306.    
  307.     else if( rand == 6 )
  308.     {
  309.     self.idle_anim = %blst_soul_chest_idle06;
  310.     }
  311.    
  312.     if( last_anim == self.idle_anim )
  313.     {
  314.     chest SetAnimRestart(self.idle_anim);
  315.     wait 1.6;
  316.     }
  317.    
  318.     else if( last_anim != self.idle_anim )
  319.     {
  320.     chest clearAnim( last_anim ,0);
  321.     chest SetAnim( self.idle_anim );
  322.     last_anim = self.idle_anim ;
  323.     wait 1.6;
  324.     }
  325.    
  326.     }
  327.    
  328. }
  329.  
  330. chest_idle_fx( chest )
  331. {
  332.         PlayFxOnTag( level._effect["blst_chest_idle"], chest, "tag_fx_01" );
  333.         PlayFxOnTag( level._effect["blst_chest_soul"], chest, "tag_fx_02" );
  334.         PlayFxOnTag( level._effect["blst_chest_soul"], chest, "tag_fx_03" );
  335.         chest playloopsound( "chest_idle_static" );
  336. }
  337.  
  338.  
  339. chest_death_fx( last_origin, self_origin, area_radius )    
  340. {                                                                  
  341.     soul = Spawn( "script_model", last_origin+( 0,0,50) ); 
  342.     soul setmodel( "tag_origin" );
  343.     dist = DistanceSquared( last_origin, self_origin );
  344.     radius = area_radius * area_radius;
  345.     time = undefined;
  346.     if( dist >= radius* 0.66 )
  347.     {
  348.     time = 1.3;
  349.     }
  350.     else if(  dist <= radius* 0.65 && dist >= radius* 0.33 )
  351.     {
  352.     time = 1;
  353.     }
  354.     else if( dist <= radius* 0.32 )
  355.     {
  356.     time = 0.5;
  357.     }
  358.    
  359.     PlayFxOnTag( level._effect["blst_chest_soul"], soul, "tag_origin" );
  360.     soul moveto( self_origin+( 0,0,30) , time, 0.5, 0);
  361.     wait time;
  362.     soul movez( 200, 0.4);
  363.     soul playsound( "soul_fly" );
  364.     wait 0.4;
  365.     soul delete();
  366. }
  367.  
  368.  
  369.  
  370. progres_check()
  371. {
  372.     if (level.chest_completed == level.chest_amount)
  373.     {
  374.     self thread door2();    
  375.     level.chest_active = false;
  376.     }
  377.     else if(    level.chest_completed == (level.chest_amount-1) )
  378.     {
  379.     thread soul_chest_reward();         //////// THIS IS WHERE THE REWARD IS GIVEN WHEN ALL CHESTS ARE COMPLETED
  380.     level thread maps\_zombiemode_powerups::special_powerup_drop( self.origin );
  381.     // level.chest_active = false;              //// leave this line in here, it deactivates the thread in _zombiemode_spawner
  382.     self thread door();
  383.     }
  384.    
  385. }
  386.  
  387. door()
  388. {
  389.         door = getEnt("soulchestdoor", "targetname");  //this will be the door that opens
  390.        // door MoveZ (-200, 2);
  391.         //door MoveY (100, 5);
  392.         //door MoveX (100, 5);
  393.     door delete();
  394.     door connectpaths();
  395.         iprintln("A Secret Door Has Opened!");     //remove this line if you don't want it to say that
  396.  
  397.        
  398.         wait 1;
  399. }
  400. door2()
  401. {
  402.         door2 = getEnt("door_be", "targetname");  //this will be the door that opens
  403.        // door MoveZ (-200, 2);
  404.         // door MoveY (100, 5);
  405.         // door MoveX (100, 5);
  406.     door2 delete();
  407.     door2 connectpaths();
  408.         iprintln("Win");     //remove this line if you don't want it to say that
  409.         wait 1;
  410. }
  411.  
  412. soul_chest_reward()
  413. {
  414.     self endon( "took_gun" );
  415.     self endon( "disconnect" );
  416.  
  417.     reward_trigger = getentarray( "soul_chest_reward" , "targetname" );
  418.     players = get_players();
  419.     for(i=0;i<players.size;i++)
  420.     {
  421.     players[i].free_tom_katana = false;
  422.     reward_trigger[i] enable_trigger();
  423.     reward_trigger[i] thread reward_trigger( );
  424.     }
  425. }
  426.  
  427. tom_katana_rotate( tom_katana )
  428. {
  429.     self endon( "took_gun" );
  430.     self endon( "disconnect" );
  431.     while(1)
  432.     {
  433.     tom_katana rotateyaw( 360 ,1.5 );
  434.     wait 1.5;
  435.     }
  436. }
  437.  
  438. reward_trigger( )
  439. {
  440.     player = undefined;
  441.  
  442.     tom_katana = Spawn( "script_model", self.origin );
  443.     tom_katana.angles = (-30,0,-30);
  444.     tom_katana setmodel( "tom_katana_model_world" );
  445.     self thread tom_katana_rotate( tom_katana );
  446.  
  447.     playfxontag (level._effect["powerup_on"], tom_katana, "tag_origin");
  448.  
  449.     self setCursorHint("HINT_NOICON");
  450.     self UseTriggerRequireLookAt();
  451.     self setHintString( "Press and hold &&1 to take your free Ray-Gun." );
  452.    
  453.     while(1)
  454.     {
  455.     self waittill( "trigger", player );
  456.     player.has_gun = false;
  457.     player.has_gun_upgr = false;
  458.  
  459.     if( player.free_tom_katana == false)
  460.     {
  461.     player.free_tom_katana = true;
  462.     old_gun = player getcurrentweapon();
  463.  
  464.         weaplist = player GetWeaponsListPrimaries();
  465.         for(i=0;i<weaplist.size;i++)
  466.         {
  467.         if( weaplist[i] == "tom_katana" )
  468.         {
  469.         player.has_gun = true;
  470.         }
  471.         else if ( weaplist[i] == "tom_katana_upgraded" )
  472.         {
  473.         player.has_gun_upgr = true;
  474.         }
  475.         }
  476.  
  477.         if( player.has_gun == true )
  478.         {
  479.         player switchtoweapon( "tom_katana" );
  480.         player givemaxammo( "tom_katana" );
  481.         player playsound( "ammo_pickup" );
  482.         self notify( "took_gun" );
  483.         tom_katana delete();
  484.         self delete();
  485.         break;
  486.         }
  487.  
  488.         else if( player.has_gun_upgr == true )
  489.         {
  490.         player switchtoweapon( "tom_katana_upgraded" );
  491.         player givemaxammo( "tom_katana_upgraded" );
  492.         player playsound( "ammo_pickup" );
  493.         self notify( "took_gun" );
  494.         tom_katana delete();
  495.         self delete();
  496.         break;
  497.         }
  498.  
  499.         else if( weaplist.size <= 1 )
  500.         {
  501.         player giveweapon( "tom_katana" );
  502.         player switchtoweapon( "tom_katana" );
  503.         player playsound( "weap_pickup_plr" );
  504.         self notify( "took_gun" );
  505.         tom_katana delete();
  506.         self delete();
  507.         break;
  508.         }
  509.  
  510.         else if( weaplist.size >= 2 )
  511.         {
  512.         player takeweapon( old_gun );
  513.         player giveweapon( "tom_katana" );
  514.         player switchtoweapon( "tom_katana" );
  515.         player playsound( "weap_pickup_plr" );
  516.         self notify( "took_gun" );
  517.         tom_katana delete();
  518.         self delete();
  519.         break;
  520.         }
  521.     }
  522.    
  523.     else if( player.free_tom_katana == true )
  524.     {
  525.     iprintlnbold( "This one is not for you..!" );
  526.     }
  527.     wait 0.1;
  528. }
  529. }
Add Comment
Please, Sign In to add comment