nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
129 stars 92 forks source link

NWN_Object_GetInt does not persist values in cutscene #1192

Open weavejester opened 3 years ago

weavejester commented 3 years ago

I have an odd bug where NWN_Object_GetInt returns 0 for a variable, while in the character bic file I can see that the value is 16.

This occurs during the beginning 'cutscene' conversation of our module, before the PC is granted full control over their character. My guess is that NWNX variables from the character file are not loaded until the PC is given control of their character, possibly because the events NWNX hooks into to load the data haven't fired yet.

If I set a persisent variable in this cutscene with NWN_Object_SetInt it is written to the character's bic file. I can retrieve this variable with NWN_Object_GetInt. But if I exit and relog before the cutscene has completed, then NWN_Object_GetInt returns 0, despite being able to see the value in the .bic file aas having been set correctly.

mtijanic commented 3 years ago

Daz' WAR from discord:

// NWNX_ON_CLIENT_DISCONNECT_BEFORE
void main()
{
    object oPC = OBJECT_SELF;
    if (GetCutsceneMode(oPC))
        SetCutsceneMode(oPC, FALSE);
}

Cutscene mode will drop another TURD and exiting while it is enabled will (re)store the wrong values.