SetCustomToken(int, string)
Sets the value for a custom token.
void SetCustomToken( int nCustomTokenNumber, string sTokenValue );
Parameters
nCustomTokenNumber
The number of the custom token.
sTokenValue
The string value for the custom token.
Description
Sets the value for a custom token to be used in a conversation.
You can set the custom tokens in any script, however you may consider setting the tokens in StartingConditional script to keep things contained.
Custom tokens are local to each conversation instance. So if you attach the same conversation to two different NPCs (or placeables, or whatever) as long as all CustomTokens used in the conversation are set by scripts attached to the conversation, you don't have to worry about overlapping token numbers with other conversations, or instances of the conversation.
Remarks
Custom tokens 0-9 are used by Bioware and should not be used.
There is a risk if you reuse components that they will have scripts that set the same custom tokens as you set. To avoid this, set your custom tokens right before your conversations (do not create new tokens within a conversaton, create them all at the beginning of the conversation).
To use a custom token, place
SetCustomToken can also be used to give a name to some placeables, although not creatures or map notes.
For completeness it goes roughly as follows.
In the module OnLoad event place the command:
SetCustomToken("501", "Bill's Brazier");
And in the name of the Brazier put:
SetCustomToken could go anywhere provided it was executed before the object was created. Trying to change the name with SetCustomToken certainly doesnt seem to change the name of the brazier after it has been created.
You can also use tokens in journal entries and in placeable names. Note that, for placeable names, any player in the area of the placeable whose name is updated using SetCustomToken will not see the name change. He'll have to leave the area and reenter before the name gets updated to him.
All objects which share the same blueprint number have their token value updated when this function is called.
Version
1.61
Example
// The custom token created here can be used in // a conversation by typingint StartingConditional() { SetCustomToken(100, GetName(GetPCSpeaker())); return TRUE; }
See Also
categories: | Conversation Functions | Miscellaneous Functions |
author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Vincent Bairan, Andy Lange, Jonathan Williams, Lilac Soul, Orca
Send comments on this topic.