Hi all,
Getting back into modding after a long time, and have chosen NWN2 to build in (for better or worse), as the graphics and visual aesthetics are much more pleasing to me. Glad to see there is still a vibrant modding community for both games!
Anyway, I’m using this following script to trigger a description On Enter, and it should only pop once per game (the module is a single-player deep RP experience, not being tested for multiplayer or online):
/* Put this script OnEnter of a trigger to provide description text
Text should only appear once per game */
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
FloatingTextStringOnCreature("The brazier's embers are warm and inviting.", oPC);
}
It seems to work, but then I ran into the scenario where the PC has not yet triggered the script, but recruits an NPC companion. When I trigger the script while controlling the companion (not the main PC), the text triggers but does so TWICE.
Maybe the current script is considering both the primary character and the NPC companion as “oPC” so double-triggering the text string? How can I fix to have the text only pop a single time regardless of if the main PC or a companion triggers OnEnter? Any tips you can give?
I’m not that well-versed in C or coding in general, so your help is much appreciated.