• Welcome Guest, The new Modme forums are here! Please visit here for all recommended information.

Answered Spawning model with trigger use

Pepergogo

Well-known member
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:

Code:
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

Member
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:

Code:
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
C#:
struct = struct::get("model_spot", "targetname");
model = Spawn("script_model", struct.origin); //spawn at struct
model SetModel("<model alias>");
model.angles = struct.angles;
 

Pepergogo

Well-known member
#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
C#:
struct = struct::get("model_spot", "targetname");
model = Spawn("script_model", struct.origin); //spawn at struct
model SetModel("<model alias>");
model.angles = struct.angles;
Thanks a lot!
 
Top