UGX-Mods
Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: Marsvinking on May 19, 2015, 11:34:13 am
-
Is this possible in COD WAW ?
Blackout.GSC
#include maps\blackout_code;
// ...
main()
{
// ...
wait( 5 );
setsaveddvar( "cg_cinematicFullScreen", "0" );
for ( ;; )
{
flag_wait( "hut_tv_on" );
thread loop_cinematic();
flag_waitopen( "hut_tv_on" );
level notify( "stop_cinematic" );
StopCinematicInGame();
}
}
loop_cinematic()
{
level endon( "stop_cinematic" );
for ( ;; )
{
if ( getdvar("ps3Game") == "true" )
CinematicInGameLoopFromFastfile( "asad_speech_180" );
else
CinematicInGameLoopResident( "asad_speech_180" );
wait 5;
while ( IsCinematicPlaying() )
wait 1;
}
}
walking_the_stream()
{
// ...
thread hut_tv();
// ...
}
blackout_code.gsc
hut_tv()
{
// tv turns off when it gets shot
thread bbc_voice();
light = getent( "tv_light", "targetname" );
light thread maps\_lights::television();
// did the tv get shot?
wait_for_targetname_trigger( "tv_trigger" );
light notify( "light_off" );
light setLightIntensity( 0 );
level.bbc_voice stopsounds();
level.bbc_voice notify( "stopsounds" );
wait( 0.05 );
level.bbc_voice delete();
}
blackout.map
Code:
// entity 1446
{
"_color" "0.000000 1.000000 1.000000"
"script_flag" "tv_movie"
"targetname" "flag_set_touching"
"classname" "trigger_multiple"
// brush 0
{
( -13637.5 -8203.5 -26 ) ( -13952.5 -8320.5 -26 ) ( -13880 -8515.5 -26 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13871 -8515.5 75 ) ( -13943.5 -8320.5 75 ) ( -13628.5 -8203.5 75 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13865 -8488.5 32 ) ( -13550 -8371.5 32 ) ( -13550 -8371.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13575 -8397.5 32 ) ( -13647.5 -8202.5 32 ) ( -13647.5 -8202.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13616.5 -8203.5 32 ) ( -13931.5 -8320.5 32 ) ( -13931.5 -8320.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13712 -8449 75 ) ( -13715 -8441 75 ) ( -13712 -8449 107 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
}
// brush 1
{
( -13637.5 -8203.5 -26 ) ( -13952.5 -8320.5 -26 ) ( -13880 -8515.5 -26 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13871 -8515.5 75 ) ( -13943.5 -8320.5 75 ) ( -13628.5 -8203.5 75 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13864 -8502.5 32 ) ( -13549 -8385.5 32 ) ( -13549 -8385.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13616.5 -8203.5 32 ) ( -13931.5 -8320.5 32 ) ( -13931.5 -8320.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13931.5 -8320.5 32 ) ( -13859 -8515.5 32 ) ( -13859 -8515.5 16 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13715 -8441 75 ) ( -13712 -8449 75 ) ( -13712 -8449 107 ) flag 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
}
}
// entity 3376
{
"_color" "0.000000 1.000000 1.000000"
"script_flag" "hut_tv_on"
"targetname" "flag_set_touching"
"classname" "trigger_multiple"
// brush 0
{
( -13613.939 -8259.5713 -26 ) ( -13928.939 -8376.5713 -26 ) ( -13856.439 -8571.5713 -26 ) flag 64 64 23.560547 56.071289 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13847.439 -8571.5713 75 ) ( -13919.939 -8376.5713 75 ) ( -13604.939 -8259.5713 75 ) flag 64 64 23.560547 56.071289 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13910.8 -8605.2002 -26 ) ( -13910.8 -8605.2002 75 ) ( -13575.4 -8451.4004 75 ) flag 64 64 23.560547 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13558.2 -7974.6006 75 ) ( -13558.2 -7974.6006 -26 ) ( -13549 -8412.4004 -26 ) flag 64 64 -56.071289 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13566.2 -7984.2002 -26 ) ( -13566.2 -7984.2002 75 ) ( -13977 -8290 75 ) flag 64 64 23.560547 0 0 0 lightmap_gray 16384 16384 0 0 0 0
( -13910.8 -8605.2002 75 ) ( -13910.8 -8605.2002 -26 ) ( -13995.4 -8320.4004 -26 ) flag 64 64 -56.071289 0 0 0 lightmap_gray 16384 16384 0 0 0 0
}
}
model used: com_tv1_cinematic
it has a tag_origin and a tag_fx, moreover there are two mesh groups (second mesh is the screen surface)
_interactive_objects.gsc
Code:
main()
{
//...
tv_array = getentarray( "interactive_tv", "targetname" );
// precaching etc.
array_thread( getentarray( "interactive_tv", "targetname" ), ::tv_logic );
// ...
}
tv_logic()
{
self setcandamage( true );
self.damagemodel = undefined;
self.offmodel = undefined;
self.damagemodel = "com_tv2_d";
self.offmodel = "com_tv2";
self.onmodel = "com_tv2_testpattern";
if ( issubstr( self.model, "1" ) )
{
self.offmodel = "com_tv1";
self.onmodel = "com_tv1_testpattern";
}
self.usetrig = getent( self.target, "targetname" );
self.usetrig usetriggerrequirelookat();
self.usetrig setcursorhint( "HINT_NOICON" );
array = get_array_of_closest( self.origin, level.tv_lite_array, undefined, undefined, 64 );
if ( array.size )
{
self.lite = array[ 0 ];
level.tv_lite_array = array_remove( level.tv_lite_array, self.lite );
self.liteintensity = self.lite getLightIntensity();
}
self thread tv_damage();
self thread tv_off();
}
tv_off()
{
self.usetrig endon( "death" );
while ( 1 )
{
wait .2;
self.usetrig waittill( "trigger" );
// it would be nice to play a sound here
self notify( "off" );
if ( self.model == self.offmodel )
{
self setmodel( self.onmodel );
if ( isdefined( self.lite ) )
self.lite setLightIntensity( self.liteintensity );
}
else
{
self setmodel( self.offmodel );
if ( isdefined( self.lite ) )
self.lite setLightIntensity( 0 );
}
}
}
tv_damage()
{
for ( ;; )
{
self waittill( "damage", damage, other, direction_vec, P, type );
if ( flag( "no_ai_tv_damage" ) )
{
if ( !isalive( other ) )
continue;
if ( other != level.player )
continue;
}
break;
}
if ( isdefined( level.tvhook ) )
[[ level.tvhook ]]();
self notify( "off" );
self.usetrig notify( "death" );
self setmodel( self.damagemodel );
if ( isdefined( self.lite ) )
self.lite setLightIntensity( 0 );
playfxontag( level.breakables_fx[ "tv_explode" ], self, "tag_fx" );
self playsound( "tv_shot_burst" );
self.usetrig delete();
}
Is this possible in COD WAW ?
there are 3 different models, "onmodel", "offmodel" and "damagemodel"
in front of the screen is a trigger_damage, which is used to switch to the destroyed tv model when the player applies damage.
a trigger_use which requires lookat is used to allow the player to turn the tv on and off.
there's also a scripted light involved to make the tv gleam more realistic.
3 trigger_multiple are placed surrounding the house with the tv. they set two script flags to activate the tv logic (on, off, destroy and cinematic playback).
CinematicInGameLoopResident( "asad_speech_180" ); plays the main\video\asad_speech_180.bik on the tv screen. you may look up the cinematic functions in the script docs: http://www.zeroy.com/script/ (http://www.zeroy.com/script/)
it looks ingame like the cinematic video is mapped onto the screen mesh of the tv model. so it's apprently hardcoded for the material name "cinematic_3d", meaning that the model you want to play the cinematic on has to have a material called "cinematic_3d" applied where you want the video.
as you can't call the cinematic functions on an entity, it's apprently impossible to play more than 1 video at the same time (you can play one video on one or more models but not 2 or more different videos). it might be possible to scale the material in a way, that only the upper left part shows for instance. for the next screen you create another model with the right upper part of the cinematic_3d material on it. it should look like if different videos were playing.
to view and convert Bink (*.bik) videos, get the free RAD Video Tools:
http://www.radgametools.com/bnkdown.htm (http://www.radgametools.com/bnkdown.htm)
I know this is possible in COD 4 atleast
-
well cod 4 is usually the same as cod 5 when it comes to certai. things, there might need adjusting but none the less you should try it and report back