UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Mapping => Topic started by: DeletedUser on November 02, 2015, 09:02:48 am

Title: [Tutorial] Dynamic Light
Post by: DeletedUser on November 02, 2015, 09:02:48 am
Dynamic Light Tutorial

(https://i.gyazo.com/a8183689136e8e2e2aa6b93d9f63ee83.gif)

*For the lazy people there is a link a the bottom for the prefab.

Radiant Part:

Step 1:

Right click in the 2d grid to add a rope.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F42GP6xb.png&hash=52c9c388ab18715451bff7cfad5506e041f69e5b)

Step 2:

Place the rope halfway through the ceiling.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FHj179fc.png&hash=6087d030dfa49830e2d74dd7be83fd800fa4de3b)

Step 3:

Right click in the 2d grid again and add a info > null

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FzkovyZK.png&hash=a96142a6da9271fb5f8f535c3f506777a05bc9af)

Step 4:

Place the info_null under the rope.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F2YYHkGU.png&hash=5a5b2efca241bdbd848e4fd2259d1b1441f39dfa)

Step 5:

Select the rope first and then the info_null and press “W” to connect them.

Step 6:

Add a script_model and choose the model “lights_tinhatlamp_on” *It can be any other model but I have chosen to use this one for the example.

Step 7:

Place the script model under the info_null

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FR7X05GK.png&hash=249cc47722a91e39fbce53dcf2079b4ff812c873)

Step 8:

Select the info_null first and then the script_model and press “W” to connect them.

Step 9:

Give the script_model the following kvp:
Code Snippet
Plaintext
"script_noteworthy" "dyn_lamp"

Step 10:

Add a light and place it under the script_model.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F5Fjot1M.png&hash=869301723f071617e8699293b072d0c7bf83eeb3)

Step 11:

Give the light the following kvps:
Code Snippet
Plaintext
"maxmove" "500"
"maxturn" "360"
"targetname" "dyn_light"
"exponent" "1"
"fov_inner" "40"
"fov_outer" "60"
"spawnflags" "22"
"def" "light_point_linear"
"radius" "400"
"_color" "1 1 1"
"intensity" "2"

*Change the spotlight specific settings to whatever you like. But make sure u don’t change the spawnflags.

Step 12:

Add a info_null and place it under/inside the light. Now select the light and then the info_null and press “W” to connect them.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FzTRD2OI.png&hash=620c2ec72f5fa26eee0a37ff8141834ba6028193)

And that’s it for the radiant part. Now we only need to add a simple script to make this all work.

Scripting Part:

Step 1:

Add the following line in your “nazi_zombie_mapname.gsc” and place in under DLC3_FX():
Code Snippet
Plaintext
level._effect["chair_light_fx"] = loadfx("env/light/fx_glow_hanginglamp");

Step 2:

Add the following line under maps\_zombiemode::main():
Code Snippet
Plaintext
thread dynamic_light();

Step 3:

Add the following code at the bottom:
Code Snippet
Plaintext
dynamic_light()
{
lamp = getent("dyn_lamp","script_noteworthy");
light = getent("dyn_light","targetname");

if(!isdefined(light))
return;

light linkto(lamp);

fx = spawn("script_model", lamp.origin);
fx.angles = (90,0,0);
fx setmodel("tag_origin");
fx linkto(lamp);
playfxontag(level._effect["chair_light_fx"],fx,"tag_origin");

while(1)
{
lamp physicslaunch ( lamp.origin, (randomintrange(-20,20),randomintrange(-20,20),randomintrange(-20,20)) );
wait(randomfloatrange(10,15));
}
}

Step 4:

Add the following line to your “mod.csv”:
Code Snippet
Plaintext
fx,fx,env/light/fx_glow_hanginglamp

And that's it!

Update:

If you want to have multiple lights, use this code instead:

Scripting Part Multiple Lights:

Step 1:

Add the following line in your “nazi_zombie_mapname.gsc” and place in under DLC3_FX():
Code Snippet
Plaintext
level._effect["chair_light_fx"] = loadfx("env/light/fx_glow_hanginglamp");

Step 2:

Add the following line under maps\_zombiemode::main():
Code Snippet
Plaintext
lamps = getentarray("dyn_lamp","script_noteworthy");
array_thread(lamps,::dynamic_light);

Step 3:

Add the following code at the bottom:
Code Snippet
Plaintext
dynamic_light()
{
light = get_array_of_closest(self.origin,getEntArray("dyn_light","targetname"))[0];

if(!isdefined(light))
return;

light linkto(self);

fx = spawn("script_model", self.origin);
fx.angles = (90,0,0);
fx setmodel("tag_origin");
fx linkto(self);
playfxontag(level._effect["chair_light_fx"],fx,"tag_origin");

while(1)
{
self physicslaunch ( self.origin, (randomintrange(-20,20),randomintrange(-20,20),randomintrange(-20,20)) );
wait(randomfloatrange(10,15));
}
}

Step 4:

Add the following line to your “mod.csv”:
Code Snippet
Plaintext
fx,fx,env/light/fx_glow_hanginglamp

And that's for multiple lights.

Prefab

www.mediafire.com

~RDV
Title: Re: [Tutorial] Dynamic Light
Post by: ElTitoPricus on November 02, 2015, 09:23:32 am
Damn Good Job
Even me can understand it
Title: Re: [Tutorial] Dynamic Light
Post by: TheScotchGuy on November 02, 2015, 09:44:38 am
thank you so fekin much dude, iv been waiting like a whole year to find out how this is done! Worked first try too, really clear tut, nice work bro and thanks again.! (https://i.gyazo.com/dbb6099914ddf404cbd49058446ad581.gif)
Title: Re: [Tutorial] Dynamic Light
Post by: c.h.n on November 02, 2015, 11:17:10 am
Great tutorial.
Title: Re: [Tutorial] Dynamic Light
Post by: pcmodder on November 02, 2015, 01:11:47 pm
Thanks very much this is very helpful for many Modders.  One question is this 1 entity or 2 for the limits ?   Good work  :rainbow:
Title: Re: [Tutorial] Dynamic Light
Post by: DeletedUser on November 02, 2015, 01:18:18 pm
There is a extra space in the:
Code Snippet
Plaintext
fx, fx,env/light/fx_glow_hanginglamp

It should be like this:
Code Snippet
Plaintext
fx,fx,env/light/fx_glow_hanginglamp

Also i will make a update on having more then 1 light. Not sure what the limit is yet. But i'll find out.
Title: Re: [Tutorial] Dynamic Light
Post by: RadimaX on November 02, 2015, 04:10:10 pm
thank you so fekin much dude, iv been waiting like a whole year to find out how this is done!

Scotch put 50 of them in a room and throw a granade for a Zombie Disco
Title: Re: [Tutorial] Dynamic Light
Post by: Deer2014 on December 25, 2015, 03:13:09 pm
Hi guys,

Can I placed more dynamic light? I mean in other rooms, corridors etc. How?
I tried to copy (light, info_null, scipting_model) but lost the glow effect and rope dancing animation.
Title: Re: [Tutorial] Dynamic Light
Post by: WhiteDevil on December 25, 2015, 04:05:23 pm
Nice tutorial!
Title: Re: [Tutorial] Dynamic Light
Post by: DeletedUser on December 25, 2015, 05:20:10 pm
Hi guys,

Can I placed more dynamic light? I mean in other rooms, corridors etc. How?
I tried to copy (light, info_null, scipting_model) but lost the glow effect and rope dancing animation.

Ill update the op soon with script for multiple lights. So stay tuned!

Double Post Merge: December 26, 2015, 09:55:06 am
Updated OP!
Title: Re: [Tutorial] Dynamic Light
Post by: Deer2014 on December 26, 2015, 02:25:47 pm
Ill update the op soon with script for multiple lights. So stay tuned!

Double Post Merge: December 26, 2015, 09:55:06 am
Updated OP!

Thanks RDV. Perfect! It works for me.
Title: Re: [Tutorial] Dynamic Light
Post by: InFInIX on January 07, 2016, 06:48:52 am
Nice tut will upload a vid to proof it works with multiple lights :P :D
Title: Re: [Tutorial] Dynamic Light
Post by: madsniper124 on April 10, 2016, 09:13:40 pm
When the ceiling light moves, there's two spots where the light is. There is the light that is still shining on the ground, and the light at where ever the ceiling light is pointing at. How do I fix this?
Title: Re: [Tutorial] Dynamic Light
Post by: bigbengy on June 07, 2017, 12:11:13 pm
you, SIR are a god! aprefab for the lazy people. I'm sold! gonna d/l this right now thank's ;D ;D ;D
Title: Re: [Tutorial] Dynamic Light
Post by: misiek6313 on September 15, 2017, 05:57:18 am
Hi. I have question how make light source on model of any lamp or on light corona. When I make light in COD4 items are lighted but I can't see source of light ( in gtkRadiant it is name Corona of light but here I don't see this)
Title: Re: [Tutorial] Dynamic Light
Post by: kitos on September 17, 2017, 05:52:24 pm
and how can I do danger yellow lights?


that the yellow lights are spinning in a circle?
Title: Re: [Tutorial] Dynamic Light
Post by: HomeroGoku on June 13, 2019, 11:12:37 pm
Bad syntax Error
Title: Re: [Tutorial] Dynamic Light
Post by: GimmCity on August 28, 2020, 03:14:55 am
is there a way to make the lights show when i turn on the power or a trigger  with this dyn_lights??