Simple script - I thought…
I’m trying to make it so that the torches in my village only light during nighttime.
code so far…
// For OnHearbeat handler
object oTarget;
void main()
{
object oPC = GetNearestCreature
(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF);
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
if (GetIsDay())
{
oTarget = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
SetPlaceableIllumination (oTarget, FALSE);
RecomputeStaticLighting(GetArea(oTarget));
}
else if (GetIsNight())
{
oTarget = OBJECT_SELF;
PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
SetPlaceableIllumination (oTarget, TRUE);
RecomputeStaticLighting(GetArea(oTarget));
}
else
{
return;
}
}
As it stands now, the lights go off during the day but won’t come on at night. Any help would be great guys.