Aller au contenu

Photo

SLS bug fixed, for usable placeables initially in on state.


  • Veuillez vous connecter pour répondre
Aucune réponse à ce sujet

#1
kamal_

kamal_
  • Members
  • 5 250 messages
In the SLS link there is a bug with usable placeables such as campfires that are designed to be turned on and off, when they are on to start with (startstate = on) in the variables of the placeable.

If they are on to start with, the first time you use an on placeable, it remains on. Subsequent times the placeable turns off/on correctly, but any vfx remains whether they are on or off (it actually gets recreated, effectively remaining "on").

In the function SLS2Initialize in ginc_sls2, the last section of the function looks like the following.

        } else {
            if (sStartState=="off") {
                SLS2SetLightState(oFitting,SLS2_LIGHTSTATE_PERMAOFF);
                SetLocalInt(oFitting,"sls2_state",SLS2_LIGHTSTATE_PERMAOFF);
            } else {
                SetLocalInt(oFitting,"sls2_state",SLS2_LIGHTSTATE_PERMAON);
            }
        }
        SetLocalInt(oFitting,"sls2_init",1);
        // set light to relavant starting state
        SLS2SetLightState(oFitting,SLS2CalcLightState(oFitting));
    }
}

------------------------------------------------------------------------------------------------------------------
the line:  SetLocalInt(oFitting,"sls2_state",SLS2_LIGHTSTATE_PERMAON); should be
SetLocalInt(oFitting,"sls2_state",SLS2_LIGHTSTATE_ON);
and the placeable will behave correctly, with initial use of the placeable correctly turning it off, and any associated vfx correctly appearing/disappearing based on state. A builder might want to have separate versions of this file so they can also use the default behavior.

This is in addition to the nwn2 light tag bug (saving and reloading the game causes lights to lose their tags, breaking SLS.), which can be resolved for SLS via the following: (link)
in ginc_sls2, line 352 is:
string sLightTag = GetLocalString(oFitting,"lightTag");

comment that out and replace it with
            //work around tag bug. kamal
            object oLight = GetNearestObject(OBJECT_TYPE_LIGHT, oFitting, 1);
            string sLightTag = GetLocalString(oFitting,"lightTag");
            SetTag(oLight, sLightTag);

Modifié par kamal_, 18 novembre 2012 - 01:19 .