So I think this could be solved through custom tokens, but I’m not sure how to do it.
What I want is to print a changing variable in a conversation. I’ve made an NPC skill trainer that charges 10000 GP the first time he’s used, 20000 GP the second time, 30000 GP the third time, and so on. All I want to do is have the current cost of his services show in his dialogue, so players won’t just lose money without an explanation.
I’m currently implementing this by using the following bit of script, with ‘costcheck’ starting at 0:
// Set a local integer.
nValue = GetLocalInt(oPC, "costcheck") + 1;
SetLocalInt(oPC, "costcheck", nValue);
// Take int x 10000 gold from the PC.
TakeGoldFromCreature((nValue * 10000), oPC, TRUE);
I’ve already tried several implementations based on that page and none of them worked, so I think I’m just not getting it. Thank you for trying to help, though! I appreciate it.
The script you shared is the ActionsTaken script for the conversation?
However, you need to declare the Custom Token in the TextAppearsWhen script slot.
[code]
// Set a local integer.
nValue = GetLocalInt(oPC, “costcheck”) + 1;
// Take int x 10000 gold from the PC.
int nAmount = (nValue * 10000)
//turn it into a string
string sAmount = IntToString(nAmount);
//Set Token - lets us 9999, but replace with whatever number
//you are putting in the conversation
SetCustomToken(9999, sAmount);
----------------[/code]
Then in the line of conversation you have the trainer say “I will charge you .”
edited repeatedly because I have no idea how to format this correctly - sorry
You can format using bbcode. For example, you’d use code… /code around each block of nwscript (with square brackets) to separate it from the narrative text of your reply.
Alternatively hightlight your code and press the </> button at the top of the editing window. That is for
pre-formatted text. It’s one of the things I mentioned in the pinned short tour thread.