Neverwinter Nights: Enhanced Edition

Neverwinter Nights: Enhanced Edition

Adventures await!
Gather your mods before venturing forth. Discover planes filled with player-created adventures in Steam Workshop, then build your own Neverwinter Nights modules using the Aurora Toolset to share!
Learn More
philbo 1 30 Aug, 2018 @ 11:20pm
Simple conditional script problem
Hey everyone. I'm trying to write a script conditional for a conversation that checks whether the character's level is greater than the npc speaker's level, but I can't get it to work. Please help! Here's what I've come up with:

int StartingConditional()
{
object oPC = GetPCSpeaker();
object oNPC = GetLastSpeaker();

SetLocalInt(oPC, "pclevel", GetHitDice(oPC));
SetLocalInt(oPC, "npclevel", GetHitDice(oNPC));

if (GetLocalInt(oPC, "pclevel") <= GetLocalInt(oPC, "npclevel")) return FALSE;

return TRUE;
}
< >
Showing 1-4 of 4 comments
philbo 1 30 Aug, 2018 @ 11:39pm 
I guess the problem is with GetLastSpeaker(), because if I get an object by tag for the speaker it works. How am I using GetLastSpeaker() wrong? Is it because it is in the conditional script for an NPC's line and it is returning the PC as the last speaker??
wendigo211 3 30 Aug, 2018 @ 11:49pm 
GetLastSpeaker is ♥♥♥♥, it either only works on the players line or the NPCs line (I think it's the NPCs line, but I don't feel like testing). If the NPC is the owner of the conversation you can use OBJECT_SELF. Otherwise use the tag of the speaker.
Proleric 5 30 Aug, 2018 @ 11:51pm 
OBJECT_SELF will identify the NPC correctly.

The Lexicon explains why GetLastSpeaker() doesn't work here:

https://nwnlexicon.com/index.php/GetLastSpeaker
philbo 1 31 Aug, 2018 @ 9:57pm 
Thank you SO much!
< >
Showing 1-4 of 4 comments
Per page: 1530 50