Originally Posted by
Loveboy
******* script compile error *******
bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 166)
spawnModel( name , pos , angles );
*
************************************
Let me correct serthy:
PHP Code:
spawnModel( name , pos , angles )
{
model = spawn( "script_model" , pos );
model.angles = angles;
model setModel( name );
return model;
}
loveboy()
{
precacheModel( "xmodel/vehicle_stuka_flying" );
model = spawnModel( "xmodel/vehicle_stuka_flying" , ( 1 , 2 , 3 ) , ( 0 , 90 , 0 ) );
}
Basically, DON'T try to call the spawnModel() function without filling in the details: 1. the model, 2, the origin, and 3. the angles. To stop that happening, I would add some checks for such details:
PHP Code:
spawnModel( model, origin, angles )
{
if( !isdefined(model) || !isdefined(origin) )
return undefined;
if( !isdefined(angles) )
angles = (0,0,0);
spawn = spawn ("script_model",(0,0,0));
spawn.origin = origin;
spawn setmodel (model);
spawn.angles = angles;
return spawn;
}
That will stop the runtime error if you miss out the details, but the model wont spawn.
HISTORICAL NOTE -
The spawnModel() was first used in a Call of Duty mod by PoolMaster in his "PoolMaster Mod ver 1.3" for COD1 circa December 2003. But it was made famous by Bell in his AWE mod for COD1 and COD: UO circa 2004 and subsequent years. But Bell got the function from PoolMaster with permission, so correctly speaking, it was PoolMaster who came up with the function in the form it took in AWE. All that was done before the COD1 mod tools came out. We had no help from the developers and pretty much all modding was done by discovering what was possible and passing on the info on the IWNation modding forums. Golden Days of Modding! I miss them.