currently i am working on a new map and found in the blackout map (inclued in the compiletools) the Flickering Light
i tryd to inclued it but failed hard with it.
someone can explain how to get it work?
here is the code i found from blackout_code.gsc
Code: Select all
sleepy_shack()
{
shack_guys = getentarray( "shack_guy", "targetname" );
array_thread( shack_guys, ::spawn_ai );
shack_light = getent( "shack_light", "targetname" );
intensity = shack_light getLightIntensity();
shack_light setLightIntensity( 0 );
flag_wait( "second_shacks" );
flag_wait( "high_alert" );
wait( 1.5 );
sleep_alert_trigger = getent( "sleep_alert_trigger", "targetname" );
if ( level.player istouching( sleep_alert_trigger ) )
{
// don't flick the lights on if the player is standing in a place that reveals our lack of light flicking animation
return;
}
// light flickers on
/*
shack_light setLightIntensity( intensity );
wait( 0.3 );
shack_light setLightIntensity( 0 );
wait( 0.01 );
shack_light setLightIntensity( intensity );
wait( 0.2 );
shack_light setLightIntensity( 0 );
wait( 1 );
timer = 2;
timer *= 20;
for ( i = 0; i < timer; i++ )
{
new_intensity = intensity * ( 1 / ( timer - i ) );
new_intensity *= randomfloatrange( 0.3, 1.7 );
shack_light setLightIntensity( new_intensity );
wait( 0.05 );
}
*/
timer = 2;
timer *= 20;
for ( i = 0; i < timer; i++ )
{
new_intensity = intensity * ( 1 / ( timer - i ) );
new_intensity *= randomfloatrange( 0.3, 1.7 );
shack_light setLightIntensity( new_intensity );
wait( 0.05 );
}
shack_light setLightIntensity( intensity );
}
best regards