Day and night lamp posts

Day and night lamp posts

What it Does
Turn's lamp post's in an area on at nights, and off during the day.

How to use
place on a sigle lamp post. make sure to uncheck static then place the script on the lamp post's onhartbeat

The Script
void main {   // define data storage object object obj = OBJECT_SELF; int iLampsOn = GetLocalInt(obj, "iLampsOn"); int iChange = FALSE; if(!iLampsOn && (GetIsDusk || GetIsNight || GetIsDawn)) iChange = TRUE; else if(iLampsOn && GetIsDay) iChange = TRUE; if(iChange) {       int i = 0; object oLamp = GetObjectByTag("LampPost"); while(GetIsObjectValid(oLamp)) {           if(iLampsOn) // if lamps are currently on, turn this lamp off {               AssignCommand(oLamp, PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE)); SetPlaceableIllumination(oLamp, FALSE); }           else {               AssignCommand(oLamp, PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE)); SetPlaceableIllumination(oLamp, TRUE); }           i++; oLamp = GetObjectByTag("LampPost", i); }       RecomputeStaticLighting(GetArea(GetObjectByTag("LampPost"))); iLampsOn = iLampsOn ? 0 : 1;       SetLocalInt(obj, "iLampsOn", iLampsOn); } }