Rune_PRC8/_module/nss/opw_light_onoff.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

41 lines
1.3 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
//
// Olander's - Turn Lights On Off (From nw_o2_onoff)
// opw_auto_lights
// By:Don Anderson
// dandersonru@msn.com
//
// Place this on the OnUsed Event of a Placeable for Lighting
//
////////////////////////////////////////////////////////////////////////////////
void main()
{
if (GetLocalInt(OBJECT_SELF,"NW_L_AMION") == 0)
{
object oSelf = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
DelayCommand(0.4,SetPlaceableIllumination(oSelf, TRUE));
SetLocalInt(OBJECT_SELF,"NW_L_AMION",1);
DelayCommand(0.5,RecomputeStaticLighting(GetArea(oSelf)));
effect eLight = EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_20);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLight, oSelf);
}
else
{
object oSelf = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
DelayCommand(0.4,SetPlaceableIllumination(oSelf, FALSE));
SetLocalInt(OBJECT_SELF,"NW_L_AMION",0);
DelayCommand(0.9,RecomputeStaticLighting(GetArea(oSelf)));
effect eEffect = GetFirstEffect(oSelf);
while (GetIsEffectValid(eEffect) == TRUE)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_VISUALEFFECT) RemoveEffect(oSelf, eEffect);
eEffect = GetNextEffect(oSelf);
}
}
}