I'm an intermediate-level scripter. I've been poring through NWN Lexicon and the old forum archives for a way to do what I want, but I keep seeing that NWNX is needed. Perhaps that's still the case, but perhaps not; a lot of the posts I found seemed fairly old. (For the record, I'm not opposed to using NWNX at all. I just don't like the idea of forcing my module's potential players to use it too, just for the sake of one little thing.)
Anyway, I want to write a script that will check if the PC has a last name. If the PC doesn't, then he or she will be given a default last name. The trouble is, the function GetName is described in the Lexicon as follows: "Returns the first and last name of oObject. In the case of creatures, returns first and last names together as single concatenated string." So how do I separate the last name from the first name? This is even leaving aside for the moment the fact that, without NWNX, there doesn't seem to be a function that will set a PC's name (as opposed to, say, that of an NPC).
If anyone is wondering why I don't just tell all players to make sure their character has a last name as part of the module description (and thereafter just use the standard <LastName> token in conversation), the trouble is that I am using a background system that gives the player a different role in the story based on the PC's class and alignment. If the PC meets certain criteria, s/he will be a member of a family of particular historical importance, and the module will use the PC's last name at all times when referring to that family. If the PC meets different criteria, an NPC will take on that role, and the module will use that character's last name instead. Accordingly, it would be really handy if I could make a custom token and set it as the PC's last name or the default last name (depending on what the PC is like). Otherwise, I'll have to put a boatload more conditionals into my conversations every time I want to mention the family. It's doable, but it'll be awkward. Something nice and simple that I only have to do once, at the start of the module, would be much better.
Thanks for reading!
'>
Modifié par Estelindis, 29 août 2011 - 08:10 .