This is a very simple system for getting NPC's name to be revealed only after the PC speaks with them and the NPC introduces himself/herself. But it is more too, under this system the NPC's name will only be revealed to the PC who he introduced himself/herself to, and not all the PC's that percieve him/her, other PC's will still not "see" his/her name.
I did this because of a thread I read in the NWN2 forums where it was said "I always thought it stupid you knew an NPC's name before you met him".
Here is the short run down of how it works.
Simply import the Erf into your module and select yes to overwrite all resources, "x2_def_percept" will be overwritten.
In any line **except the very first line, this will not work and the entire conversation will not activate if you put this in the first line of the dialogue** of the conversation file for any NPC where they speak their name somewhere in that conversation, put the script "reveal_name". Make sure the PC has to see and **use** the line of dialogue where this script is in the "actions taken" tab. The best place in my opinion would be **all** the "End Dialogue" lines in the conversation, but any line that will be used will do except the first.
And you are good to go, the NPC's name will be revealed to only the one he/she introduced him/herself too.
***Note please don't use this if in your conversation the NPC never says his/her name. :P
***To use this system with default NPC's/creatures always make sure "x2_def_percept" is the script name in the "On_Percieved" tab in the creature script properties. Most cases it already is, but some default creatures in the toolset have a different script (earlier one).
***Right now this is not persistent in multiplayer but could very very easily be adapted to persistence. Although names will be revealed only to the player the NPC greeted, that player would see the name disappear if another player came into the area with the NPC who wasn't "introduced" yet, of course the original player would still know the NPC's name. I know using conditionals the appearance of the NPC only introducing him/herself once per player can be easily adapted.
Included in the rar is the Erf for importing and a small demo mod to see it in action. To use the demo, talk to the NPC, then go into the other area and use the switch, then when you go back to him he will not have a name. This was the only way I could test multiple players without multiple players. :P
Enjoy!
PS: To all scripters out there this entire system is based of the difference between "" and " " ;)
Posted by ShaDoOoW at 2009-01-29 15:11:34 Voted 9.00 on 01/29/09
Great idea.
Shame, this cannot be implementated in MP properly, but in SP this is totally perfect! However scripts could be better, i suggest move that ExecuteScript to nw_c2_default2, then there won't be that issue and builder won't need to change anything in creature properties.
after this line, "NPC's conversation you can use" it should read CUSTOM102, in brackets. I guess the board doesn't like the greather than/less than symbols.
I love the idea, but this seems so complicated - Am I missing something?
In the toolset, give all NPCs a string variable called sNPCname, and when you place the NPC, adjust that variable's value to the name you want for the NPC.
in the standard OnConversation (nw_c2_default4) script, put:
SetCustomToken(102, GetLocalString(OBJECT_SELF, "sNPCname"));
I'm using token 102 for that, obviously use whatever one you want.
Now, anywhere in the NPC's conversation you can use and during conversation, it will display the NPC's name.
Other players will still just see "Male Half-elf" on a mouse-over.
If this is a single-player module and you don't care, you can put this script in the Action Taken of whatever line the NPC reveals the name first:
SetName(OBJECT_SELF, GetLocalString(OBJECT_SELF, "sNPCname"));
One final note about this ""/" " variation, it appears that (at least in my demo, as Bob Mcfly is named with both slots, first/last) first and last names do not matter.
"" will always set the creature's name to it's given name in the toolset, and " " will always blank it out. Though since all creatures have first and last name slots one would think it would actually have to be """"/" "" ".
As long as you tagged the NPC's Helmet as NPC_Helmet (and he had it equipped prior to the conversation :P), he would appear to take of his helm and only after (6 seconds after propably but hey, NWN isn't perfect :P) the player would "recognize" him...
Because this uses the SetName function, and a creature can only have one name, this is a case of one or the other, eith er the true name will be displayed, or no name, it cannot be both at the same time for two different players. Hence it will always work fine for a one (single) player module.
This was my original intention.
It -could- work in multi as I explained, but what will happen is that player A and B will log in (using the demo mod as an example), niether will "see" the NPC's name, when player A has the conversation the same will be displayed. Player B will also see it unless he was to go to the second area and come back. then niether would see the name again. If player A was to have the conversation and player B stayed in the area while player A left and pulled the switch, player B would see the name vanish when player A re-entered the area. If player A did not pull the switch, player B would not see the name vanish.
This sounds a little confusing, and I used On_Percieved instead of On_ Heartbeat because this is just a demo of the basic concept. I can only script so much and my concern was mainly single player modules. If I used on heartbeat and a normal multiplayer module was implemented with this sytem, the NPC would most likely never have a name displayed because a player that he hasn't "met" would almost always be within the vicinity to activate the heartbeat, whether this was area wise/global or whatever.
...Okay, that was a little long winded, but think of it this way. When the NPC sees a player he hasnt "talked to" yet, his name is "turned off" when he sees a player he has, his name is "turned on", i.e. the beauty of LocalInt's.
But since his name cannot be "off" and "on" at the same time, yes in multi this will lead to a "dissappearing name" effect.
As I say feel free to expand on this, I put it up as something to work from.
Needs a little tweaking - currently it works the opposite way from that intended in multiplayer. If a player talks to the npc, everyone else can see the name, but the one who talked to the npc can't.
Posted by roane242 at 2006-06-18 15:37:11 Voted 9.75 on 06/18/06
Me too. Great idea! I'm going to test it out in the Anchorome module I'm working on.
Posted by Fleshmelter at 2006-06-18 14:40:01 Voted 9.75 on 06/18/06
I voted on it without testing for the simple concept of it, excellent idea! _________________________ PW Action Server:
| Chaosgate |
You must be Logged In to post comments in this section.