lophyte@Posted: Mon Aug 09, 2004 11:44 pm :
SWINGING LIGHTS
By: lophyte <lophyteNO@SPAMgmail.com>

Special thanks to Unoid for helping me with figuring out how to make a swinging light. It turns out its actually quite easy.

Making sure nothing is selected, right click on the grid and go to env, then env_swinglight_long_wbulbs_fixed. This creates a light fixture for us to work with. In the Z window, raise it so that the top touches the ceiling. Go into the Entity Properties window for the env, and set the name to something shorter like "swinglight_1".

This is where we create our lights. Right click on the grid and select light. Go into the Entity Properties window for the light, and click the "Model..." button. In the model browser, select base/models/mapobjects/lights/florescent_bulb.ase and click OK.

Note: if the model doesn't show up in the grid and the light stays as a box, clone it and delete the original.

Again, in the Entity Properties for our light, add key "bind", with the name of the env as the value. Then add key "bindToJoint", and value "bone5". Now clone this light, and line them both up directly under the fixture.

Image


Now fire up the game and start shooting at your light - it will jump around!

OPTIONAL: Infinitely Swinging Light

If you'd like to add a light that swings back and forth and never stops, this requires a little bit of scripting. Create a mover by right clicking on the grid, going to func, and selecting func_mover. In the Entity Properties, give the mover a descriptive name, ie "slight_mover_1".

Select the env light fixture, and go into the Entity Properties. Add a key "bind", with the value being the name you gave the mover. Now create a file in the same folder as your map, with the same name, and a .script extension (ie, if your map is called swinginglights.map, the script file shoule be called swinginglights.script)

Open up the script file, and add this simple piece of code:

Code:
void main() {
          $slight_mover_1.sway(0, 0, '20 0 0');
}


EDIT: Apologies, I'm an idiot. The first value in sway() seems to be the time it takes before causing the mover to sway again, ie it swings once, waits that amount of time (in milliseconds), then swings again. 50 looks nice with a rotation of 20. Play around with these values to see what they do, but definitely don't leave the first one at 0 otherwise your light won't swing.

Of course, you'll want to change slight_mover_1 to whatever you named your mover entity. As for the number values, take a look at the command reference for a more detailed description. For our purposes, we just need to look at the '20 0 0': this causes the light to sway on a certain axis. The first number is x, the second is y, and the third is z. Play around with these values to find out how they affect your light.


That's all! Compile your map and fire it up in DOOM, and all should be well. Suggestions, comments and feedback welcome.


- lophyte



themadtux@Posted: Tue Aug 10, 2004 12:13 am :
Ok this is a pretty cool tutorial and something I've wanted to know about. Well I get the following after following the tutorial

"ERROR: idAFEntity_Base::LoadAF: Couldn't load af file 'env_swinglight_long_fixed.af' on entity 'swingilight_1'

Thoughts?

Thanks..

-Jason



MisterCrow@Posted: Tue Aug 10, 2004 12:49 am :
Hmm, this doesn't work at all for me...few things:

1) When I make the bulbs, the light sticks at the far LEFT of the bulbs, not in the middle. I can change the center sure, but the actual box that represents the light is still on the side and not in the middle, how in the hell do you move that damn box? I've been trying to figure out how to do that for a day now.

2) I can't get the lamp to show up in the 3D window for the life of me. I've tried starting over, cloning it, etc. Nothing. All I see is a red box.

3) Doesn't work, I followed all of your steps but the lights are independent of the light. What am I doing wrong?



MisterCrow@Posted: Tue Aug 10, 2004 1:00 am :
Ok tried it a fourth time, and now this time when I clone the first lightbulb, the box for the center of the light appears BELOW and way to the RIGHT of the lightbulb...wtf is going on here? This editor is beyond frustrating.

EDIT: Screenshots woo!

http://apotheosis.tv/files/wtfd1.jpg
After testing out the level once, both lights moved down and to the side for some reason.

Image
See? Makes no sense - looks like crap here because they are too bright and too low.

I want to reposition the BOX, not just the center. I've been downloading these tutorial maps and all the light boxes are perfectly centered...how the heck are yall doing this :? ?

Please restrict the images in your post to 640 pixels width if you use the [img] tag. Thank you! -Burrito



CraiZE@Posted: Tue Aug 10, 2004 1:28 am :
this works sweet for me ;)



Hunter@Posted: Tue Aug 10, 2004 1:52 am :
The light doesn't appear centered on the fluorescent bulb.



MisterCrow@Posted: Tue Aug 10, 2004 2:30 am :
Hunter wrote:
The light doesn't appear centered on the fluorescent bulb.


Right...how do you get it to center? If I change the "Center" setting, it's only the little selection tick moves, not the actual box representing the light. I've spent hours trying to figure out how to move the box and it just don't budge.



lophyte@Posted: Tue Aug 10, 2004 2:33 am :
Er, oops.. I forgot to add that in, hahaha. When you've got your light selected, press TAB. That will select only the light entity and not the model that's attached to the light.

As for the light fixture not showing up in the editor's camera, I'm not sure why it doesn't, but it doesn't for me either. I just use the red wireframe to line up my lights.

themadtux: Make sure you're using env_swinglight_long_wbulbs_fixed and not env_swinglight_long_fixed.

Hope that helps!

- lophyte



Northwood@Posted: Tue Aug 10, 2004 2:40 am :
Works awsome! Thanks! :D



lophyte@Posted: Tue Aug 10, 2004 3:08 am :
MisterCrow: how'd you get the dead guy up against the wall? is that an env? and if so, how'd you model him like that?



MisterCrow@Posted: Tue Aug 10, 2004 3:45 am :
lophyte wrote:
MisterCrow: how'd you get the dead guy up against the wall? is that an env? and if so, how'd you model him like that?


It's under models/mapobjects/pentagram/pentagram_lo.lwo

But ya, I finally got the map editor to behave for once :D, now I gotta add a swinglight and my moody desk area will look even cooler in motion.
http://apotheosis.tv/files/evildesk.jpg (linked for size)



lophyte@Posted: Tue Aug 10, 2004 4:20 am :
Very nice lighting indeed.. can't wait to see it with the swinglight.



USCM-Cid@Posted: Tue Aug 10, 2004 9:13 am :
Does anyone have any suggestions as to how to make the swinging of a light more smoother? It seems to me that for some reason, the way I have it set, makes it seem a bit jerky (Very slightly but I would like a smoother sway.)

I have it set to:

(5, 0, '0 0 10')

Any suggestions?



lophyte@Posted: Tue Aug 10, 2004 9:15 am :
I think if you increase the 5 to say, maybe 10 or 15, it might look a little less jerky.



Elminster@Posted: Tue Aug 10, 2004 8:29 pm :
I got the light that swings when shot to work fine. How to I get the lights to actually go out when they are shot. What I want is when I shoot the base that is holding the lights it swings, but when I shoot the lights themselves they go out. Right now the swinging works, and when add health to the lights and shoot them they shatter. But even with the actual light models shattered the light is still coming from the base.



lophyte@Posted: Tue Aug 10, 2004 8:33 pm :
I haven't really had a chance to play with destructable lights, but perhaps this may help:

http://www.doom3world.org/phpbb2/viewtopic.php?t=3263



Ado@Posted: Tue Aug 10, 2004 9:03 pm :
Awesome tutorial!

Anyone know how you can find out what value you need to use with the "bindToJoint" key if you use a different env model? I can get this to work if I use the long swinging lights in the tutorial, but if I apply this process to a different light fixture model, it doesnt work, giving me an error that it can't find "bone5"



cibressus@Posted: Tue Aug 10, 2004 9:46 pm :
i can't get mine working. do you think you could post the map you made?



|KRiTiKaL|@Posted: Tue Aug 10, 2004 10:34 pm :
I got the light frame to swing when i shoot it, the lightbulbs stay still tho any advice?



Elminster@Posted: Tue Aug 10, 2004 11:47 pm :
make sure to add the Bindings.



lophyte@Posted: Mon Aug 09, 2004 11:44 pm :
SWINGING LIGHTS
By: lophyte <lophyteNO@SPAMgmail.com>

Special thanks to Unoid for helping me with figuring out how to make a swinging light. It turns out its actually quite easy.

Making sure nothing is selected, right click on the grid and go to env, then env_swinglight_long_wbulbs_fixed. This creates a light fixture for us to work with. In the Z window, raise it so that the top touches the ceiling. Go into the Entity Properties window for the env, and set the name to something shorter like "swinglight_1".

This is where we create our lights. Right click on the grid and select light. Go into the Entity Properties window for the light, and click the "Model..." button. In the model browser, select base/models/mapobjects/lights/florescent_bulb.ase and click OK.

Note: if the model doesn't show up in the grid and the light stays as a box, clone it and delete the original.

Again, in the Entity Properties for our light, add key "bind", with the name of the env as the value. Then add key "bindToJoint", and value "bone5". Now clone this light, and line them both up directly under the fixture.

Image


Now fire up the game and start shooting at your light - it will jump around!

OPTIONAL: Infinitely Swinging Light

If you'd like to add a light that swings back and forth and never stops, this requires a little bit of scripting. Create a mover by right clicking on the grid, going to func, and selecting func_mover. In the Entity Properties, give the mover a descriptive name, ie "slight_mover_1".

Select the env light fixture, and go into the Entity Properties. Add a key "bind", with the value being the name you gave the mover. Now create a file in the same folder as your map, with the same name, and a .script extension (ie, if your map is called swinginglights.map, the script file shoule be called swinginglights.script)

Open up the script file, and add this simple piece of code:

Code:
void main() {
          $slight_mover_1.sway(0, 0, '20 0 0');
}


EDIT: Apologies, I'm an idiot. The first value in sway() seems to be the time it takes before causing the mover to sway again, ie it swings once, waits that amount of time (in milliseconds), then swings again. 50 looks nice with a rotation of 20. Play around with these values to see what they do, but definitely don't leave the first one at 0 otherwise your light won't swing.

Of course, you'll want to change slight_mover_1 to whatever you named your mover entity. As for the number values, take a look at the command reference for a more detailed description. For our purposes, we just need to look at the '20 0 0': this causes the light to sway on a certain axis. The first number is x, the second is y, and the third is z. Play around with these values to find out how they affect your light.


That's all! Compile your map and fire it up in DOOM, and all should be well. Suggestions, comments and feedback welcome.


- lophyte



themadtux@Posted: Tue Aug 10, 2004 12:13 am :
Ok this is a pretty cool tutorial and something I've wanted to know about. Well I get the following after following the tutorial

"ERROR: idAFEntity_Base::LoadAF: Couldn't load af file 'env_swinglight_long_fixed.af' on entity 'swingilight_1'

Thoughts?

Thanks..

-Jason



MisterCrow@Posted: Tue Aug 10, 2004 12:49 am :
Hmm, this doesn't work at all for me...few things:

1) When I make the bulbs, the light sticks at the far LEFT of the bulbs, not in the middle. I can change the center sure, but the actual box that represents the light is still on the side and not in the middle, how in the hell do you move that damn box? I've been trying to figure out how to do that for a day now.

2) I can't get the lamp to show up in the 3D window for the life of me. I've tried starting over, cloning it, etc. Nothing. All I see is a red box.

3) Doesn't work, I followed all of your steps but the lights are independent of the light. What am I doing wrong?



MisterCrow@Posted: Tue Aug 10, 2004 1:00 am :
Ok tried it a fourth time, and now this time when I clone the first lightbulb, the box for the center of the light appears BELOW and way to the RIGHT of the lightbulb...wtf is going on here? This editor is beyond frustrating.

EDIT: Screenshots woo!

http://apotheosis.tv/files/wtfd1.jpg
After testing out the level once, both lights moved down and to the side for some reason.

Image
See? Makes no sense - looks like crap here because they are too bright and too low.

I want to reposition the BOX, not just the center. I've been downloading these tutorial maps and all the light boxes are perfectly centered...how the heck are yall doing this :? ?

Please restrict the images in your post to 640 pixels width if you use the [img] tag. Thank you! -Burrito



CraiZE@Posted: Tue Aug 10, 2004 1:28 am :
this works sweet for me ;)



Hunter@Posted: Tue Aug 10, 2004 1:52 am :
The light doesn't appear centered on the fluorescent bulb.



MisterCrow@Posted: Tue Aug 10, 2004 2:30 am :
Hunter wrote:
The light doesn't appear centered on the fluorescent bulb.


Right...how do you get it to center? If I change the "Center" setting, it's only the little selection tick moves, not the actual box representing the light. I've spent hours trying to figure out how to move the box and it just don't budge.



lophyte@Posted: Tue Aug 10, 2004 2:33 am :
Er, oops.. I forgot to add that in, hahaha. When you've got your light selected, press TAB. That will select only the light entity and not the model that's attached to the light.

As for the light fixture not showing up in the editor's camera, I'm not sure why it doesn't, but it doesn't for me either. I just use the red wireframe to line up my lights.

themadtux: Make sure you're using env_swinglight_long_wbulbs_fixed and not env_swinglight_long_fixed.

Hope that helps!

- lophyte



Northwood@Posted: Tue Aug 10, 2004 2:40 am :
Works awsome! Thanks! :D



lophyte@Posted: Tue Aug 10, 2004 3:08 am :
MisterCrow: how'd you get the dead guy up against the wall? is that an env? and if so, how'd you model him like that?



MisterCrow@Posted: Tue Aug 10, 2004 3:45 am :
lophyte wrote:
MisterCrow: how'd you get the dead guy up against the wall? is that an env? and if so, how'd you model him like that?


It's under models/mapobjects/pentagram/pentagram_lo.lwo

But ya, I finally got the map editor to behave for once :D, now I gotta add a swinglight and my moody desk area will look even cooler in motion.
http://apotheosis.tv/files/evildesk.jpg (linked for size)



lophyte@Posted: Tue Aug 10, 2004 4:20 am :
Very nice lighting indeed.. can't wait to see it with the swinglight.



USCM-Cid@Posted: Tue Aug 10, 2004 9:13 am :
Does anyone have any suggestions as to how to make the swinging of a light more smoother? It seems to me that for some reason, the way I have it set, makes it seem a bit jerky (Very slightly but I would like a smoother sway.)

I have it set to:

(5, 0, '0 0 10')

Any suggestions?



lophyte@Posted: Tue Aug 10, 2004 9:15 am :
I think if you increase the 5 to say, maybe 10 or 15, it might look a little less jerky.



Elminster@Posted: Tue Aug 10, 2004 8:29 pm :
I got the light that swings when shot to work fine. How to I get the lights to actually go out when they are shot. What I want is when I shoot the base that is holding the lights it swings, but when I shoot the lights themselves they go out. Right now the swinging works, and when add health to the lights and shoot them they shatter. But even with the actual light models shattered the light is still coming from the base.



lophyte@Posted: Tue Aug 10, 2004 8:33 pm :
I haven't really had a chance to play with destructable lights, but perhaps this may help:

http://www.doom3world.org/phpbb2/viewtopic.php?t=3263



Ado@Posted: Tue Aug 10, 2004 9:03 pm :
Awesome tutorial!

Anyone know how you can find out what value you need to use with the "bindToJoint" key if you use a different env model? I can get this to work if I use the long swinging lights in the tutorial, but if I apply this process to a different light fixture model, it doesnt work, giving me an error that it can't find "bone5"



cibressus@Posted: Tue Aug 10, 2004 9:46 pm :
i can't get mine working. do you think you could post the map you made?



|KRiTiKaL|@Posted: Tue Aug 10, 2004 10:34 pm :
I got the light frame to swing when i shoot it, the lightbulbs stay still tho any advice?



Elminster@Posted: Tue Aug 10, 2004 11:47 pm :
make sure to add the Bindings.