Modme Forums

REPLACE MODEL WHEN POWER COMES ON.

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


Dedrix:

Looking for a way to replace a lightbulb model for an emissive one when the power comes on ( so the lighting looks more convincing ),
I have tried solving this myself since it seems really simple but I honestly have no clue what I'm doing.
If anyone can help me out it would be much appreciated.
( this is what I came up with just to let y'all see where I'm coming from)

level flag::wait_till("initial_blackscreen_passed");
level.model_off = GetEnt("light_off", "targetname"); //identify off
level.model_on = GetEnt("light_on", "targetname"); //identify on
level.model_on hide(); //hide on
level flag::wait_till( "power_on" ); //wait for power on
level.model_on show(); //show on
level.model_off delete(); //delete off


Spiki:

Looking for a way to replace a lightbulb model for an emissive one when the power comes on ( so the lighting looks more convincing ),
I have tried solving this myself since it seems really simple but I honestly have no clue what I'm doing.
If anyone can help me out it would be much appreciated.
( this is what I came up with just to let y'all see where I'm coming from)

level flag::wait_till("initial_blackscreen_passed");
level.model_off = GetEnt("light_off", "targetname"); //identify off
level.model_on = GetEnt("light_on", "targetname"); //identify on
level.model_on hide(); //hide on
level flag::wait_till( "power_on" ); //wait for power on
level.model_on show(); //show on
level.model_off delete(); //delete off

so whats the problem?


Dedrix:

so whats the problem?

It doesn't do anything. Does this work for you or something?😅


Spiki:

it should be fine. do you have multiple lights?

if yes it should be:

level waittill("initial_blackscreen_passed");
models_off = GetEntArray("light_off", "targetname"); //identify off
models_on = GetEntArray("light_on", "targetname"); //identify on

foreach(light in models_on)
{
light Hide();
}

level waittill("power_on");

foreach(light in models_on)
{
light Show();
}
foreach(light in models_off)
{
light Delete();
}

didnt try but is fine


the_bibba_boy:

Looking for a way to replace a lightbulb model for an emissive one when the power comes on ( so the lighting looks more convincing ),
I have tried solving this myself since it seems really simple but I honestly have no clue what I'm doing.
If anyone can help me out it would be much appreciated.
( this is what I came up with just to let y'all see where I'm coming from)

level flag::wait_till("initial_blackscreen_passed");
level.model_off = GetEnt("light_off", "targetname"); //identify off
level.model_on = GetEnt("light_on", "targetname"); //identify on
level.model_on hide(); //hide on
level flag::wait_till( "power_on" ); //wait for power on
level.model_on show(); //show on
level.model_off delete(); //delete off

Are you trying to turn on a light entity?


Dedrix:

Are you trying to turn on a light entity?

Unfortunately no, there are plenty of tutorials for a power light entity. I'm trying to have some "emissive models" replace "non emissive models" when the power comes on, That's all
[ Have a model be replaced with another, when the power comes on ]


Spiki:

post your whole script. my thing should be fine


Dedrix:

it should be fine. do you have multiple lights?

if yes it should be:
level waittill("initial_blackscreen_passed");
models_off = GetEntArray("light_off", "targetname"); //identify off
models_on = GetEntArray("light_on", "targetname"); //identify on

foreach(light in models_on)
{
light Hide();
}

level waittill("power_on");

foreach(light in models_on)
{
light Show();
}
foreach(light in models_off)
{
light Delete();
}

didnt try but is fine

Hey finally got around to putting this in an it works to perfection. Thanks Spiki!