Coversation calling localint

Information and Discussion Relating to NWN2 Scripting and Coding

Moderators: Moderator, Developer, DM

LordLP
Posts: 213
Joined: Wed Nov 10, 2010 5:01 am

Coversation calling localint

Unread post by LordLP »

Figured this falls within the 'Scripting' topic. I can not recall how to do this, and it's driving me nuts.

So.. you got a localint set to oX - there was a way in nwn1 to recall that int in conversation.

EXAMPLE: "I am the shopkeeper, you are the (insert localint here) visitor!"

I'm drawing a complete and utter blank, and finding no searches helping me. Anyone can help I'll be eternally grateful!
Arcon Anatox - Councilor of the Silver Shield
Lilly Underburrow - Not much other then scared
Luna
Retired Admin
Posts: 7945
Joined: Sat May 16, 2009 3:00 pm

Re: Coversation calling localint

Unread post by Luna »

Under conditions in a conversation.
It has a pertty handy search.

Go to conditions and add a function.
Click the blank function and it will bring up a search.

Look up the function below and add it.. refresh the variables and add the variables.



// gc_local_int(string sVariable, string sCheck, string sTarget)
/* This script checks a local int variable's value.

Parameters:
string sVariable = The name of the variable
string sCheck = The operation to check on the value of the variable.
Default is ==, but you can also specify <, >, or !
e.g. sCheck of "<50" returns TRUE if sVariable's value is <50
a sCheck of "9" or "=9" returns TRUE if sVariable's value is equal to 9
and a sCheck of "!0" returns TRUE if sVariable's value is not equal to 0.
string sTarget = Tag or identifier of Target. If blank then use dialog OWNER.
*/
// FAB 10/4
// EPF 4/12/05 changing variable names and implementation,
// adding != functionality, moving common things to ginc_var_check
// ChazM 4/15 change implementation, added PrintString
// BMA 4/27/05 new description, added GetTarget()
// BMA 7/19/05 added object invalid printstring

#include "ginc_var_ops"
#include "ginc_param_const"

int StartingConditional(string sVariable, string sCheck, string sTarget)
{
object oTarg = GetTarget(sTarget, TARGET_OBJECT_SELF);
if (GetIsObjectValid(oTarg) == FALSE) PrintString("gc_local_int: " + sTarget + " is invalid");

int nValue = GetLocalInt(oTarg, sVariable);
int iRet = CompareInts(nValue, sCheck);

PrintString ("gc_local_int: nValue = " + IntToString(nValue) + ", sCheck = " + sCheck + " -- return val: " + IntToString(iRet));
return (iRet);
}
LordLP
Posts: 213
Joined: Wed Nov 10, 2010 5:01 am

Re: Coversation calling localint

Unread post by LordLP »

I mean in an actual conversation - still active - with an NPC. There was (or is) a way to directly modify a conversation to pull up a LocalInt and speak it - similar to how <Alignment> or <Him/Her> works in a conversation. I did it with, ironically, exactly what I'm using it for now in nwn1.

It wouldn't be viable to create a conditional in this situation, as I would have to have nearly 300 threads added to the conversation. (the localint I need to report can be anywhere between 1-150 just about - but it needs to be reported).

Worst case scenario I can just send it as a server message, but there still has to be a way to do it.
Arcon Anatox - Councilor of the Silver Shield
Lilly Underburrow - Not much other then scared
LordLP
Posts: 213
Joined: Wed Nov 10, 2010 5:01 am

Re: Coversation calling localint

Unread post by LordLP »

So I had to download nwn1 and pop in the old WD mod to figure it out.. custom tokens!!

SetCustomToken(int nCustomTokenNumber, string sTokenValue);

So..

SetCustomToken(1000, IntToString(nVarable));


"I am the shopkeeper, you are the <CUSTOM1000> visitor!"
Arcon Anatox - Councilor of the Silver Shield
Lilly Underburrow - Not much other then scared

Return to “NWN2 Scripting”