FindClosestReferenceOfType and finding disabled items with

Post » Tue Oct 06, 2015 3:03 am

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:

ObjectReference Function FindClosestReferenceOfType(Form arBaseObject, float afX, float afY, float afZ, float afRadius) native global
Parameters
  • 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:

; Find the closest diamond reference to 0,0,0, limiting the search to 5 units
ObjectReference closestDiamond = Game.FindClosestReferenceOfType(Diamond, 0.0, 0.0, 0.0, 5.0)
I am not sure what diamond should be., Do I have to put every type of light source found in Bleaks Falls Barrow in a formlist and that is what it wants? I was hoping to just tell the software the type of form, ie "light" and have it search for those type of forms, but that did not work.
In otther words, in the example above, is "Diamond" supposed to be a formlist?

User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Return to V - Skyrim