Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {
- int nIsNight = GetLocalInt(OBJECT_SELF, "NIGHT_DO_ONCE");
- int nIsDay = GetLocalInt(OBJECT_SELF, "DAY_DO_ONCE");
- int n = 1;
- if(GetIsDay())
- {
- if (nIsDay == 0)
- {
- object oPoint = GetNearestObjectByTag("ds_lightpoint", OBJECT_SELF, n);
- while (oPoint != OBJECT_INVALID)
- {
- if(GetArea(oPoint) == GetArea(OBJECT_SELF))
- {
- location lLightLoc = GetLocation(oPoint);
- object oLight = CreateObject(OBJECT_TYPE_PLACEABLE, "ds_windowlight", lLightLoc);
- AssignCommand(oLight, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
- n++;
- oPoint = GetNearestObjectByTag("ds_lightpoint", OBJECT_SELF, n);
- }
- }
- object oCandle = GetNearestObjectByTag("ds_canleactiv", OBJECT_SELF, 1);
- n = 1;
- while (oCandle != OBJECT_INVALID)
- {
- int nAuto = GetLocalInt(oCandle, "NOT_AUTOMATIC");
- if(nAuto =! 1)
- {
- location lCandleLoc = GetLocation(oCandle);
- DestroyObject(oCandle);
- object oNewCandle = CreateObject(OBJECT_TYPE_PLACEABLE, "ds_canledeactiv", lCandleLoc);
- AssignCommand(oNewCandle, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
- n++;
- }
- oCandle = GetNearestObjectByTag("ds_canleactiv", OBJECT_SELF, n);
- }
- n = 1;
- object oSCandle = GetNearestObjectByTag("ds_canleactiv_s", OBJECT_SELF, 1);
- while (oSCandle != OBJECT_INVALID)
- {
- if(GetArea(oSCandle) == GetArea(OBJECT_SELF))
- {
- location lSCandleLoc = GetLocation(oSCandle);
- DestroyObject(oSCandle);
- object oNewSCandle = CreateObject(OBJECT_TYPE_PLACEABLE, "ds_canledeactv_s", lSCandleLoc);
- AssignCommand(oNewSCandle, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
- n++;
- oSCandle = GetNearestObjectByTag("ds_canleactiv_s", OBJECT_SELF, n);
- }
- }
- DelayCommand(5.0, RecomputeStaticLighting(GetArea(OBJECT_SELF)));
- SetLocalInt(OBJECT_SELF, "DAY_DO_ONCE", 1);
- SetLocalInt(OBJECT_SELF, "NIGHT_DO_ONCE", 0);
- }
- }
- if(GetIsNight())
- {
- if(nIsNight == 0)
- {
- n = 1;
- object oLight = GetNearestObjectByTag("ds_windowlight", OBJECT_SELF, n);
- while (oLight != OBJECT_INVALID)
- {
- if(GetArea(oLight) == GetArea(OBJECT_SELF))
- {
- DestroyObject(oLight);
- }
- n++;
- oLight = GetNearestObjectByTag("ds_windowlight", OBJECT_SELF, n);
- }
- n = 1;
- object oDiactivCandle = GetNearestObjectByTag("ds_canledeactiv", OBJECT_SELF, n);
- while (oDiactivCandle != OBJECT_INVALID)
- {
- int nAuto = GetLocalInt(oDiactivCandle, "NOT_AUTOMATIC");
- if(nAuto != 1)
- {
- location lDeactivCandleLoc = GetLocation(oDiactivCandle);
- DestroyObject(oDiactivCandle);
- CreateObject(OBJECT_TYPE_PLACEABLE, "ds_canleactiv", lDeactivCandleLoc);
- n++;
- }
- oDiactivCandle = GetNearestObjectByTag("ds_canledeactiv", OBJECT_SELF, n);
- }
- n = 1;
- object oSDiactivCandle = GetNearestObjectByTag("ds_canledeactv_s", OBJECT_SELF, n);
- while (oSDiactivCandle != OBJECT_INVALID)
- {
- if(GetArea(oSDiactivCandle) == GetArea(OBJECT_SELF))
- {
- location lSDeactivCandleLoc = GetLocation(oSDiactivCandle);
- DestroyObject(oSDiactivCandle);
- CreateObject(OBJECT_TYPE_PLACEABLE, "ds_canleactiv_s", lSDeactivCandleLoc);
- n++;
- oSDiactivCandle = GetNearestObjectByTag("ds_canledeactv_s", OBJECT_SELF, n);
- }
- }
- DelayCommand(5.0, RecomputeStaticLighting(GetArea(OBJECT_SELF)));
- SetLocalInt(OBJECT_SELF, "NIGHT_DO_ONCE", 1);
- SetLocalInt(OBJECT_SELF, "DAY_DO_ONCE", 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement