PHP Code:
setupSolidSilo()
{
bombzones = getentarray( "bombzone", "targetname" );
for( i = 0; i < bombzones.size; i++ )
{
bombzone = bombzones[i];
if( isdefined( bombzone.script_label ) )
{
if( bombzone.script_label == "B" || bombzone.script_label == "b" )
{
solid = spawn( "trigger_radius", bombzone.origin+(80,30,-10), 0, 200, 70 );
solid setContents( 1 );
solid = spawn( "trigger_radius", bombzone.origin+(-80,30,-10), 0, 200, 70 );
solid setContents( 1 );
solid = spawn( "trigger_radius", bombzone.origin+(0,-80,-10), 0, 200, 70 );
solid setContents( 1 );
solid = spawn( "trigger_radius", bombzone.origin+(0,80,-10), 0, 200, 70 );
solid setContents( 1 );
}
}
}
}
deleteModel()
{
entitytypes = getentarray();
for( i = 0; i < entitytypes.size; i++ )
{
if( entitytypes[i].classname == "script_model" )
{
if( entitytypes[i].model == "xmodel/static_mp_supplies" )
{
replaceDestroyed = spawn( "script_model", entitytypes[i].origin );
replaceDestroyed setModel( "xmodel/static_mp_supplies_x" );
entitytypes[i] playsound( "flak88_explode" );
entitytypes[i] delete();
}
}
}
}
replaceModels()
{
level.saved_origin = [];
level.saved_modelType = [];
// delete existing bombzone models
entitytypes = getentarray();
for( i = 0; i < entitytypes.size; i++ )
{
if( isdefined( entitytypes[i].script_gameobjectname ) )
{
gameobjectnames = strtok( entitytypes[i].script_gameobjectname, " " );
for( k = 0; k < gameobjectnames.size; k++ )
{
if( gameobjectnames[k] == "bombzone" )
{
if( entitytypes[i].classname == "script_model" )
{
level.saved_origin[level.saved_origin.size] = entitytypes[i].origin;
entitytypes[i] delete();
}
}
}
}
}
// delete bombzone clips
entitytypes = getentarray();
for( i = 0; i < entitytypes.size; i++ )
{
if( isdefined( entitytypes[i].script_gameobjectname ) )
{
gameobjectnames = strtok( entitytypes[i].script_gameobjectname, " " );
for( k = 0; k < gameobjectnames.size; k++ )
{
if( gameobjectnames[k] == "bombzone" )
{
if( entitytypes[i].classname == "script_brushmodel" )
{
if( level.script == "mp_farmhouse" )
{
entitytypes[i] notSolid();
thread setupSolidSilo();
}
else
entitytypes[i] delete();
}
}
}
}
}
// spawn World at War bombzone model at target point A and make solid
spawnpoint = FindGround( level.saved_origin[0] );
replace = spawn( "script_model", spawnpoint );
replace setModel( "xmodel/static_mp_supplies" );
replace.angles = (-90,0,0);
solid = spawn( "trigger_radius", spawnpoint, 0, 50, 80 );
solid setContents( 1 );
bombzones = getentarray( "bombzone", "targetname" );
for( i = 0; i < bombzones.size; i++ )
{
bombzone = bombzones[i];
if( isdefined( bombzone.script_label ) )
if( bombzone.script_label == "A" || bombzone.script_label == "a" )
bombzone.origin = replace.origin+(0,0,55);
}
level.saved_origin = remove_element_from_array( level.saved_origin, level.saved_origin[0] );
// spawn World at War bombzone model at target point B and make solid
if( level.script == "mp_farmhouse" )
{
bombzones = getentarray( "bombzone", "targetname" );
for( i = 0; i < bombzones.size; i++ )
{
bombzone = bombzones[i];
if( isdefined( bombzone.script_label ) )
{
if( bombzone.script_label == "B" || bombzone.script_label == "b" )
{
replace = spawn( "script_model", (-2556, 950, -45) );
replace setModel( "xmodel/static_mp_supplies" );
replace.angles = (-90,0,0);
solid = spawn( "trigger_radius", replace.origin, 0, 50, 80 );
solid setContents( 1 );
bombzone.origin = replace.origin+(0,0,55);
}
}
}
}
else
{
spawnpoint = level.saved_origin[ randomint( level.saved_origin.size ) ];
spawn = FindGround( spawnpoint );
replace = spawn( "script_model", spawn );
replace setModel( "xmodel/static_mp_supplies" );
replace.angles = (-90,0,0);
solid = spawn( "trigger_radius", spawn, 0, 50, 70 );
solid setContents( 1 );
bombzones = getentarray( "bombzone", "targetname" );
for( i = 0; i < bombzones.size; i++ )
{
bombzone = bombzones[i];
if( isdefined( bombzone.script_label ) )
if( bombzone.script_label == "B" || bombzone.script_label == "b" )
bombzone.origin = replace.origin+(0,0,55);
}
}
}
FindGround( position )
{
trace = bulletTrace( position+(0,0,10), position+(0,0,-10000), false, undefined );
ground = trace["position"];
return ground;
}
remove_element_from_array( array, element )
{
if( !isdefined( element ) )
return( array );
newarray = [];
for( i = 0; i < array.size; i++ )
{
if( array[ i ] == element )
continue;
newarray[ newarray.size ] = array[ i ];
}
return( newarray );
}