I made it toggle night and day for the skyboxes that support it.
Code: Select all
//::///////////////////////////////////////////////
//:: Item Event Script
//:: "skywand" for CSP 2.0
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void SkyChange(object oPC, object oArea)
{
int nBox = GetSkyBox(oArea);
int nDoOnce = (GetLocalInt(oArea, "SKY_WAND"));
int nSky = (GetLocalInt(oArea, "SKY_BOX"));
int nHour = GetTimeHour();
int nSwitch = GetLocalInt(oArea, "NIGHT_SWITCH");
int nCycle = StringToInt(Get2DAString("skyboxes", "CYCLICAL", nBox));
if ((nHour 14))
{
SetTime(12, 0, 0, 0);
}
if (nDoOnce == FALSE)
{
SetLocalInt(oArea, "SKY_WAND", TRUE);
SetLocalInt(oArea, "SKY_BOX", nBox);
SendMessageToPC(oPC, "SKYBOX: " +Get2DAString("skyboxes", "LABEL", nBox) +" Number: " +IntToString(nBox) +" Day");
}
else if ((nCycle == 1) && (nSwitch == 0))
{
SetTime(22, 0, 0, 0);
SendMessageToPC(oPC, "SKYBOX: " +Get2DAString("skyboxes", "LABEL", nSky) +" Number: " +IntToString(nSky) +" Night");
SetLocalInt(oArea, "SKY_BOX", nSky);
SetLocalInt(oArea, "NIGHT_SWITCH", 1);
}
else
{
nSky +=1;
if (nSky == 7)
{
nSky = 30;
}
else if (nSky == 85)
{
nSky = 0;
}
SetSkyBox(nSky, oArea);
SendMessageToPC(oPC, "SKYBOX: " +Get2DAString("skyboxes", "LABEL", nSky) +" Number: " +IntToString(nSky) +" Day");
SetLocalInt(oArea, "SKY_BOX", nSky);
SetLocalInt(oArea, "NIGHT_SWITCH", 0);
}
}
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
object oPC;
object oItem;
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
object oArea = GetArea(oPC);
DelayCommand(1.0, SkyChange(oPC, oArea));
}
}