Skybox widget
Post Reply
Izk The Mad
Posts: 100
Joined: Fri Jun 06, 2008 8:40 pm

Skybox widget

Post by Izk The Mad »

This is a unique item power script I made for testing the CSP 2.0 skyboxes in my module. I haven't updated it (or my module) to 2.1 yet, but I just thought I'd share. Maybe someone else might find it useful. :)

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));
    }
}

User avatar
Christopher
Posts: 267
Joined: Wed Jan 05, 2011 10:21 pm
ctp: No
dla: No
TBotR: No
nwnihof: No

Post by Christopher »

Thanks! OldMansBeard made me a similar widget (I still have the script OMB) when I was working on the CTP Skyboxes.

Yet another item I wish to get some work done one (once Real Life gives me some time to play with).

[CENTER][IMG]http://stitchontime.com/osc/images/alice3.gif[/IMG]

[/CENTER]

Izk The Mad
Posts: 100
Joined: Fri Jun 06, 2008 8:40 pm

Post by Izk The Mad »

Ah yes, time. My mortal enemy. And I don't just mean that metaphysically. I wish I could make a clone of myself just so I have more time for this stuff. :D

chaos_theocrat
Posts: 42
Joined: Sat May 31, 2008 12:18 am

An interesting item for DMs...

Post by chaos_theocrat »

I can imagine a skybox widget being a very popular DM tool. Like in certain instances when you want to give the same area a slightly different feel, or if you even wished to disorient the players just a little bit at certain times.
There are a lot of possibilities for the implementation of a skybox widget!

Another good idea for skybox-related scripting is a script that changes the skybox along with the weather (from clear, to cloudy, to stormy, etc). I wouldn't recommend using a straight-up heartbeat, but perhaps a pseudo heartbeat might be the right form that such a script could (ideally) take.

Post Reply