Hi gurus.
I am stumped.
I have made a script to disable all light sources in a dungeon. works great.
But the players want to be able to turn them back on as they find them. either with a spell or activator.
I was thinking of using FindClosestReferenceOfType, but it is not detecting the disabled forms, if anything can actually do that.
the script is:
Scriptname lightsoffmagicspell extends activemagiceffect FormList Property AllLightsList Auto float x1float z1float y1Event OnEffectStart(Actor akTarget, Actor akCaster) x1 = game.GetPlayer().GetPositionX() y1 = game.GetPlayer().GetPositiony() z1 = game.GetPlayer().GetPositionz() Debug.Notification("Trying to Find Light Source") int index1 = 5 While Index1 Index1 -= 1 ObjectReference lightsource = Game.FindClosestReferenceOfType(AllLightsList, x1, y1, z1, 900.0) if lightsource.IsDisabled()lightsource.Enable()EndIf EndWhile EndEvent
But the script does not find the disabled light sources near the player.
The scenario is:
The player enters the dungeon. Script 1, which works , disables all light sources (the lightbulbs) in the dungeon.
The player has a new spell call "Light them up". he casts the spell near a bulb that has been disabled, since I know whre they are from checking the creation kit. The spell executes and gives the test message, so I know it is running.
But it does not enable the disabled light bulb. My guess is that it cannot find it.
Is there a better way of finding disabled forms near the player?
And with the command "
FindClosestReferenceOfType
the wiki says the parameters are:
- arBaseObject: The type of base object to look for
- afX: center of the search, X component
- afY: center of the search, Y component
- afZ: center of the search, Z component
- afRadius: Maximum distance from center to look for a http://www.creationkit.com/ObjectReference_Script
I used the players postion for x,y, and z.
But look at this example:
ObjectReference closestDiamond = Game.FindClosestReferenceOfType(Diamond, 0.0, 0.0, 0.0, 5.0)