Jump to content

-


Recommended Posts

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

The game can't just spawn new graphics, especially large interactive ones. It would be visible via no clip.

Ima gona stick my neck out on this one and say you might be wrong. We allready have tech like texture streaming, why say they cannot go one step further. I believe it is possible to create an entity but not render it as an object unless a trigger is switched.

I was having a quick read through the Kino script, I think (hope) that the script for the reels might demonstrate this idea on a smaller scale.

If I come acrooss the post featuring that code again I will update this post.

Link to comment

A. Good thought, but still...... ugh. Not really.

B. Spelling much?

Yes it was a good thought, so why the UGH. Not really? His idea is confirmed by the game code that an entity can be made invisible to the player or players. Both codes shown below confirm Treyarch have this ability within the engine, I very much doubt there is a limit on what can be hidden and would not be viewable in no-clip.

zombie_pentagon_traps.gsc

#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_traps;
#include maps\_zombiemode_utility;


init_traps()
{
level init_flags();

level electric_trap_battery_init();
level pentagon_fix_electric_trap_init();

// ww: getting teh quad intro fx in with the changes to the trap system
level quad_first_drop_fx_init();
}

init_flags()
{
flag_init( "trap_elevator" );
flag_init( "trap_quickrevive" );


}
//-------------------------------------------------------------------------------
// DCS 082410: standarding and making into prefabs batteries for traps.
//-------------------------------------------------------------------------------
electric_trap_battery_init()
{
trap_batteries = GetEntArray( "trigger_trap_piece", "targetname" );
players = get_players();
for ( i = 0; i {
players[i]._trap_piece = 0;
}

array_thread( trap_batteries, ::pickup_trap_piece );
}

pickup_trap_piece()
{
self endon( "_piece_placed" );

if( !IsDefined( self.target ) )
{
// where the model goes isn't hooked up, leave
return;
}

trap_piece = self spawn_trap_piece();

self SetHintString( &"ZOMBIE_PENTAGON_GRAB_MISSING_PIECE" );
self SetCursorHint( "HINT_NOICON" );

// battery = getstruct( self.target, "targetname" );
self.picked_up = 0;

// require look at
self UseTriggerRequireLookAt();

while( self.picked_up == 0 )
{
self waittill( "trigger", user );

if( is_player_valid( user ) )
{
if( IsDefined( user._trap_piece ) && user._trap_piece > 0 ) // you have a piece, go away
{
play_sound_at_pos( "no_purchase", self.origin );
continue;
}
else
{
self trigger_off();

if( IsDefined( trap_piece ) )
{
PlayFXOnTag( level._effect["switch_sparks"], trap_piece, "tag_origin" );

// TODO: NEED A BETTER SOUND HERE, COULD WE GET AN EVIL BARB?
// SOMETHING LIKE "SO YOU THINK YOU'RE SLICK?!"
trap_piece thread play_sound_on_entity( "zmb_battery_pickup" );

user thread pentagon_have_battery_hud();
user thread trap_piece_deliver_clean_up( self );
}
user._trap_piece = 1;
self.picked_up = 1;

user thread pentagon_hide_piece_triggers();

// wait( 1.0 );
trap_piece Delete();
}
}
}
}

// ww: trigger spawns the script model that will be picked up, script model is returned
spawn_trap_piece()
{
spawn_struct = getstruct( self.target, "targetname" );

trap_model = Spawn( "script_model", spawn_struct.origin );
trap_model SetModel( "zombie_sumpf_power_switch" );
trap_model.angles = spawn_struct.angles;

return trap_model;
}


// WW: make all other trap piece triggers invisible to players who have a trap piece
pentagon_hide_piece_triggers()
{
trap_piece_triggers = GetEntArray( "trigger_trap_piece", "targetname" );

for( i = 0; i {
if( trap_piece_triggers[i].picked_up == 0 )
{
trap_piece_triggers[i] SetInvisibleToPlayer( self );
}
}
}

// WW: Init all the triggers needed for fixing the electric traps. there should be one of these per electric trap
pentagon_fix_electric_trap_init()
{
fix_trigger_array = GetEntArray( "trigger_battery_trap_fix", "targetname" );

if( IsDefined( fix_trigger_array ) )
{
array_thread( fix_trigger_array, ::pentagon_fix_electric_trap );
}
}

// WW: Traps wait for a battery to be delivered before becoming active
pentagon_fix_electric_trap()
{
if( !IsDefined( self.script_flag_wait ) ) // make sure the proper kvp is on the object
{
PrintLn( "trap at " + self.origin + " missing script flag" );
return;
}

if( !IsDefined( self.script_string ) )
{
PrintLn( "trap at " + self.origin + " missing script string" );
}

self SetHintString( &"ZOMBIE_PENTAGON_MISSING_PIECE" );
self SetCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();

trap_trigger = GetEntArray( self.script_flag_wait, "targetname" ); // the script string has the trap trigger targetname
array_thread( trap_trigger, ::electric_hallway_trap_piece_hide, self.script_flag_wait );

trap_cover = GetEnt( self.script_string, "targetname" ); // script brush model covering the trap pieces
level thread pentagon_trap_cover_remove( trap_cover, self.script_flag_wait );

while( !flag( self.script_flag_wait ) ) // this flag will be set internally when the battery is delivered
{
self waittill( "trigger", who );

if( is_player_valid( who ) )
{
if( !IsDefined( who._trap_piece ) || who._trap_piece == 0 ) // you don't have it, go away
{
play_sound_at_pos( "no_purchase", self.origin );
// continue;
}
else if( IsDefined( who._trap_piece ) && who._trap_piece == 1 ) // you have the battery
{
who._trap_piece = 0;

self PlaySound( "zmb_battery_insert" );

who thread pentagon_show_piece_triggers();

flag_set( self.script_flag_wait ); // flag is set on the trigger in the trap

who notify( "trap_piece_returned" );

who thread pentagon_remove_battery_hud();
}
}
}

// hide the trigger
self SetHintString( "" );
self trigger_off();
}

// WW: make all other trap piece triggers visbile to players who have placed a trap piece
pentagon_show_piece_triggers()
{
trap_piece_triggers = GetEntArray( "trigger_trap_piece", "targetname" );

for( i = 0; i {
if( trap_piece_triggers[i].picked_up == 0 )
{
trap_piece_triggers[i] SetVisibleToAll();
}
}
}

// ww: removes trigger on successfuly piece placement
trap_piece_deliver_clean_up( ent_trig )
{
self endon( "death" );
self endon( "disconnect" );

self waittill( "trap_piece_returned" );

ent_trig notify( "_piece_placed" );

ent_trig Delete();
}

// ww: hides the zctivation trigger for the trap, but goes through multiple script ents
// SELF == SCRIPT MODEL/TRIGGER
electric_hallway_trap_piece_hide( str_flag )
{
if( !IsDefined( str_flag ) )
{
return;
}

if( self.classname == "trigger_use" )
{
self SetHintString( &"ZOMBIE_NEED_POWER" );
self thread electric_hallway_trap_piece_show( str_flag );
self trigger_off();
}
}

// ww: returns the trigger once the piece has been placed
// SELF == SCRIPT MODEL/TRIGGER
electric_hallway_trap_piece_show( str_flag )
{
if( !IsDefined( str_flag ) )
{
return;
}

flag_wait( str_flag );

self trigger_on();
}

// ww: removes the script brushmodel covers when teh trap has been created
pentagon_trap_cover_remove( ent_cover, str_flag )
{
flag_wait( str_flag );

// TODO: COOL FX TO PLAY WHILE MOVING IT?
ent_cover NotSolid();
ent_cover.fx = Spawn( "script_model", ent_cover.origin );
ent_cover.fx SetModel( "tag_origin" );

ent_cover MoveZ( 48, 1.0, 0.4, 0 );
ent_cover waittill( "movedone" );

ent_cover RotateRoll( ( 360 * RandomIntRange( 4, 10 ) ), 1.2, 0.6, 0 );
PlayFXOnTag( level._effect["poltergeist"], ent_cover.fx, "tag_origin" );
// TODO: COOL ANGRY VOICE HERE? AS IF THE ETHER IS ANGRY YOU PUT THE TRAP TOGETHER
ent_cover waittill( "rotatedone" );

ent_cover Hide();
ent_cover.fx Hide();
ent_cover.fx Delete();
ent_cover Delete();

// ent_cover Hide();
// ent_cover Delete();
}

// WW:add the hud element for the battery so a player knows they have the battery
pentagon_have_battery_hud()
{
self.powercellHud = create_simple_hud( self );

self.powercellHud.foreground = true;
self.powercellHud.sort = 2;
self.powercellHud.hidewheninmenu = false;
self.powercellHud.alignX = "center";
self.powercellHud.alignY = "bottom";
self.powercellHud.horzAlign = "user_right";
self.powercellHud.vertAlign = "user_bottom";
self.powercellHud.x = -200; // ww: started at 256
self.powercellHud.y = 0;

self.powercellHud.alpha = 1;
self.powercellHud setshader( "zom_icon_trap_switch_handle", 32, 32 );

self thread pentagon_remove_hud_on_death();
}

// WW: remove the battery hud element
pentagon_remove_battery_hud()
{
if( IsDefined( self.powercellHud ) )
{
self.powercellHud Destroy();
}
}

// WW: remove the trap piece hud on player death
pentagon_remove_hud_on_death()
{
self endon( "trap_piece_returned" );

self waittill_either( "death", "_zombie_game_over" );

self thread pentagon_remove_battery_hud() ;
}

//-------------------------------------------------------------------------------
// ww: setups the fx exploder for certain vents the first time a quad comes out
quad_first_drop_fx_init()
{
vent_drop_triggers = GetEntArray( "trigger_quad_intro", "targetname" );

// these triggers are one timers, don't thread them or the function dies
for( i = 0; i {
level thread quad_first_drop_fx( vent_drop_triggers[i] );
}
}

quad_first_drop_fx( ent_trigger )
{
if( !IsDefined( ent_trigger.script_int ) )
{
return;
}

exploder_id = ent_trigger.script_int;

ent_trigger waittill( "trigger" );

ent_trigger PlaySound( "evt_pentagon_quad_spawn" );

exploder( exploder_id );
}
zombie_theater_movie_screen.gsc
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

initMovieScreen()
{
//level thread set_up_images();
//level thread lower_movie_screen();
level thread setupCurtains();

level thread movie_reels_init();
}

set_up_images()
{
level.images = [];
level.images = getentarray("screen_image", "targetname");
level.images = mergeSort(level.images);
for (x = 0; x level.images[x] hide();
}

//merge sort for speed and sexiness
mergeSort(current_list)
{
if (current_list.size return current_list;

left = [];
right = [];

middle = current_list.size / 2;
for (x = 0; x left = add_to_array(left, current_list[x]);
for (; x right = add_to_array(right, current_list[x]);

left = mergeSort(left);
right = mergeSort(right);

if (left[left.size - 1].script_int > right[right.size - 1].script_int)
result = merge(left, right);
else
result = append(left, right);
return result;
}

//merge the two arrays
merge(left, right)
{
result = [];

while (left.size > 0 && right.size > 0)
{
if (left[0] {
result = add_to_array(result, left[0]);
left = array_remove_index(left, 0);
}
else
{
result = add_to_array(result, right[0]);
right = array_remove_index(right, 0);
}
}
while (left.size > 0)
result = append(result, left);
while (right.size > 0)
result = append(result, right);

return result;
}

//simple add right array to the end of left array
append(left, right)
{
for (x = 0; x left = add_to_array(left, right[x]);
return left;
}

setupCurtains()
{
flag_wait( "power_on" );
//wait(2);
//level thread moveCurtains("left_curtain");
//level thread moveCurtains("right_curtain");

curtains = getent("theater_curtains", "targetname");
curtains_clip = getent("theater_curtains_clip", "targetname");

curtains_clip notsolid();
curtains_clip connectpaths();
curtains maps\zombie_theater::theater_playanim("curtains_move" );

curtains waittill ("curtains_move_done");

flag_set( "curtains_done" );

level thread lower_movie_screen();

}

moveCurtains(curtent)
{
curtain = getent( curtent, "targetname");
curtorg = curtain.origin;
time = 2;

curtain thread monitorCurtain(curtorg);
curtain connectpaths();
curtain MoveTo( curtain.origin + curtain.script_vector, time, time * 0.25, time * 0.25 );
curtain playsound( "curtain_open" );
}

monitorCurtain(curtorg)
{
clip = getent(self.target, "targetname");

while (IsDefined(clip))
{
if ((abs(curtorg[0] - self.origin[0])) >= 38 )
{
clip connectpaths();
clip NotSolid();
if (IsDefined(clip.target))
clip = getent(clip.target, "targetname");
else
clip = undefined;
}

wait (0.1);
}
}

open_left_curtain()
{
flag_wait( "power_on" );
curtain = GetEnt("left_curtain", "targetname");

if(isDefined(curtain))
{
wait(2);
//curtain waittill("movedone");
curtain_clip = getentarray("left_curtain_clip", "targetname");
for (i = 0; i {
curtain_clip[i] connectpaths();
curtain_clip[i] notsolid();
}
curtain connectpaths();
curtain movex(-300, 2);
}
}

open_right_curtain()
{
flag_wait( "power_on" );
curtain = GetEnt("right_curtain", "targetname");

if(isDefined(curtain))
{
wait(2);
//curtain waittill("movedone");
curtain_clip = getentarray("right_curtain_clip", "targetname");
for (i = 0; i {
curtain_clip[i] connectpaths();
curtain_clip[i] notsolid();
}
curtain connectpaths();
curtain movex(300, 2);
}
}

lower_movie_screen()
{
// flag_wait( "power_on" );
screen = GetEnt("movie_screen", "targetname");

if(isDefined(screen))
{
screen movez(-466, 6);
screen playsound( "evt_screen_lower" );
}
//for (x = 0; x // level.images[x] movez(-466, 6);
//wait (4);
screen waittill ("movedone");

wait (2);

// level notify( "sip" );
clientnotify( "sip" ); // ww: notify talks to zombie_theater_fx.csc to start the projector fxs
// exploder(314); // projection light on
//level thread play_images();
}

play_images()
{
x = 0;
while (1)
{
if (x > level.images.size - 1)
x = 0;
level.images[x] show();
wait(0.1);
level.images[x] hide();
x++;
}
}

// Init the reel triggers
movie_reels_init()
{
// active reel array

// each room will have three places the reel could go
clean_bedroom_reels = GetEntArray( "trigger_movie_reel_clean_bedroom", "targetname" );
bear_bedroom_reels = GetEntArray( "trigger_movie_reel_bear_bedroom", "targetname" );
interrogation_reels = GetEntArray( "trigger_movie_reel_interrogation", "targetname" );
pentagon_reels = GetEntArray( "trigger_movie_reel_pentagon", "targetname" );

// put all the arrays in to a master array
level.reel_trigger_array = [];
level.reel_trigger_array = add_to_array( level.reel_trigger_array, clean_bedroom_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, bear_bedroom_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, interrogation_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, pentagon_reels, false );

// randomize the master array. the first three arrays will be chosen for reel placement
level.reel_trigger_array = array_randomize( level.reel_trigger_array );

// now pick one reel out of each of the first three arrays
reel_0 = movie_reels_random( level.reel_trigger_array[0], "ps1" );
reel_1 = movie_reels_random( level.reel_trigger_array[1], "ps2" );
reel_2 = movie_reels_random( level.reel_trigger_array[2], "ps3" );

// combine all the individual reels in to one array
temp_reels_0 = array_merge( clean_bedroom_reels, bear_bedroom_reels );
temp_reels_1 = array_merge( interrogation_reels, pentagon_reels );
all_reels = array_merge( temp_reels_0, temp_reels_1 );

// thread off the movie reel func on all reels. func will hide reels that were not chosen for display
array_thread( all_reels, ::movie_reels );

level thread movie_projector_reel_change();
}

// Randomly choose one of the reels in a reel array for display
movie_reels_random( array_reel_triggers, str_reel )
{
if( !IsDefined( array_reel_triggers ) )
{
return;
}
else if( array_reel_triggers.size {
return;
}
else if( !IsDefined( str_reel ) )
{
return;
}

random_reels = array_randomize( array_reel_triggers );

// grab the first one out of teh random array
random_reels[0].script_string = str_reel; // TODO: THIS WILL HAVE TO BE MADE INTO A SIDE FUNCTION IF WE GET 20-24 VIDEOS
random_reels[0].reel_active = true;
return random_reels[0]; // return the first reel in the array as the one to display

}

// watch the reel to get picked up. the trigger should be targetting a script model
// SELF == TRIGGER
movie_reels()
{
if( !IsDefined( self.target ) )
{
/#
AssertEx( IsDefined( self.target ), "one of the reel triggers missing target" );
#/
return;
}

// define the model being used for the reel
self.reel_model = GetEnt( self.target, "targetname" );

if( !IsDefined( self.reel_active ) )
{
self.reel_active = false;
}

if( IsDefined( self.reel_active ) && self.reel_active == false )
{
// turn off the trigger and hide the model
self.reel_model Hide();
self SetCursorHint( "HINT_NOICON" );
self SetHintString( "" );
self trigger_off();

// end the function
return;
}
else if ( IsDefined( self.reel_active ) && self.reel_active == true )
{
// set the reel model
self.reel_model SetModel( "zombie_theater_reelcase_obj" ); // TODO: SPECIAL MODELS WILL NEED TO BE INPUT AT SOME POINT

// set hint string and cursor image
self SetCursorHint( "HINT_NOICON" );
// self SetHintString( &"ZOMBIE_THEATER_FILM_REEL" ); // ww:removing hing strings
}

// wait for power
flag_wait( "power_on" );

self waittill( "trigger", who );
who PlaySound( "zmb_reel_pickup" );

self.reel_model Hide();
self trigger_off();

// put the reel string on the player that hit the trigger
who.reel = self.script_string;

who thread theater_movie_reel_hud();

}

// Projector trigger watching for a player with a reel
movie_projector_reel_change()
{
screen_struct = getstruct( "struct_theater_screen", "targetname" );
projector_trigger = GetEnt( "trigger_change_projector_reels", "targetname" );

projector_trigger SetCursorHint( "HINT_NOICON" );
//projector_trigger SetHintString( &"ZOMBIE_THEATER_REEL_PROJECTOR" ); // ww:removing hing strings

// just in case the struct is missing the beginning string
if( !IsDefined( screen_struct.script_string ) )
{
screen_struct.script_string = "ps0";
}

while( true )
{
projector_trigger waittill( "trigger", who );

if( IsDefined( who.reel ) && IsString( who.reel ) )
{
clientnotify( who.reel ); // ww: this should be a three digit notify that is set on the reels above

who notify( "reel_set" );

who thread theater_remove_reel_hud();
who thread maps\zombie_theater_amb::play_radio_egg( 2 );
who PlaySound( "zmb_reel_place" );

who.reel = undefined;
wait( 3 );
}
else
{
wait( 0.1 );
}

wait( 0.1 );

}

}

// WW:add the hud element for the reel so a player knows they have it
theater_movie_reel_hud()
{
self.reelHud = create_simple_hud( self );

self.reelHud.foreground = true;
self.reelHud.sort = 2;
self.reelHud.hidewheninmenu = false;
self.reelHud.alignX = "center";
self.reelHud.alignY = "bottom";
self.reelHud.horzAlign = "user_right";
self.reelHud.vertAlign = "user_bottom";
self.reelHud.x = -200;
self.reelHud.y = 0;

self.reelHud.alpha = 1;
self.reelHud setshader( "zom_icon_theater_reel", 32, 32 );

self thread theater_remove_reel_on_death();

}

// WW: remove the battery hud element
theater_remove_reel_hud()
{
if( IsDefined( self.reelHud ) )
{
self.reelHud Destroy();
}
}

// WW: removes hud element if player dies
theater_remove_reel_on_death()
{
self endon( "reel_set" );

self waittill_either( "death", "_zombie_game_over" );

self thread theater_remove_reel_hud();

}

Lay off with the spelling bro, that high standard by which you judge others will one day be the yard stick that is used to judge you. Show some love, it easier than being a hater and more fun :D

Link to comment

A. Good thought, but still...... ugh. Not really.

B. Spelling much?

Yes it was a good thought, so why the UGH. Not really? His idea is confirmed by the game code that an entity can be made invisible to the player or players. Both codes shown below confirm Treyarch have this ability within the engine, I very much doubt there is a limit on what can be hidden and would not be viewable in no-clip.

zombie_pentagon_traps.gsc

#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_traps;
#include maps\_zombiemode_utility;


init_traps()
{
level init_flags();

level electric_trap_battery_init();
level pentagon_fix_electric_trap_init();

// ww: getting teh quad intro fx in with the changes to the trap system
level quad_first_drop_fx_init();
}

init_flags()
{
flag_init( "trap_elevator" );
flag_init( "trap_quickrevive" );


}
//-------------------------------------------------------------------------------
// DCS 082410: standarding and making into prefabs batteries for traps.
//-------------------------------------------------------------------------------
electric_trap_battery_init()
{
trap_batteries = GetEntArray( "trigger_trap_piece", "targetname" );
players = get_players();
for ( i = 0; i {
players[i]._trap_piece = 0;
}

array_thread( trap_batteries, ::pickup_trap_piece );
}

pickup_trap_piece()
{
self endon( "_piece_placed" );

if( !IsDefined( self.target ) )
{
// where the model goes isn't hooked up, leave
return;
}

trap_piece = self spawn_trap_piece();

self SetHintString( &"ZOMBIE_PENTAGON_GRAB_MISSING_PIECE" );
self SetCursorHint( "HINT_NOICON" );

// battery = getstruct( self.target, "targetname" );
self.picked_up = 0;

// require look at
self UseTriggerRequireLookAt();

while( self.picked_up == 0 )
{
self waittill( "trigger", user );

if( is_player_valid( user ) )
{
if( IsDefined( user._trap_piece ) && user._trap_piece > 0 ) // you have a piece, go away
{
play_sound_at_pos( "no_purchase", self.origin );
continue;
}
else
{
self trigger_off();

if( IsDefined( trap_piece ) )
{
PlayFXOnTag( level._effect["switch_sparks"], trap_piece, "tag_origin" );

// TODO: NEED A BETTER SOUND HERE, COULD WE GET AN EVIL BARB?
// SOMETHING LIKE "SO YOU THINK YOU'RE SLICK?!"
trap_piece thread play_sound_on_entity( "zmb_battery_pickup" );

user thread pentagon_have_battery_hud();
user thread trap_piece_deliver_clean_up( self );
}
user._trap_piece = 1;
self.picked_up = 1;

user thread pentagon_hide_piece_triggers();

// wait( 1.0 );
trap_piece Delete();
}
}
}
}

// ww: trigger spawns the script model that will be picked up, script model is returned
spawn_trap_piece()
{
spawn_struct = getstruct( self.target, "targetname" );

trap_model = Spawn( "script_model", spawn_struct.origin );
trap_model SetModel( "zombie_sumpf_power_switch" );
trap_model.angles = spawn_struct.angles;

return trap_model;
}


// WW: make all other trap piece triggers invisible to players who have a trap piece
pentagon_hide_piece_triggers()
{
trap_piece_triggers = GetEntArray( "trigger_trap_piece", "targetname" );

for( i = 0; i {
if( trap_piece_triggers[i].picked_up == 0 )
{
trap_piece_triggers[i] SetInvisibleToPlayer( self );
}
}
}

// WW: Init all the triggers needed for fixing the electric traps. there should be one of these per electric trap
pentagon_fix_electric_trap_init()
{
fix_trigger_array = GetEntArray( "trigger_battery_trap_fix", "targetname" );

if( IsDefined( fix_trigger_array ) )
{
array_thread( fix_trigger_array, ::pentagon_fix_electric_trap );
}
}

// WW: Traps wait for a battery to be delivered before becoming active
pentagon_fix_electric_trap()
{
if( !IsDefined( self.script_flag_wait ) ) // make sure the proper kvp is on the object
{
PrintLn( "trap at " + self.origin + " missing script flag" );
return;
}

if( !IsDefined( self.script_string ) )
{
PrintLn( "trap at " + self.origin + " missing script string" );
}

self SetHintString( &"ZOMBIE_PENTAGON_MISSING_PIECE" );
self SetCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();

trap_trigger = GetEntArray( self.script_flag_wait, "targetname" ); // the script string has the trap trigger targetname
array_thread( trap_trigger, ::electric_hallway_trap_piece_hide, self.script_flag_wait );

trap_cover = GetEnt( self.script_string, "targetname" ); // script brush model covering the trap pieces
level thread pentagon_trap_cover_remove( trap_cover, self.script_flag_wait );

while( !flag( self.script_flag_wait ) ) // this flag will be set internally when the battery is delivered
{
self waittill( "trigger", who );

if( is_player_valid( who ) )
{
if( !IsDefined( who._trap_piece ) || who._trap_piece == 0 ) // you don't have it, go away
{
play_sound_at_pos( "no_purchase", self.origin );
// continue;
}
else if( IsDefined( who._trap_piece ) && who._trap_piece == 1 ) // you have the battery
{
who._trap_piece = 0;

self PlaySound( "zmb_battery_insert" );

who thread pentagon_show_piece_triggers();

flag_set( self.script_flag_wait ); // flag is set on the trigger in the trap

who notify( "trap_piece_returned" );

who thread pentagon_remove_battery_hud();
}
}
}

// hide the trigger
self SetHintString( "" );
self trigger_off();
}

// WW: make all other trap piece triggers visbile to players who have placed a trap piece
pentagon_show_piece_triggers()
{
trap_piece_triggers = GetEntArray( "trigger_trap_piece", "targetname" );

for( i = 0; i {
if( trap_piece_triggers[i].picked_up == 0 )
{
trap_piece_triggers[i] SetVisibleToAll();
}
}
}

// ww: removes trigger on successfuly piece placement
trap_piece_deliver_clean_up( ent_trig )
{
self endon( "death" );
self endon( "disconnect" );

self waittill( "trap_piece_returned" );

ent_trig notify( "_piece_placed" );

ent_trig Delete();
}

// ww: hides the zctivation trigger for the trap, but goes through multiple script ents
// SELF == SCRIPT MODEL/TRIGGER
electric_hallway_trap_piece_hide( str_flag )
{
if( !IsDefined( str_flag ) )
{
return;
}

if( self.classname == "trigger_use" )
{
self SetHintString( &"ZOMBIE_NEED_POWER" );
self thread electric_hallway_trap_piece_show( str_flag );
self trigger_off();
}
}

// ww: returns the trigger once the piece has been placed
// SELF == SCRIPT MODEL/TRIGGER
electric_hallway_trap_piece_show( str_flag )
{
if( !IsDefined( str_flag ) )
{
return;
}

flag_wait( str_flag );

self trigger_on();
}

// ww: removes the script brushmodel covers when teh trap has been created
pentagon_trap_cover_remove( ent_cover, str_flag )
{
flag_wait( str_flag );

// TODO: COOL FX TO PLAY WHILE MOVING IT?
ent_cover NotSolid();
ent_cover.fx = Spawn( "script_model", ent_cover.origin );
ent_cover.fx SetModel( "tag_origin" );

ent_cover MoveZ( 48, 1.0, 0.4, 0 );
ent_cover waittill( "movedone" );

ent_cover RotateRoll( ( 360 * RandomIntRange( 4, 10 ) ), 1.2, 0.6, 0 );
PlayFXOnTag( level._effect["poltergeist"], ent_cover.fx, "tag_origin" );
// TODO: COOL ANGRY VOICE HERE? AS IF THE ETHER IS ANGRY YOU PUT THE TRAP TOGETHER
ent_cover waittill( "rotatedone" );

ent_cover Hide();
ent_cover.fx Hide();
ent_cover.fx Delete();
ent_cover Delete();

// ent_cover Hide();
// ent_cover Delete();
}

// WW:add the hud element for the battery so a player knows they have the battery
pentagon_have_battery_hud()
{
self.powercellHud = create_simple_hud( self );

self.powercellHud.foreground = true;
self.powercellHud.sort = 2;
self.powercellHud.hidewheninmenu = false;
self.powercellHud.alignX = "center";
self.powercellHud.alignY = "bottom";
self.powercellHud.horzAlign = "user_right";
self.powercellHud.vertAlign = "user_bottom";
self.powercellHud.x = -200; // ww: started at 256
self.powercellHud.y = 0;

self.powercellHud.alpha = 1;
self.powercellHud setshader( "zom_icon_trap_switch_handle", 32, 32 );

self thread pentagon_remove_hud_on_death();
}

// WW: remove the battery hud element
pentagon_remove_battery_hud()
{
if( IsDefined( self.powercellHud ) )
{
self.powercellHud Destroy();
}
}

// WW: remove the trap piece hud on player death
pentagon_remove_hud_on_death()
{
self endon( "trap_piece_returned" );

self waittill_either( "death", "_zombie_game_over" );

self thread pentagon_remove_battery_hud() ;
}

//-------------------------------------------------------------------------------
// ww: setups the fx exploder for certain vents the first time a quad comes out
quad_first_drop_fx_init()
{
vent_drop_triggers = GetEntArray( "trigger_quad_intro", "targetname" );

// these triggers are one timers, don't thread them or the function dies
for( i = 0; i {
level thread quad_first_drop_fx( vent_drop_triggers[i] );
}
}

quad_first_drop_fx( ent_trigger )
{
if( !IsDefined( ent_trigger.script_int ) )
{
return;
}

exploder_id = ent_trigger.script_int;

ent_trigger waittill( "trigger" );

ent_trigger PlaySound( "evt_pentagon_quad_spawn" );

exploder( exploder_id );
}
zombie_theater_movie_screen.gsc
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

initMovieScreen()
{
//level thread set_up_images();
//level thread lower_movie_screen();
level thread setupCurtains();

level thread movie_reels_init();
}

set_up_images()
{
level.images = [];
level.images = getentarray("screen_image", "targetname");
level.images = mergeSort(level.images);
for (x = 0; x level.images[x] hide();
}

//merge sort for speed and sexiness
mergeSort(current_list)
{
if (current_list.size return current_list;

left = [];
right = [];

middle = current_list.size / 2;
for (x = 0; x left = add_to_array(left, current_list[x]);
for (; x right = add_to_array(right, current_list[x]);

left = mergeSort(left);
right = mergeSort(right);

if (left[left.size - 1].script_int > right[right.size - 1].script_int)
result = merge(left, right);
else
result = append(left, right);
return result;
}

//merge the two arrays
merge(left, right)
{
result = [];

while (left.size > 0 && right.size > 0)
{
if (left[0] {
result = add_to_array(result, left[0]);
left = array_remove_index(left, 0);
}
else
{
result = add_to_array(result, right[0]);
right = array_remove_index(right, 0);
}
}
while (left.size > 0)
result = append(result, left);
while (right.size > 0)
result = append(result, right);

return result;
}

//simple add right array to the end of left array
append(left, right)
{
for (x = 0; x left = add_to_array(left, right[x]);
return left;
}

setupCurtains()
{
flag_wait( "power_on" );
//wait(2);
//level thread moveCurtains("left_curtain");
//level thread moveCurtains("right_curtain");

curtains = getent("theater_curtains", "targetname");
curtains_clip = getent("theater_curtains_clip", "targetname");

curtains_clip notsolid();
curtains_clip connectpaths();
curtains maps\zombie_theater::theater_playanim("curtains_move" );

curtains waittill ("curtains_move_done");

flag_set( "curtains_done" );

level thread lower_movie_screen();

}

moveCurtains(curtent)
{
curtain = getent( curtent, "targetname");
curtorg = curtain.origin;
time = 2;

curtain thread monitorCurtain(curtorg);
curtain connectpaths();
curtain MoveTo( curtain.origin + curtain.script_vector, time, time * 0.25, time * 0.25 );
curtain playsound( "curtain_open" );
}

monitorCurtain(curtorg)
{
clip = getent(self.target, "targetname");

while (IsDefined(clip))
{
if ((abs(curtorg[0] - self.origin[0])) >= 38 )
{
clip connectpaths();
clip NotSolid();
if (IsDefined(clip.target))
clip = getent(clip.target, "targetname");
else
clip = undefined;
}

wait (0.1);
}
}

open_left_curtain()
{
flag_wait( "power_on" );
curtain = GetEnt("left_curtain", "targetname");

if(isDefined(curtain))
{
wait(2);
//curtain waittill("movedone");
curtain_clip = getentarray("left_curtain_clip", "targetname");
for (i = 0; i {
curtain_clip[i] connectpaths();
curtain_clip[i] notsolid();
}
curtain connectpaths();
curtain movex(-300, 2);
}
}

open_right_curtain()
{
flag_wait( "power_on" );
curtain = GetEnt("right_curtain", "targetname");

if(isDefined(curtain))
{
wait(2);
//curtain waittill("movedone");
curtain_clip = getentarray("right_curtain_clip", "targetname");
for (i = 0; i {
curtain_clip[i] connectpaths();
curtain_clip[i] notsolid();
}
curtain connectpaths();
curtain movex(300, 2);
}
}

lower_movie_screen()
{
// flag_wait( "power_on" );
screen = GetEnt("movie_screen", "targetname");

if(isDefined(screen))
{
screen movez(-466, 6);
screen playsound( "evt_screen_lower" );
}
//for (x = 0; x // level.images[x] movez(-466, 6);
//wait (4);
screen waittill ("movedone");

wait (2);

// level notify( "sip" );
clientnotify( "sip" ); // ww: notify talks to zombie_theater_fx.csc to start the projector fxs
// exploder(314); // projection light on
//level thread play_images();
}

play_images()
{
x = 0;
while (1)
{
if (x > level.images.size - 1)
x = 0;
level.images[x] show();
wait(0.1);
level.images[x] hide();
x++;
}
}

// Init the reel triggers
movie_reels_init()
{
// active reel array

// each room will have three places the reel could go
clean_bedroom_reels = GetEntArray( "trigger_movie_reel_clean_bedroom", "targetname" );
bear_bedroom_reels = GetEntArray( "trigger_movie_reel_bear_bedroom", "targetname" );
interrogation_reels = GetEntArray( "trigger_movie_reel_interrogation", "targetname" );
pentagon_reels = GetEntArray( "trigger_movie_reel_pentagon", "targetname" );

// put all the arrays in to a master array
level.reel_trigger_array = [];
level.reel_trigger_array = add_to_array( level.reel_trigger_array, clean_bedroom_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, bear_bedroom_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, interrogation_reels, false );
level.reel_trigger_array = add_to_array( level.reel_trigger_array, pentagon_reels, false );

// randomize the master array. the first three arrays will be chosen for reel placement
level.reel_trigger_array = array_randomize( level.reel_trigger_array );

// now pick one reel out of each of the first three arrays
reel_0 = movie_reels_random( level.reel_trigger_array[0], "ps1" );
reel_1 = movie_reels_random( level.reel_trigger_array[1], "ps2" );
reel_2 = movie_reels_random( level.reel_trigger_array[2], "ps3" );

// combine all the individual reels in to one array
temp_reels_0 = array_merge( clean_bedroom_reels, bear_bedroom_reels );
temp_reels_1 = array_merge( interrogation_reels, pentagon_reels );
all_reels = array_merge( temp_reels_0, temp_reels_1 );

// thread off the movie reel func on all reels. func will hide reels that were not chosen for display
array_thread( all_reels, ::movie_reels );

level thread movie_projector_reel_change();
}

// Randomly choose one of the reels in a reel array for display
movie_reels_random( array_reel_triggers, str_reel )
{
if( !IsDefined( array_reel_triggers ) )
{
return;
}
else if( array_reel_triggers.size {
return;
}
else if( !IsDefined( str_reel ) )
{
return;
}

random_reels = array_randomize( array_reel_triggers );

// grab the first one out of teh random array
random_reels[0].script_string = str_reel; // TODO: THIS WILL HAVE TO BE MADE INTO A SIDE FUNCTION IF WE GET 20-24 VIDEOS
random_reels[0].reel_active = true;
return random_reels[0]; // return the first reel in the array as the one to display

}

// watch the reel to get picked up. the trigger should be targetting a script model
// SELF == TRIGGER
movie_reels()
{
if( !IsDefined( self.target ) )
{
/#
AssertEx( IsDefined( self.target ), "one of the reel triggers missing target" );
#/
return;
}

// define the model being used for the reel
self.reel_model = GetEnt( self.target, "targetname" );

if( !IsDefined( self.reel_active ) )
{
self.reel_active = false;
}

if( IsDefined( self.reel_active ) && self.reel_active == false )
{
// turn off the trigger and hide the model
self.reel_model Hide();
self SetCursorHint( "HINT_NOICON" );
self SetHintString( "" );
self trigger_off();

// end the function
return;
}
else if ( IsDefined( self.reel_active ) && self.reel_active == true )
{
// set the reel model
self.reel_model SetModel( "zombie_theater_reelcase_obj" ); // TODO: SPECIAL MODELS WILL NEED TO BE INPUT AT SOME POINT

// set hint string and cursor image
self SetCursorHint( "HINT_NOICON" );
// self SetHintString( &"ZOMBIE_THEATER_FILM_REEL" ); // ww:removing hing strings
}

// wait for power
flag_wait( "power_on" );

self waittill( "trigger", who );
who PlaySound( "zmb_reel_pickup" );

self.reel_model Hide();
self trigger_off();

// put the reel string on the player that hit the trigger
who.reel = self.script_string;

who thread theater_movie_reel_hud();

}

// Projector trigger watching for a player with a reel
movie_projector_reel_change()
{
screen_struct = getstruct( "struct_theater_screen", "targetname" );
projector_trigger = GetEnt( "trigger_change_projector_reels", "targetname" );

projector_trigger SetCursorHint( "HINT_NOICON" );
//projector_trigger SetHintString( &"ZOMBIE_THEATER_REEL_PROJECTOR" ); // ww:removing hing strings

// just in case the struct is missing the beginning string
if( !IsDefined( screen_struct.script_string ) )
{
screen_struct.script_string = "ps0";
}

while( true )
{
projector_trigger waittill( "trigger", who );

if( IsDefined( who.reel ) && IsString( who.reel ) )
{
clientnotify( who.reel ); // ww: this should be a three digit notify that is set on the reels above

who notify( "reel_set" );

who thread theater_remove_reel_hud();
who thread maps\zombie_theater_amb::play_radio_egg( 2 );
who PlaySound( "zmb_reel_place" );

who.reel = undefined;
wait( 3 );
}
else
{
wait( 0.1 );
}

wait( 0.1 );

}

}

// WW:add the hud element for the reel so a player knows they have it
theater_movie_reel_hud()
{
self.reelHud = create_simple_hud( self );

self.reelHud.foreground = true;
self.reelHud.sort = 2;
self.reelHud.hidewheninmenu = false;
self.reelHud.alignX = "center";
self.reelHud.alignY = "bottom";
self.reelHud.horzAlign = "user_right";
self.reelHud.vertAlign = "user_bottom";
self.reelHud.x = -200;
self.reelHud.y = 0;

self.reelHud.alpha = 1;
self.reelHud setshader( "zom_icon_theater_reel", 32, 32 );

self thread theater_remove_reel_on_death();

}

// WW: remove the battery hud element
theater_remove_reel_hud()
{
if( IsDefined( self.reelHud ) )
{
self.reelHud Destroy();
}
}

// WW: removes hud element if player dies
theater_remove_reel_on_death()
{
self endon( "reel_set" );

self waittill_either( "death", "_zombie_game_over" );

self thread theater_remove_reel_hud();

}

Lay off with the spelling bro, that high standard by which you judge others will one day be the yard stick that is used to judge you. Show some love, it easier than being a hater and more fun :D

It just annoys me a bit. Y'know, being a grammar/spelling nazi and all =)

And it doesn't mean I am hating, the ugh meant more like, "Woah, this is going a little too deep for my likes..."

Peace not war?

Link to comment

Lay off with the spelling bro, that high standard by which you judge others will one day be the yard stick that is used to judge you. Show some love, it easier than being a hater and more fun :D

It just annoys me a bit. Y'know, being a grammar/spelling nazi and all =)

And it doesn't mean I am hating, the ugh meant more like, "Woah, this is going a little too deep for my likes..."

Peace not war?

Haha you must have read my mind :lol: I started my reply to you with something about grammer Nazis, that little voice told me I know better though. :D

I wouldnt worry about going to deep, you wont drown! :lol:

Your right though, PAX bro.

Link to comment

Lay off with the spelling bro, that high standard by which you judge others will one day be the yard stick that is used to judge you. Show some love, it easier than being a hater and more fun :D

It just annoys me a bit. Y'know, being a grammar/spelling nazi and all =)

And it doesn't mean I am hating, the ugh meant more like, "Woah, this is going a little too deep for my likes..."

Peace not war?

Haha you must have read my mind :lol: I started my reply to you with something about grammer Nazis, that little voice told me I know better though. :D

I wouldnt worry about going to deep, you wont drown! :lol:

Your right though, PAX bro.

I dunno. The last time I went too deep, and I almost killed my girlfriend

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Privacy Policy, Code of Conduct, We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. .