Custom Tokens
Easier than one might think. All a custom token is, is simply a number representation of a string, kinda like the Constants in nwscript. Here is a simple "follow along" tutorial for custom tokens.
- Make a conversation on a NPC like the following,
+Root 1 - NPC: "Hello" 2 - ..PC: "What is your favorite Color?" 3 - ....NPC: "My Favorite Color is <CUSTOM2000>"
Save the file and and attach it to a NPC.
- Place this script in the "Actions Taken" of Line 1. This will set up the custom token for you, chooseing a random color.
void main() { switch(d4()) { case 1: SetCustomToken(2000,"Red");break; case 2: SetCustomToken(2000,"Blue");break; case 3: SetCustomToken(2000,"Green");break; case 4: SetCustomToken(2000,"Yellow");break; } }
Now when Line 3 is spoken, either Red, Blue, Green, or Yellow will be spoken in place of the <CUSTOM2000>.
Some points to remember:
- Custom tokens, once set, will remain set until changed, so be sure to set them up before you need them.
- Custom Tokens will work in the names of placeables, but not NPC names, or Item names.
- They do not work in the descriptions of placeables.
- Custom tokens are global and thus if changed often in dialog, other characters can get the wrong value displayed