Jump to content

Light Sources on Weapons


Natterforme

Recommended Posts

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

I found this Sword of Lightning with Sound. It changes the mesh of the sword with an animated one when the player draws it. It doesn't actually give off any light, but it does look pretty cool.

 

I couldn't find any weapons that has a scripted light following them, although I was sure there were some around. I wrote up a script myself instead.

 

 

scn testswordscript

ref npcref

float posx
float posy
float posz
float anglez

Begin OnEquip

let npcref := GetContainer

End

Begin OnUnequip

let npcref := 0

End

Begin GameMode

if (npcref == 0)
	Return
endif

if (npcref.IsWeaponOut == 0)
	TestSwordLightRef.Disable
	Return
endif

if (TestSwordLightRef.GetInSameCell npcref == 0)
	TestSwordLightRef.Disable
	TestSwordLightRef.Moveto npcref
	Return
endif

let posx := npcref.GetPos X
let posy := npcref.GetPos Y
let posz := (npcref.GetPos Z + 100)
let anglez := (npcref.GetAngle Z) + 90
let posx := posx + 25 * (sin anglez)
let posy := posy + 25 * (cos anglez)

TestSwordLightRef.SetPos X posx
TestSwordLightRef.SetPos Y posy
TestSwordLightRef.SetPos Z posz

if (TestSwordLightRef.GetDisabled)
	TestSwordLightRef.Enable
endif

End

 

 

It worked, but just as I thought, it didn't look very good. Because the light isn't actually on the sword and has to be scripted to follow the player, you can see the player's shadow flickering every time the light moves.

 

Also, I wasn't able to use GetPos on the sword, so I had to move the light in relation to the player's position. This means the light won't move when you swing the sword.

Edited by fg109
Link to comment
Share on other sites

Hello...

 

it looks like finally i have the information i need to make my lightsabers glow.

It's been a very long time i wanted to attach gem (light source) to my lightsaber, but so far people always say that's impossible.

I'm sure that a light source can be attached to weapon using script, but then another person said that the game will be very laggy...

I have 19 lightsaber colors in my mod & i want it so bad to see my char running around Cyrodiil will lightsaber in hand & it casts shadows.

 

Please share any other useful information to make this dream comes true.

I'll keep getting back to this post to find the latest or even final info that works perfectly.

 

Thanks & good luck.

 

 

-lovender-

Link to comment
Share on other sites

Ok two things:

 

1. Fg109, thank you very much on yet another scipt help. The only problem is, I dont know how to use it to make it work in the CS. Could you be so kind as to tell me how to insert it into a mod and attach it to a weapon? After I see the effect, we can go from there^^.

 

2.Lovender, I didnt realize your lightsabers didnt have a light source. I thought for sure when I saw this:

http://www.tesnexus.com/downloads/images/34766-1-1299627772.jpg

 

that your weapons give off light. Am I mistaken? Oh and great avatar^^.

Link to comment
Share on other sites

In the Constuction Set's Object Window, go to WorldObjects -> Light and choose one of the ambient lights (eg ARWhiteIntense500). You can also make your own custom lighting, so you can make it pulse or change the color or radius. Don't try to use a torch, because you'd keep running into it and it'd get in the way.

 

Drag and drop it into a cell somewhere. Double-click the light and change the reference ID to "TestSwordLightRef" if you're just going to copy-paste the script I gave you. Attach the script to your custom sword and save the mod.

 

Obviously, this will only work for a single "glowing" sword. If you want more, you'll need to drop some more lights, and then give copies of the script to each sword (while changing "TestSwordLightRef" to "TestSwordLightRef2" or something).

Link to comment
Share on other sites

Ok fg109, Thanks for your help^^! Its late though and tomorrow is the 4th so I wont be able to test this out until Tuesday or so. Will report back after I can make an attempt, either way. I can understand that each sword would need its own light script, but will having multple light scripts on a single weapon allow for more than one light, which would then allow for multiple colors on a single weapon? Or would the script need to be altered?
Link to comment
Share on other sites

You can't put two scripts on one object, so if you want two lights, then you'll have to alter the script. Wherever there is a line for "TestSwordLightRef", just add another line doing the same thing for "TestSwordLightRef2" or something. Although you might want to change the SetPos commands a little so the two lights don't end up at the same spot.
Link to comment
Share on other sites

@ Natterforme :

 

Haha...got you! :biggrin:

 

Well, actually the purple shadows casted on my char's body is truly a light source from Oblivion engine.

But still, the light isn't coming from the blade, but from the gem in front of the char.

I use Screenshooters Illumination 1_2 mod, set the position of the gem (light source) using getpos x/y/z console command.

I don't use Photoshop or post-processing, since i'm not that good with photoshop. Besides, i want to see the shadows as natural as possible for any of my lightsaber screenshot.

 

In my lightsaber mod, i also include the light source gems in CS; together with the light sabers.

All i need now is the script that makes the gem to follow the saber movement; hoping that in the future it will be easier to make screenshots with lightsaber.

 

If u don't mind, u can try download that mod & see what can u do to create the perfect script.

The color of the gems has been made to match perfectly with the saber color.

 

If u need help, let me know.

I'll do what i can... :thumbsup:

 

P.S: Thanks a lot for this discussion. At least, i can see a ray of hope for my favorite game (Oblivion) & weapon (lightsaber). :ohdear:

 

 

@ fg109:

Thanks to u too...

It looks like you're an expert in this matter. Good luck in everything u do.

Edited by lovender
Link to comment
Share on other sites

Wait, so the gem gives off the light, and the light can be customized to be different colors? If the gem has a script for a light source, while idle(on the floor, on a table), cant we just add that jem to the mesh? For example, lovender, you pull out your green light saber, which is a weapon. Cant we just have a script that equips the gem as an amulet that is weighted to the lightsaber? You know how some weapons auto equip a left hand weapon? Lets just replace it with the desired jem that has the corresponding color? If the jem kept its light source script, cant it illuminate your weapon and fake the light effect? What do you think about this fg109? Then I could use the script to auto equip two jems with different lights to my weapon. Possible? :happy:

 

Edit: Or we can make the jem a left handed weapon. Think about this: You know how, in blender, a weapon has to be laid out on a plane in order to fit into a characters' hand? Lets just make the light source jewel a weapon that occupies the exact same space as the blade of the light saber(or my blade). If the script for the light source is radical, we can put it in the center of the blade, or manipulate the script to occupy the correct light dimensions. This way, it doesnt take up an extra equipment slot(amulet/tail) and it should fake the light effect into making anyone think the weapon was giving off the light, instead of the light source being tied to an offhand weapon script. If Im right, it shouldnt hang off to one side like an unwanted sprite. How about that?

Edited by Natterforme
Link to comment
Share on other sites

For your first idea, I don't think it's possible to script the gem to be weighted to the blade. Perhaps someone more knowledgeable than me could do it.

 

As for your second idea, about making the left hand "weapon" the light source, I think it's possible. You should be able to modify a torch to look like a blade, and torches are held in the offhand.

 

Also, I told you I couldn't get the coordinates for the blade. When my character is holding the blade, GetPos returns the same coordinates as it does on my character. It seems impossible to find out the blade's exact position through scripting. So the script I posted kept the light at a stationary position on my characters right shoulder.

 

I suppose I could try and script the light to move depending on what animation the character is playing (ie swinging a sword), but that would be really complicated and it wouldn't look right if someone uses an animation replacer.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...