Custom gender tokens?

I’ve been reading on how to create custom conversation tokens, and while I’m sure it’s not complex, I’m just not grasping how to do so with what I find on the wiki.

Can someone point the way here?

For now I just wanted to create some different gendered tokens.

Perhaps this will get you started. From my Legacy module:

void main()
{
string gend = “daddy”;
object pc = GetFirstPC();
if (GetGender(pc)==GENDER_FEMALE) gend = “mommy”;
SetCustomToken(101,gend);
}

then in the conversation node:

You’re not my !

Did you try this tutorial?

It’s a bit long-winded, but covers the ground.

P.S. Alternatively, you can add new gendered tokens to stringtokens.2da, then use them in conversation just like the official ones.

The 2da is the way I’d like to go but I was really not grokking how to add them in a way that the game picks up.

For the narrow case of gendered tokens, if you use the existing tokens as a template for new lines (action code 1), it will work fine.

Other cases less useful.

See wiki

Is there something special I have to do to make it use my custom tlk?
It seems to grab it from the base game tlk.

[edit]: Not sure entirely what it’s doing, offsetting? I guess?, but yata has an option to make it use the custom tlk for a given field that worked.

Yes, custom tlk string references must be offset by a magic number. Tools like Yata and the latest tlkedit do that for you on request.

The resulting strrefs will work in any 2da.

The stringtokens addition works locally, but does not on the test server:
image

The hak is on the server … and I rewote the nwsync fully.
Any ideas?

Yes: I would have a look on the code at the first place :slight_smile:

The line of the NPC should read “… my good <CUSTOM4711>. …”
And there must be a script somewhere which is executed before the line appears, which defines the contents of the token. you may put something like this in the “Text appears when” of the line.

int StartingConditional()
{
    SetCustomToken (4711, "paying customer");
    return TRUE;
}

This is using the stringtokens.2da method.

Uh, that’s by far too complicated for me. A simple Method would be to define all static tokens in a single script on startup and the dynamic ones in the dialogue as shown above.

However, without seeing your line in source and some snippets of the 2da, I doubt that anybody could provide much help.

If it works locally then I’d double check that the updated stringtokens.2da is really in the hak you pushed to the server (and re-nwsync’d). Or that you don’t have an overriding old one on there somewhere?

It is indeed in the hak and the should be high on the load order. Is there a way to affirmatively check an assets in the nwsync?