#include common_scripts\utility; #include maps\_utility; #include maps\_anim; //ent = GetEnt( "myent", "targetname" ); //ai SetGoalPos( ent.origin, ent.angles ); // THE NEW HOTNESS, note the second parameter //ai waittill( "goal" ); // wait for him to get to the goal area //ai waittill( "orientdone" ); // wait for him to rotate to the angles you specified /*------------------------------------ slides open the paper stye doors in the main castle building ------------------------------------*/ open_door(door,direction,move_x,wait_trig) { if(isDefined(wait_trig)) { trigger_wait(wait_trig,"targetname"); } else { wait(randomfloat(3)); } door1 = getent(door,"targetname"); if (direction == "r") { door1 connectpaths(); if(move_x) { door1 MoveTo( door1.origin + (56,0,0), randomfloatrange(1,1.5), 0, .05 ); } else { door1 MoveTo( door1.origin + (0,56,0), randomfloatrange(1,1.5), 0, .05 ); } } if(direction == "l") { door connectpaths(); if(move_x) { door1 MoveTo( door1.origin + (-56,0,0), randomfloatrange(1,1.5), 0, .05 ); } else { door1 MoveTo( door1.origin + (0,-56,0), randomfloatrange(1,1.5), 0, .05 ); } } } remove_grenades_from_everyone() { //removes grenades from all enemies, everyone!! guys = getspawnerarray(); for(i=0;i50) { guys[i].name = "Pvt. Zaring"; } else { guys[i].name = "Pvt. Pierro"; } level.sniper_pawn = guys[i]; pawn = true; } } level.sarge PushPlayer( true ); level.polonsky PushPlayer(true); } toggle_ignoreall(all) { if(isDefined(all)) { guys = getaiarray("allies"); } else { guys = get_ai_group_ai("friends"); } for(i=0;i 0) { points = getstructarray(spots,"targetname"); } for(x =0;x 0) { points = getstructarray(spots,"targetname"); } sarge_point = undefined; polonsky_point = undefined; pawn_point = undefined; //remove sarge from the array if we've set up node for sarge to start at for(i=0;i player.shocked_time ) { player.shocked_time = GetTime() + shock_time; ent = spawnstruct(); ent.origin = player.origin; ent.is_struct = true; min_dmg = 25; max_dmg = 50; dmg_mod = 1; for(q=0;q5;x--) // { // newstr = strng[x] + newstr; // } // return (newstr); // //} ///*------------------------------------ //USED WITH SQUAD_MANAGER TO //MONITOR WAVES OF GUYS //------------------------------------*/ //monitor_squads(guys,maxWaves,strEndon) //{ // level endon(strEndon); // // waves = 0; // while(waves < maxWaves) // { // level waittill(guys + " min threshold reached"); // waves++; // } // level notify(strEndon); //} /*------------------------------------ ------------------------------------*/ #using_animtree ("supply_drop"); do_supply_drop(drop,plane) { //grab and hide the supply drop that lands in the bunker //landed_drop = getent("bunker_chute_landed","targetname"); //landed_drop hide(); supply_drop = getent("supply_drop" + drop, "targetname"); org1 = supply_drop.origin; if(drop == 4) { org1 = supply_drop.origin;//(5717.5, 3154.5, -754);//supply_drop.origin; } supply_drop.origin = plane.origin; supply_drop show(); supply_drop.animname = "drop"; supply_drop useanimtree(#animtree); supply_drop moveto( org1 + (0,0,-80) , randomfloatrange(3.5,5) ); supply_drop waittill("movedone"); supply_drop notify("stop_looping"); supply_drop playsound("supply_box_land"); the_anim = undefined; chance = randomint(100); if(chance > 50) { the_anim = level.scr_anim["drop"]["landing"]; } else { the_anim = level.scr_anim["drop"]["landingb"]; } supply_drop SetFlaggedAnimKnobRestart( "drop_landing", the_anim, 1.0, 0.2, 1.0 ); wait(5); supply_drop delete(); } /*------------------------------------ temp until animation gets done ------------------------------------*/ #using_animtree ("supply_drop"); do_drop_idle_anim() { //self.animname = "drop1"; self useanimtree(#animtree); self endon("movedone"); self endon("stop_looping"); while(1) { self maps\_anim::anim_single_solo(self,"drop"); self waittill("single anim"); } } /*------------------------------------ Check to see if the attacker is one of the players attacker = entitiy ------------------------------------*/ is_player(attacker) { players = get_players(); attackerIsPlayer = false; for( i = 0; i < players.size; i++ ) { player = players[i]; if( attacker == player ) { attackerIsPlayer = true; break; } } return attackerIsPlayer; } /*------------------------------------ give the user a hint to show the airstrike ------------------------------------*/ air_strike_user_notify() { self endon("death"); self endon("disconnect"); //removed the icon //self thread do_airstrike_hud_elem(); text = &"OKI3_AIRSTRIKE_HOWTO"; self setup_client_hintelem(); self.hintelem setText(text); wait(3.5); self.hintelem settext(""); } do_airstrike_hud_elem() { self endon("death"); self endon("disconnect"); elem = newclienthudelem(self); elem.x = 280; elem.y = 240; elem.alpha = 0; //elem.horzAlign = "fullscreen"; //elem.vertAlign = "fullscreen"; elem.foreground = true; elem SetShader( "hud_icon_airstrike", 64, 64); // Fade into white elem FadeOverTime( 0.2 ); elem.alpha = 1; wait 5; elem MoveOverTime( 1.5 ); elem.y = 420; elem.x = elem.x + 80; elem ScaleOverTime( 1.5, 8, 8 ); wait 2; elem FadeOverTime( 0.2 ); elem.alpha = 0; wait 0.2; elem destroy(); } /*------------------------------------ wait for player to use the mortars in the pits ------------------------------------*/ mortar_round_think(trig) { self endon("stop_thinking"); ent = getent("use_mortars_" + trig,"targetname"); ent sethintstring(&"OKI3_USE_MORTAR"); ent thread mortar_hint(); while(1) { ent waittill("trigger",user); //fix berzerker collectible issue if(isDefined(user.collectibles_berserker_mode_on) && user.collectibles_berserker_mode_on ) { continue; } else { //prevent mortar spamming if(!isDefined(user.hasmortar)) { user GiveWeapon( "mortar_round" ); user SwitchToWeapon( "mortar_round" ); user setweaponammoclip("mortar_round",1); user allowMelee(false); user thread watch_mortar_weapon(); user thread watch_player_mortar_death(); } } } } watch_player_mortar_death() { self endon("disconnect"); self endon("mortar_dropped"); self waittill("death"); self allowMelee(true); self.hasmortar = undefined; } watch_mortar_weapon() { self endon("death"); self endon("disconnect"); self endon("mortar_dropped"); self.disableBerserker = true; while ( self getcurrentweapon() != "mortar_round") { wait_network_frame(); } while( self getcurrentweapon() == "mortar_round" || self getcurrentweapon() == "none" ) { self.hasmortar = true; if(!isDefined(self.mortar_hint_given)) { self thread hud_mortar_hint(); self.mortar_hint_given = true; } wait_network_frame(); } if(self getcurrentweapon() != "syrette") { self takeweapon("mortar_round"); } self allowMelee(true); dropped = true; self.hasmortar = undefined; self.disableBerserker = undefined; //self SetClientDvar( "ammoCounterHide", "0" ); self notify("mortar_dropped"); } hud_mortar_hint() { self endon("death"); self endon("disconnect"); text = &"OKI3_MORTAR_HINT"; self setup_client_hintelem(); self.hintelem setText(text); wait(5); self.hintelem settext(""); } /*------------------------------------ notify a trigger ------------------------------------*/ trigger_array_notify(no_wait) { if(!isDefined(no_wait)) { wait(randomfloat(2)); } self notify("trigger"); } mortar_hint() { level endon ("mortar_hint_given"); while(1) { players = get_players(); for(i=0;i 384*384) { self notify("new_position"); self thread goto_new_position(new_org); } } } /*------------------------------------ makes the guy run to a new position self = guy following the leader ------------------------------------*/ goto_new_position(new_org) { self endon("new_position"); self endon("death"); self.goalradius = 256; self setgoalpos(new_org); self.ignoreall = true; self waittill("goal"); self.ignoreall = false; self findcovernode(); } /*------------------------------------ monitors for the leader to choose a new position ------------------------------------*/ monitor_leader() { self endon("death"); //make sure the leader always has a large goalradius self.goalradius = level.default_goalradius; while(1) { //check to see if the leader has a node already if(isDefined(self.node) && isDefined(self.node.origin)) { self.a.old_node_origin = self.node.origin; } wait(.25); //check to see if the leader wants to run to a new node which is farther than 128 units away from his current position. if(isDefined(self.node) && isDefined(self.node.origin) && isDefined(self.a.old_node_origin)) { if( self.a.old_node_origin != self.node.origin && distancesquared(self.node.origin,self.origin) > 128*128) { self notify("node_changed",self.node.origin); } } } } /*------------------------------------ promote a new guy to a leader when the old leader gets killed ------------------------------------*/ squad_promotion(guys,leader) { squadname = guys[0].script_aigroup; //wait until the leader kicks it leader waittill("death"); //grab all the guys left in the squad and pick a new leader if there are more than 1 guys = get_ai_group_ai(squadname); level notify("new leader"); if(isDefined(guys) && guys.size > 1) { iprintln("promoting a new leader for " + squadname ); level thread squad_leader_manager(guys); } } /*------------------------------------ select the leader from the guys ------------------------------------*/ select_leader(guys) { leader = undefined; for(i=0;i 0), "no warpto positions found"); players = get_players(); count = 0; for(i=0;i 32) // { // wait(.05); // } // new_node = getnode(goal.target,"targetname"); // self setgoalnode(new_node); // while(distance(self.origin,new_node.origin) > 32) // { // wait(.05); // } // at_pos = true; // wait(1); // } // // self setgoalpos(desired_goalpos); //} /*------------------------------------ guy jumps off his mortar and take cover ------------------------------------*/ mortar_guy_alert() { self endon("death"); node = getnode(self.target,"targetname"); trig = undefined; ents = getentarray(self.target,"targetname"); for(i=0;i 128) { self.goalradius = self.goalradius - 64; } } } sniper_leafy_conceal() { trees = getstructarray( "treesniper_origin", "targetname" ); for(i=0;i 0 ) // { // // self waittill( "damage", amount, attacker, direction_vec, point, type, modelName, tagName ); // // type = tolower( type ); // // // if it's not the player, and also a bullet weapon (non-player friendlies should still be able to kill them with their grenades) // if( !isplayer(attacker) && issubstr( type, "bullet" ) ) // { // //iprintln( "attacked by non-player!" ); // self.health = 10000; // give back health for these things // } // else // { // self.health = self.pel2_real_health; // self dodamage( amount, (0,0,0) ); // self.pel2_real_health = self.health; // // put ff shield back on // self.health = 10000; // } // } // //} // // // //grass_camo_ignore_delay( wait_time ) //{ // self endon( "death" ); // // wait( wait_time ); // self.ignoreme = 0; //} // // // //grass_camo_halfshield_delay( delay_time ) //{ // self endon( "death" ); // // wait( delay_time ); // level notify( "stop_grass_half_shields" ); // self.health = self.pel2_real_health; //} grass_surprise_damage( which_flag ) { level endon( which_flag ); while( 1 ) { self waittill( "damage", amount, attacker ); // POLISH: if player throws a grenade into the grass, it should kill the dudes, not just alert them and stop their MBS if( isplayer( attacker ) ) { flag_set( which_flag ); } } } //// Conserva's fix for prone-to-run banzai transition. should be added in _anim at some point? //old_play_anim_end_early( the_anim, how_early ) //{ // self animscripted( "anim single", self.origin, self.angles, the_anim ); // animtime = getanimlength( the_anim ); // // animtime -= how_early; // wait(animtime); // // self stopanimscripted(); //} /*------------------------------------ sWaittill = level notification sent out by sm to spawn a new group of guys squadname = the name of the squad for sm to use a,b,c = script_noteworthy value on the spawners to determine which 'squads' to use as spawners for sm ------------------------------------*/ squad_manager_think(sm_notify,tgtname,sEndon,sWaittill,squadname,a,b,c) { level endon(sEndon); while(1) { squads = []; squads[0] = "squad_a"; if(isDefined(b)) { squads[1] = "squad_b"; } if (isDefined(c)) { squads[2] = "squad_c"; } noteworthy = squads[randomint(squads.size)]; //turn off all spawners first og_spawners = getspawnerarray(); for(i=0;i 128) { self.goalradius = self.goalradius - 128; } } } #using_animtree("generic_human"); flamedeath(attacker) { anima[0] = %ai_flame_death_a; anima[1] = %ai_flame_death_b; anima[2] = %ai_flame_death_c; anima[3] = %ai_flame_death_d; self.deathanim = anima[randomint(anima.size)]; self thread death_flame_fx(); self dodamage(self.health + 100, self.origin,attacker); wait(3); self StartTanning(); } /*------------------------------------ play some flame effects on the guys in the bunker who burn up ------------------------------------*/ death_flame_fx() { tagArray = []; tagArray[tagArray.size] = "J_Wrist_RI"; tagArray[tagArray.size] = "J_Wrist_LE"; tagArray[tagArray.size] = "J_Elbow_LE"; tagArray[tagArray.size] = "J_Elbow_RI"; tagArray[tagArray.size] = "J_Knee_RI"; tagArray[tagArray.size] = "J_Knee_LE"; tagArray[tagArray.size] = "J_Ankle_RI"; tagArray[tagArray.size] = "J_Ankle_LE"; for( i = 0; i < 3; i++ ) { PlayFxOnTag( level._effect["flame_death1"], self, tagArray[randomint(tagArray.size)] ); PlayFxOnTag( level._effect["flame_death2"], self, "J_SpineLower" ); } } get_ai_by_animname(aname) { axis = getaiarray("allies"); allies = getaiarray("axis"); guys = []; ai = array_combine(axis,allies); for(i=0;i