Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SCRIPT IS ORIGINALLY BY BLUNTSTUFFY ON UGX-MODS
- #include maps\_utility;
- #include common_scripts\utility;
- #include maps\_zombiemode_utility;
- #include maps\_anim;
- #using_animtree( "blst_soul_chest" );
- PreCache_soul_chest()
- {
- level._effect["blst_chest_soul"] = loadfx("blst_custom/blst_fx_chest_soul");
- level._effect["blst_chest_idle"] = loadfx("blst_custom/blst_fx_chest_idle");
- precachemodel( "blst_soul_chest_active" );
- precachemodel( "blst_soul_chest" );
- }
- main()
- {
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_open" ] = %blst_soul_chest_open;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_close_notfull" ] = %blst_soul_chest_close_notfull;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_close_full" ] = %blst_soul_chest_close_full;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle01" ] = %blst_soul_chest_idle01;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle02" ] = %blst_soul_chest_idle02;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle03" ] = %blst_soul_chest_idle03;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle04" ] = %blst_soul_chest_idle04;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle05" ] = %blst_soul_chest_idle05;
- level.scr_anim[ "blst_chest_anim" ][ "blst_soul_chest_idle06" ] = %blst_soul_chest_idle06;
- reward_trigger = getentarray( "soul_chest_reward" , "targetname" );
- for(i=0;i<reward_trigger.size;i++)
- {
- reward_trigger[i] disable_trigger();
- }
- soul_chest_area = getentarray( "soul_chest_area" , "targetname") ;
- for(i=0;i<soul_chest_area.size;i++)
- {
- soul_chest_area[i] thread spawn_initial_model();
- }
- level.chest_amount = soul_chest_area.size;
- level.chest_active = true;
- level.chest_completed = 0;
- level.chest_counting = 0;
- }
- spawn_initial_model()
- {
- self.idle_anim = undefined;
- chest_idle = Spawn( "script_model" , self.origin-(0,0,16) );
- chest_idle.angles = self.angles;
- chest_idle SetModel( "blst_soul_chest" );
- wait 5;
- self.death_count = 0;
- self waittill( "chest_activated" );
- chest_idle delete();
- }
- chest_anims()
- {
- ///////////////////////////////////////////////////// EDIT AMOUNT OF KILLS NEEDED HERE /////////////////////////////////////////////////////////////////////////////
- chest_1_kills = 2;
- chest_2_kills = 2;
- chest_3_kills = 2;
- chest_4_kills = 2;
- chest_5_kills = 5;
- chest_6_kills = 140;
- ///////////////////////////////////////////////////// EDIT AMOUNT OF KILLS NEEDED HERE /////////////////////////////////////////////////////////////////////////////
- chest_clip = getentarray( "soul_chest_clip" , "targetname" );
- self.max_count = undefined;
- if( level.chest_completed == 0 )
- {
- if( level.chest_counting == 1 )
- {
- self.max_count = chest_1_kills;
- }
- else if( level.chest_counting == 2 )
- {
- self.max_count = chest_2_kills;
- }
- else if( level.chest_counting == 3 )
- {
- self.max_count = chest_3_kills;
- }
- else if( level.chest_counting == 4 )
- {
- self.max_count = chest_4_kills;
- }
- else if( level.chest_counting == 5 )
- {
- self.max_count = chest_5_kills;
- }
- else if( level.chest_counting == 6 )
- {
- self.max_count = chest_6_kills;
- }
- }
- else if( level.chest_completed >= 1 )
- {
- if( level.chest_counting + level.chest_completed == 2 )
- {
- self.max_count = chest_2_kills;
- }
- if( level.chest_counting + level.chest_completed == 3 )
- {
- self.max_count = chest_3_kills;
- }
- if( level.chest_counting + level.chest_completed == 4 )
- {
- self.max_count = chest_4_kills;
- }
- if( level.chest_counting + level.chest_completed == 5 )
- {
- self.max_count = chest_5_kills;
- }
- if( level.chest_counting + level.chest_completed == 6 )
- {
- self.max_count = chest_6_kills;
- }
- }
- chest = Spawn( "script_model" , self.origin-(0,0,16) );
- chest.angles = self.angles;
- chest SetModel( "blst_soul_chest_active" );
- chest.animName = "blst_chest_anim";
- chest UseAnimTree(#animtree);
- chest SetAnim(%blst_soul_chest_open);
- chest playsound( "chest_close_lid" );
- wait 0.2;
- chest playsound( "chest_open");
- self chest_idle_fx( chest );
- wait 2;
- self thread soul_chest_idle_anims( chest );
- self waittill( "chest_full" );
- if( self.max_count == self.death_count || self.death_count >= 9000 )
- {
- level.chest_counting--;
- chest playsound( "chest_full") ;
- wait 0.3;
- chest playsound( "chest_full") ;
- wait 1;
- chest playsound( "chest_full2") ;
- chest playsound( "chest_close_lid" );
- for(i=0;i<chest_clip.size;i++)
- {
- if( chest IsTouching( chest_clip[i] ) == true )
- {
- chest_clip[i] delete();
- }
- }
- chest clearAnim( self.idle_anim ,0);
- chest SetAnim(%blst_soul_chest_close_full);
- wait 1;
- chest playsound( "chest_full2" );
- wait 2.1;
- chest delete();
- self delete();
- }
- else if( self.max_count < self.death_count )
- {
- iprintlnbold( "death count exceeded due to timeout" );
- }
- else if( self.max_count > self.death_count )
- {
- level.chest_counting--;
- self.death_count = -10;
- chest playsound( "chest_close_lid" );
- chest clearAnim( self.idle_anim ,0);
- chest SetAnim(%blst_soul_chest_close_notfull);
- wait 0.7;
- chest delete();
- self thread spawn_initial_model();
- }
- }
- chest_death_count( last_origin, area_radius )
- {
- self notify( "chest_kill" );
- self_origin = self.origin;
- self.death_count++;
- if( self.death_count == -9 || self.death_count >= 9000)
- {
- self.death_count--;
- }
- else if( self.death_count == 1)
- {
- level.chest_counting++;
- self notify( "chest_activated" );
- self thread chest_anims();
- thread chest_death_fx( last_origin, self_origin, area_radius );
- self thread time_out();
- }
- else if( self.death_count >= 2 && self.death_count <= self.max_count-1 )
- {
- thread chest_death_fx( last_origin, self_origin, area_radius );
- self thread time_out();
- }
- else if( self.death_count == self.max_count )
- {
- self.death_count = 9000;
- thread chest_death_fx( last_origin, self_origin, area_radius );
- level.chest_completed++;
- thread progres_check();
- self notify( "time_out" );
- wait 2;
- self notify( "chest_full" );
- }
- }
- time_out()
- {
- self endon( "chest_kill" );
- self endon( "chest_full" );
- self endon( "disconnect" );
- self.timer = 50; //////////////////////////////// EDIT TIME-OUT TIMER HERE ////////////////////////////////////////////////
- while(1)
- {
- if( self.timer <= 50 && self.timer >= 6 ) //////////////////////////////// AND HERE //////////////////////////////////////////////////
- {
- self.timer-= 5;
- wait 5;
- }
- else if( self.timer <= 5 )
- {
- self.timer-= 0.2;
- wait 0.2;
- if( self.timer <= 0 )
- {
- self notify( "time_out" );
- wait 2;
- self notify( "chest_full" );
- }
- }
- }
- }
- soul_chest_idle_anims( chest )
- {
- self endon( "time_out" );
- wait 0.5;
- last_anim = %blst_soul_chest_open;
- while(1)
- {
- rand = randomintrange( 1, 7 );
- if( rand == 1)
- {
- self.idle_anim = %blst_soul_chest_idle01;
- }
- else if( rand == 2 )
- {
- self.idle_anim = %blst_soul_chest_idle02;
- }
- else if( rand == 3 )
- {
- self.idle_anim = %blst_soul_chest_idle03;
- }
- else if( rand == 4 )
- {
- self.idle_anim = %blst_soul_chest_idle04;
- }
- else if( rand == 5 )
- {
- self.idle_anim = %blst_soul_chest_idle05;
- }
- else if( rand == 6 )
- {
- self.idle_anim = %blst_soul_chest_idle06;
- }
- if( last_anim == self.idle_anim )
- {
- chest SetAnimRestart(self.idle_anim);
- wait 1.6;
- }
- else if( last_anim != self.idle_anim )
- {
- chest clearAnim( last_anim ,0);
- chest SetAnim( self.idle_anim );
- last_anim = self.idle_anim ;
- wait 1.6;
- }
- }
- }
- chest_idle_fx( chest )
- {
- PlayFxOnTag( level._effect["blst_chest_idle"], chest, "tag_fx_01" );
- PlayFxOnTag( level._effect["blst_chest_soul"], chest, "tag_fx_02" );
- PlayFxOnTag( level._effect["blst_chest_soul"], chest, "tag_fx_03" );
- chest playloopsound( "chest_idle_static" );
- }
- chest_death_fx( last_origin, self_origin, area_radius )
- {
- soul = Spawn( "script_model", last_origin+( 0,0,50) );
- soul setmodel( "tag_origin" );
- dist = DistanceSquared( last_origin, self_origin );
- radius = area_radius * area_radius;
- time = undefined;
- if( dist >= radius* 0.66 )
- {
- time = 1.3;
- }
- else if( dist <= radius* 0.65 && dist >= radius* 0.33 )
- {
- time = 1;
- }
- else if( dist <= radius* 0.32 )
- {
- time = 0.5;
- }
- PlayFxOnTag( level._effect["blst_chest_soul"], soul, "tag_origin" );
- soul moveto( self_origin+( 0,0,30) , time, 0.5, 0);
- wait time;
- soul movez( 200, 0.4);
- soul playsound( "soul_fly" );
- wait 0.4;
- soul delete();
- }
- progres_check()
- {
- if (level.chest_completed == level.chest_amount)
- {
- self thread door2();
- level.chest_active = false;
- }
- else if( level.chest_completed == (level.chest_amount-1) )
- {
- thread soul_chest_reward(); //////// THIS IS WHERE THE REWARD IS GIVEN WHEN ALL CHESTS ARE COMPLETED
- level thread maps\_zombiemode_powerups::special_powerup_drop( self.origin );
- // level.chest_active = false; //// leave this line in here, it deactivates the thread in _zombiemode_spawner
- self thread door();
- }
- }
- door()
- {
- door = getEnt("soulchestdoor", "targetname"); //this will be the door that opens
- // door MoveZ (-200, 2);
- //door MoveY (100, 5);
- //door MoveX (100, 5);
- door delete();
- door connectpaths();
- iprintln("A Secret Door Has Opened!"); //remove this line if you don't want it to say that
- wait 1;
- }
- door2()
- {
- door2 = getEnt("door_be", "targetname"); //this will be the door that opens
- // door MoveZ (-200, 2);
- // door MoveY (100, 5);
- // door MoveX (100, 5);
- door2 delete();
- door2 connectpaths();
- iprintln("Win"); //remove this line if you don't want it to say that
- wait 1;
- }
- soul_chest_reward()
- {
- self endon( "took_gun" );
- self endon( "disconnect" );
- reward_trigger = getentarray( "soul_chest_reward" , "targetname" );
- players = get_players();
- for(i=0;i<players.size;i++)
- {
- players[i].free_tom_katana = false;
- reward_trigger[i] enable_trigger();
- reward_trigger[i] thread reward_trigger( );
- }
- }
- tom_katana_rotate( tom_katana )
- {
- self endon( "took_gun" );
- self endon( "disconnect" );
- while(1)
- {
- tom_katana rotateyaw( 360 ,1.5 );
- wait 1.5;
- }
- }
- reward_trigger( )
- {
- player = undefined;
- tom_katana = Spawn( "script_model", self.origin );
- tom_katana.angles = (-30,0,-30);
- tom_katana setmodel( "tom_katana_model_world" );
- self thread tom_katana_rotate( tom_katana );
- playfxontag (level._effect["powerup_on"], tom_katana, "tag_origin");
- self setCursorHint("HINT_NOICON");
- self UseTriggerRequireLookAt();
- self setHintString( "Press and hold &&1 to take your free Ray-Gun." );
- while(1)
- {
- self waittill( "trigger", player );
- player.has_gun = false;
- player.has_gun_upgr = false;
- if( player.free_tom_katana == false)
- {
- player.free_tom_katana = true;
- old_gun = player getcurrentweapon();
- weaplist = player GetWeaponsListPrimaries();
- for(i=0;i<weaplist.size;i++)
- {
- if( weaplist[i] == "tom_katana" )
- {
- player.has_gun = true;
- }
- else if ( weaplist[i] == "tom_katana_upgraded" )
- {
- player.has_gun_upgr = true;
- }
- }
- if( player.has_gun == true )
- {
- player switchtoweapon( "tom_katana" );
- player givemaxammo( "tom_katana" );
- player playsound( "ammo_pickup" );
- self notify( "took_gun" );
- tom_katana delete();
- self delete();
- break;
- }
- else if( player.has_gun_upgr == true )
- {
- player switchtoweapon( "tom_katana_upgraded" );
- player givemaxammo( "tom_katana_upgraded" );
- player playsound( "ammo_pickup" );
- self notify( "took_gun" );
- tom_katana delete();
- self delete();
- break;
- }
- else if( weaplist.size <= 1 )
- {
- player giveweapon( "tom_katana" );
- player switchtoweapon( "tom_katana" );
- player playsound( "weap_pickup_plr" );
- self notify( "took_gun" );
- tom_katana delete();
- self delete();
- break;
- }
- else if( weaplist.size >= 2 )
- {
- player takeweapon( old_gun );
- player giveweapon( "tom_katana" );
- player switchtoweapon( "tom_katana" );
- player playsound( "weap_pickup_plr" );
- self notify( "took_gun" );
- tom_katana delete();
- self delete();
- break;
- }
- }
- else if( player.free_tom_katana == true )
- {
- iprintlnbold( "This one is not for you..!" );
- }
- wait 0.1;
- }
- }
Add Comment
Please, Sign In to add comment