Originally Posted by
Loveboy
Can you give me an example for replace the model with new models via script?
OK, here it is:
Before:
After:
And here is a (bad quality) video of the whole gametype working, with solid models:
http://www.youtube.com/watch?v=Vlr4A...ature=youtu.be
It was acheived with a very basic function to delete the existing bombzone model, and replace it with another:
PHP Code:
replaceModels()
{
level.saved_origin = [];
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();
}
}
}
}
}
for( i=0; i < level.saved_origin.size; i++ )
{
replace = spawn( "script_model", level.saved_origin[i] );
replace setModel( "xmodel/vehicle_halftrack_rockets_snow_static" );
}
}
When the bomb explodes, you have to delete the static model, and replace it with a destroyed model (because the script exploders wont work on the new models):
PHP Code:
deleteModel()
{
entitytypes = getentarray();
for( i = 0; i < entitytypes.size; i++ )
{
if( entitytypes[i].classname == "script_model" )
{
if( entitytypes[i].model == "xmodel/vehicle_halftrack_rockets_snow_static" )
{
replaceDestroyed = spawn( "script_model", entitytypes[i].origin );
replaceDestroyed setModel( "xmodel/vehicle_halftrack_rockets_woodland_d_stat" );
entitytypes[i] playsound( "flak88_explode" );
entitytypes[i] delete();
}
}
}
}
Here is a download for the complete SD code with added functions:
DOWNLOAD