Scripting a switch to turn on a light
Posted: 24 Oct 2021, 21:37
Hi
Im making a house with a dwemer fireplace. Theres a dwarven crank nearby. The fire is off, but when you turn the crank, the fire turns on.
This is my first time using global scripts, and I can't quite crack this problem. I was hoping someone here might shed some light? Im using OpenMW to test.
The first script is attached to the flame itself, and seems to work. By editing the local variable, the fire does indeed appear or disappear.
Begin USaS_StoveFlame
short USaSGlobalFlame
if ( USaSGlobalFlame == 0 )
USaS_StoveFlame->disable
;Flame off
endif
if ( USaSGlobalFlame == 1 )
USaS_StoveFlame->enable
;Flame on
endif
End USaS_StoveFlame
The second is attached to the crank. I mustve tried a dozen different permutations of this script:
begin USAS_StoveScript
float angle
short USaSGlobalFlame
if ( menumode == 1 )
return
endif
if ( OnActivate == 0)
return
endif
if ( OnActivate == 1)
if ( USaSGlobalFlame == 0 )
PlaySound "Disarm Trap Fail"
set USaSGlobalFlame to 1
else
PlaySound "Disarm Trap Fail"
set USaSGlobalFlame to 0
endif
return
endif
End USAS_StoveScript
I cannot work why, when i activate the crank, the flame does not appear. It makes the use sound only once.
Im making a house with a dwemer fireplace. Theres a dwarven crank nearby. The fire is off, but when you turn the crank, the fire turns on.
This is my first time using global scripts, and I can't quite crack this problem. I was hoping someone here might shed some light? Im using OpenMW to test.
The first script is attached to the flame itself, and seems to work. By editing the local variable, the fire does indeed appear or disappear.
Begin USaS_StoveFlame
short USaSGlobalFlame
if ( USaSGlobalFlame == 0 )
USaS_StoveFlame->disable
;Flame off
endif
if ( USaSGlobalFlame == 1 )
USaS_StoveFlame->enable
;Flame on
endif
End USaS_StoveFlame
The second is attached to the crank. I mustve tried a dozen different permutations of this script:
begin USAS_StoveScript
float angle
short USaSGlobalFlame
if ( menumode == 1 )
return
endif
if ( OnActivate == 0)
return
endif
if ( OnActivate == 1)
if ( USaSGlobalFlame == 0 )
PlaySound "Disarm Trap Fail"
set USaSGlobalFlame to 1
else
PlaySound "Disarm Trap Fail"
set USaSGlobalFlame to 0
endif
return
endif
End USAS_StoveScript
I cannot work why, when i activate the crank, the flame does not appear. It makes the use sound only once.