Modme Forums

Spawning model with trigger use

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


Pepergogo:

Hi
So yeah, I was wondering if is possible to spawn a model using a "trigger_use"?

I have a sound and it activates when you press the trigger, and I want to also spawn a model at the same time. Here's my script:

function radio_play_sound(trigger_string, sound_string)
{
    trig = getEnt(trigger_string, "targetname");
    //trig setHintString("Press &&1 to enable radio");
    trig waittill("trigger", player);
    player playsound(sound_string);
    level.radio_playing = true;
    wait(SoundGetPlaybackTime(sound_string)*0.001);
    level.radio_playing = false;
}


Spiki:

Hi
So yeah, I was wondering if is possible to spawn a model using a "trigger_use"?

I have a sound and it activates when you press the trigger, and I want to also spawn a model at the same time. Here's my script:

function radio_play_sound(trigger_string, sound_string)
{
    trig = getEnt(trigger_string, "targetname");
    //trig setHintString("Press &&1 to enable radio");
    trig waittill("trigger", player);
    player playsound(sound_string);
    level.radio_playing = true;
    wait(SoundGetPlaybackTime(sound_string)*0.001);
    level.radio_playing = false;
}


#precache( "model", "<model alias>");
//at the top. also add to zone unless you have this model in the map already

after trig. put down a script_struct where you want the model to spawn. you can give it the kvp "model" to see how it would look ingame
struct = struct::get("model_spot", "targetname");
model = Spawn("script_model", struct.origin); //spawn at struct
model SetModel("&lt;model alias&gt;");
model.angles = struct.angles;


Pepergogo:

#precache( "model", "<model alias>");
//at the top. also add to zone unless you have this model in the map already

after trig. put down a script_struct where you want the model to spawn. you can give it the kvp "model" to see how it would look ingame
struct = struct::get("model_spot", "targetname");
model = Spawn("script_model", struct.origin); //spawn at struct
model SetModel("&lt;model alias&gt;");
model.angles = struct.angles;

Thanks a lot!