Multi Marker script

Post » Thu Feb 06, 2014 1:30 pm

I am trying to activate a ON xmarker and disable a OFF marker. It is to enable / disable different statics and lights. The scripts I have tried work but I have to press the activator (button) twice the first time before it starts working.

I tried this first........

ObjectReference Property LightOnREF Auto
ObjectReference Property LightOffREF Auto
ObjectReference Property LightBulbFullREF Auto
ObjectReference Property LightBulbDimREF Auto

Sound Property QSTAstrolabeButtonPressX Auto

int myState

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
QSTAstrolabeButtonPressX.Play(Self)
Utility.Wait(0.2)

if myState == 1
myState = 0
LightOnREF.enable()
LightBulbFullREF.enable()
LightBulbDimREF.disable()
LightOffREF.disable()

else
myState = 1
LightOnREF.disable()
LightBulbFullREF.disable()
LightBulbDimREF.enable()
LightOffREF.enable()
endif
EndIf
endEvent

And then............

ObjectReference Property XmarkerLightsON Auto
ObjectReference Property XmarkerLightsOff Auto

int myState

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
if myState == 1
myState = 0
XmarkerLightsON.enable()
XmarkerLightsOff.disable()

else
myState = 1
XmarkerLightsON.disable()
XmarkerLightsOff.enable()
endif
Endevent

but same result, the button must be activated twice before it begins working the first time.

User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Thu Feb 06, 2014 2:41 pm

If your lights are off/disabled to begin with, that would be because your script disables them the first time through, only on the second time it turns them on. Try setting myState to equal 1 initially (or swap the if statement contents around)

User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm


Return to V - Skyrim