Jump to content

Flashlight Script


TheChan

Recommended Posts

I need a script that creates a light a few feet in front of the player when a weapon is equipped, and moves it around relative to the direction the player is facing. Then when the weapon is unequipped, it removes the light.

 

I tried to do the first part, but it crashes when I unequip the weapon.

 

scn aaFlashLightScript

short Equipped
ref Light

begin OnEquip player
if ( Equipped == 0 )
	set Equipped to 1
	set Light to Player.PlaceAtMe "OfficeLightKeyWarm" 0 256
	player.PlaceAtMe "OfficeLightKeyWarm" 0 256
	"Light".SetScale .5
endif
end

begin OnUnequip player
if ( Equipped == 1 )
	set Equipped to 0
	"Light".Disable
	"Light".MarkForDelete
endif
end

 

What I'd like to do is have several lights that are gradually bigger in size, so it creates a "cone" of light.

 

Each light is 32 units apart. From left to right they are 0.4, 0.3, 0.2, 0.1 scale.

Link to comment
Share on other sites

There is a way, I did it once, yet haven't found how to replicate it, to turn a light directional, i.e. a spotlight. It may only be certain types of light that can do that. I remember when I did it, the marker turned into a blue speaker looking thing, like sounds have a green speaker looking thing. That may be easier to manipulate, than your chain of point lights. If you've tried out the drivable motorcycle, you've seen how the weapon attachments lag behind a bit, so your chained together lights, might end up moving more like a whip than a cone. Now that I've reminded myself of that, I need to go play with the geck and see if I can figure out how to do it again.

 

 

A little while later.....

 

Okay, I'm on crack or something. The only directional settings are if you set a light to cast a shadow, then it's a blue pyramid, not a speaker icon. Additional poking around though, some things you may want to try dissecting, to see how they work, and what tricks you can apply, are the drivable motorcycle, and the pipboy light. The motorcycle, you may even be able to just shoot the author a PM and get his direct help.

Edited by obfuscate
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...