-
setmodel
hello guys, i want to ask, how you can precache a model, give it a origin and give it a position and an angle and then set the model.
I already know precacheModel("xmodel/example");
but i must give the model now a position and angle and origin where it will be set the model.
somebody know the script?
-
PHP Code:
spawnModel(name, origin, angles)
{
model = spawn("script_model", origin);
model.angles = angles;
model setModel(name);
return model;
}
You can change the origin later with:
PHP Code:
model moveTo(someNewOrigin, 1); // moves to someNewOrigin in 1 seconds
model.origin = (1,2,3); // moves model instantly to new origin
-
-
1 Attachment(s)
-
error:
Code:
******* script compile error *******
bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 170)
{
*
************************************
script:
Code:
loveboy()
{
spawnModel(name, origin, angles)
{ // line 171
model = spawn("script_model", origin);
model.angles = angles;
model setModel(vehicle_stuka_flying);
return model;
}
}
sorry i mean line 170*
-
You need to write that function next to other functions and call it like: spawnModel("xmodel/...", (1,2,3), (3,2,1));
-
next error:
Code:
******* script compile error *******
uninitialised variable 'origin': (file 'maps/mp/gametypes/_nuke.gsc', line 171)
model = spawn("script_model", origin);
*
************************************
script:
Code:
loveboy()
{
spawnModel("xmodel/vehicle_stuka_flying", (1,2,3), (0,90,0));
{
model = spawn("script_model", origin);
model.angles = angles;
model setModel(vehicle_stuka_flying);
return model;
}
}
-
Quote:
Originally Posted by
Loveboy
Code:
loveboy()
{
spawnModel("xmodel/vehicle_stuka_flying", (1,2,3), (0,90,0));
{
model = spawn("script_model", origin);
model.angles = angles;
model setModel(vehicle_stuka_flying);
return model;
}
}
WTF dude, you should really start with the basics of coding...
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 ) );
}
-
******* script compile error *******
bad syntax: (file 'maps/mp/gametypes/_nuke.gsc', line 166)
spawnModel( name , pos , angles );
*
************************************
-
Quote:
Originally Posted by
serthy
WTF dude, you should really start with the basics of coding...
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 ) );
}
LMAO @serthy. You've made the kind of mistake I usually make - you've told LoveBoy to start with the basics and you then went and put a semi-colon (;) on your function bracket.