cod5-sdk/raw/maps/nazi_zombie_factory.gsc
2009-04-10 00:00:00 +00:00

308 lines
No EOL
7.3 KiB
Text

#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
main()
{
//PI ESM - added for dog support
level.dogs_enabled = true;
level thread maps\_callbacksetup::SetupCallbacks();
include_weapons();
include_powerups();
maps\nazi_zombie_factory_fx::main();
maps\_zombiemode::main();
//ESM - added for treasure chest support on PC
flag_init("magic_box_south");
flag_init("south_access_1");
flag_init("north_door1");
flag_init("north_upstairs_blocker");
flag_init("south_upstairs_blocker");
//ESM - turn on perks
activate_vending_machines();
init_sounds();
// If you want to modify/add to the weapons table, please copy over the _zombiemode_weapons init_weapons() and paste it here.
// I recommend putting it in it's own function...
// If not a MOD, you may need to provide new localized strings to reflect the proper cost.
// JMA - start crusher thinking
//get all moving objects bound together
bindKillTrigger();
bindLeverPieces();
level thread crusherTrapThink();
}
init_sounds()
{
maps\_zombiemode_utility::add_sound( "break_stone", "break_stone" );
}
// Include the weapons that are only inr your level so that the cost/hints are accurate
// Also adds these weapons to the random treasure chest.
include_weapons()
{
// Pistols
//include_weapon( "colt" );
//include_weapon( "colt_dirty_harry" );
//include_weapon( "walther" );
include_weapon( "sw_357" );
// Semi Auto
include_weapon( "m1carbine" );
include_weapon( "m1garand" );
include_weapon( "gewehr43" );
// Full Auto
include_weapon( "stg44" );
include_weapon( "thompson" );
include_weapon( "mp40" );
// Bolt Action
include_weapon( "kar98k" );
include_weapon( "springfield" );
// Scoped
include_weapon( "ptrs41_zombie" );
include_weapon( "kar98k_scoped_zombie" );
// Grenade
include_weapon( "molotov" );
// JESSE: lets go all german grenades for consistency and to reduce annoyance factor
// include_weapon( "fraggrenade" );
include_weapon( "stielhandgranate" );
// Grenade Launcher
include_weapon( "m1garand_gl" );
include_weapon( "m7_launcher" );
// Flamethrower
include_weapon( "m2_flamethrower_zombie" );
// Shotgun
include_weapon( "doublebarrel" );
include_weapon( "doublebarrel_sawed_grip" );
include_weapon( "shotgun" );
// Bipod
include_weapon( "fg42_bipod" );
include_weapon( "mg42_bipod" );
include_weapon( "30cal_bipod" );
// Heavy MG
include_weapon( "bar" );
// Rocket Launcher
include_weapon( "panzerschrek" );
// Special
include_weapon( "ray_gun" );
}
include_powerups()
{
include_powerup( "nuke" );
include_powerup( "insta_kill" );
include_powerup( "double_points" );
include_powerup( "full_ammo" );
}
include_weapon( weapon_name )
{
maps\_zombiemode_weapons::include_zombie_weapon( weapon_name );
}
include_powerup( powerup_name )
{
maps\_zombiemode_powerups::include_zombie_powerup( powerup_name );
}
//turn on all of the perk machines
activate_vending_machines()
{
//activate perks-a-cola
level notify( "master_switch_activated" );
level notify( "specialty_armorvest_power_on" );
level notify( "specialty_rof_power_on" );
level notify( "specialty_quickrevive_power_on" );
level notify( "specialty_fastreload_power_on" );
clientnotify("revive_on");
clientnotify("middle_door_open");
clientnotify("fast_reload_on");
clientnotify("doubletap_on");
clientnotify("jugger_on");
}
// Trap - Crusher functions
/////////////////////////////////////////////////////////
bindLeverPieces ()
{
mainPiece = getent("lever_center", "targetname");
sidePiece1 = getent("lever_side1", "targetname");
sidePiece2 = getent("lever_side2", "targetname");
//this is the only way I can bind successfully
sidePiece1 EnableLinkTo();
sidePiece2 EnableLinkTo();
sidePiece1 LinkTo (mainPiece);
sidePiece2 LinkTo (mainPiece);
}
moveCrusherLeverDown()
{
mainPiece = getent("lever_center", "targetname");
sidePiece1 = getent("lever_side1", "targetname");
sidePiece2 = getent("lever_side2", "targetname");
mainPiece movez( -16, 1, 0, 0 );
wait 0.9;
level notify ("crusherLeverDown");
}
moveCrusherLeverUp()
{
mainPiece = getent("lever_center", "targetname");
sidePiece1 = getent("lever_side1", "targetname");
sidePiece2 = getent("lever_side2", "targetname");
mainPiece movez( 16, 1, 0, 0 );
wait 0.9;
level notify ("crusherLeverUp");
}
bindKillTrigger()
{
moveEntity = getent( "crusher_top" , "targetname" );
trig = getent("crusher_kill_trigger", "targetname");
//this is the only way I can bind successfully
trig EnableLinkTo();
trig LinkTo (moveEntity);
}
crusherTrapThink()
{
trig = getent("crusher_buy_trigger", "targetname");
trig.is_available = 1;
trig.zombie_cost = 100;
trig.in_use = 0;
while(1)
{
trig waittill( "trigger", who );
if(trig.is_available)
{
if( is_player_valid( who ) )
{
if( who.score >= trig.zombie_cost )
{
if(!trig.in_use)
{
trig.in_use = 1;
trig.is_available = 0;
trig trigger_off();
//play_sound_at_pos( "purchase", who.origin );
level thread moveCrusherLeverDown();
level waittill("crusherLeverDown");
//set the score
who maps\_zombiemode_score::minus_to_player_score( trig.zombie_cost );
level thread moveCrusher("crusher_top", "top_dest", "bottom_dest", 5, 0, 0);
level waittill("crusher_off");
level thread moveCrusherLeverUp();
level waittill("crusherLeverUp");
trig trigger_on();
trig.is_available = 1;
trig.in_use = 0;
}
}
}
}
}
}
moveCrusher(string, top, bottom, time, accel, decel) {
//always want to make sure it finishes in the up position, this makes it easier
iter = 0;
moveEntity = getent( string , "targetname" );
topDest = getent( top, "targetname" );
bottomDest = getent( bottom, "targetname" );
trig = getent("crusher_kill_trigger", "targetname");
trig trigger_on();
thread crusherKill();
while (iter < 4)
{
moveEntity moveto( (bottomDest getorigin()), time, accel, decel );
wait (time - 0.1);
moveEntity moveto( (topDest getorigin()), time, accel, decel );
wait (time - 0.1);
iter++;
}
// turn the kill trigger off and quit monitoring zombies touching the trigger
trig trigger_off();
level notify ("crusher_off");
}
crusherKill()
{
level endon("crusher_off");
trig = getent( "crusher_kill_trigger", "targetname" );
while (1)
{
trigger_wait( "crusher_kill_trigger", "targetname" );
// get all the zombies and work out which ones are within the trigger
zombs = getaiarray("axis");
if( isdefined(zombs) )
{
for( i=0; i<zombs.size; i++ )
{
if( zombs[i] isTouching(trig) )
{
//zombs[i] thread maps\_zombiemode_spawner::zombie_damage( "MOD_EXPLOSIVE", "none", zombs[i].origin, self.owner );
zombs[i] dodamage(zombs[i].health + 50, zombs[i].origin);
}
}
}
//wait 0.1;
}
}