Modme Forums
Menu:

Spawning an xmodel.

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: gunrock12
Might be a silly question but how does one spawn a xmodel at a certain position?
because spawn_model (''xmodel/veh_t7_mil_vtol_fighter_nrc ''); dosen't work in this current engine.

What i'm doing is spawn a nrc fighter jet at one point fly to a struct then when it reaches it the jet would
delete itself.


ModmeBot:

Reply By: tom5300

gunrock12
Might be a silly question but how does one spawn a xmodel at a certain position? because spawn_model (''xmodel/veh_t7_mil_vtol_fighter_nrc ''); dosen't work in this current engine. What i'm doing is spawn a nrc fighter jet at one point fly to a struct then when it reaches it the jet would delete itself.


jet = spawn( "script_model", (0,0,0) ); //spawns a script_model at specified origin (0,0,0)
jet SetModel( "xmodel/veh_t7_mil_vtol_fighter_nrc" ); //sets model to whatever this is


ModmeBot:

Reply By: mathfag

What you need to type in instead of "plane model" is the name of the asset in APE. It's probably just "veh_t7_mil_vtol_fighter_nrc"
you also have to add a line to your zone file.

xmodel,plane model

#precache( "model", "plane model");

function fly_plane()
{
str_start = struct::get("plane_start", "targetname");
str_end = struct::get("plane_end", "targetname");

plane = Spawn("script_model",str_start.origin);
plane.angles = str_start.angles;
plane SetModel("plane model");

plane MoveTo(str_end.origin,15);
wait 15;
plane Delete();
}


ModmeBot:

Reply By: Harry Bo21
actually spawn_model "does" work, your just missing the name space

#using scripts\shared\util_shared;

e_model = util::spawn_model( "tag_origin", v_origin );