Aller au contenu

Photo

Bug with GetFirstName()


  • Veuillez vous connecter pour répondre
14 réponses à ce sujet

#1
Tchos

Tchos
  • Members
  • 5 063 messages
I received a bug report that I can't figure out.  An NPC, who uses GetFirstName() to deliver personalised barks, referred to one of my companions as "Elanee", but her name is not Elanee, and it doesn't say "Elanee" anywhere in her properties, except for her voice set.  Her first name is Thalrissa, and she has no last name.  She has a standard Elf
appearance, standard companion scripts, no variables, and a standard "druid, shaman" starting package.

Modifié par Tchos, 13 août 2013 - 06:36 .


#2
diophant

diophant
  • Members
  • 116 messages
I had some problems with that function, too (or was it GetName()? ). There seems to be an issue if you change the name of an object in the toolset. My scenario was as follows:
I have a bilingual mod, and in some cases, I need to know which language to use. So I placed a beetle mound in a hidden area, renamed it to "English" in the english version and to "German" in the german version. I had a nice function to get out the used language
int getLanguage()
{
  string language = GetFirstName(GetObjectByTag("RB_O004languages"));
       
  if (language == "German")
    return 1;
  else
    return 0;
}
Then, after applying a NWN2 patch (don't remember which one), it stopped working. After some debugging, I realized that GetFirstName returns the original name from the template, not the one that I set. So now I check if (language == "Käferhaufen").

I haven't tested whether something changes when you first create a blueprint, change the name there, and then place the object.

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Tchos,

Delete the "original" name in the string reference section. i.e. Click on the name drop down menu and then click on the "Edit String Ref" button, and then click "clear", followed by "OK".

The function will then recall your name and not the original that is still there in this section.

Lance.

Modifié par Lance Botelle, 13 août 2013 - 06:48 .


#4
Tchos

Tchos
  • Members
  • 5 063 messages
Aha! Diophant, based on what you said, I was about to test it after adding a scripted "SetFirstName()" to the initial conversation, but Lance, what you describe looks like just the thing! I'll check all of my companions for errant string refs now. Thanks!

#5
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Tchos wrote...

Aha! Diophant, based on what you said, I was about to test it after adding a scripted "SetFirstName()" to the initial conversation, but Lance, what you describe looks like just the thing! I'll check all of my companions for errant string refs now. Thanks!



Hi Tchos,

Your problem sounds like the one I had encountered, so I hope it resolves it for you. :) Funny enough, I still forget to do this occasionally. Only today, I had to do the same thing to an item I had made.

Lance.

#6
Tchos

Tchos
  • Members
  • 5 063 messages
It probably also explains a problem I had earlier with an object I was using to utter a dead NPC's "dying words" via SpeakString() (which the NPC itself couldn't do because it was dead), but the object refused to use the name I had given it, and kept calling itself by its template name. This will probably fix that.

I checked the rest of my companions, and since most of them were based off the first one, 4 out of 6 of them would have been called Elanee if not for this!

Modifié par Tchos, 13 août 2013 - 07:06 .


#7
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
From the Broken Functions List:

GetFirstName
Does not return toolset edited FirstName value, will return correct value but only after SetFirstName has been called
Workaround: Assign value as variable, then set in OnSpawn

#8
Tchos

Tchos
  • Members
  • 5 063 messages
That workaround was not necessary after clearing the string ref as Lance suggested. I did not need to use SetFirstName(), as GetFirstName() returned the correct value in my test.

#9
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
Why not just use the <FirstName> bit already in the conversations tab ? There are loads of things that are race,time,class specific to be found in a dropdown list so you could be spending a lot of time with something that takes 1 second to click and if it's an npc talking just use the <him/her> <he/she> bit.

#10
Tchos

Tchos
  • Members
  • 5 063 messages
Because the NPC involved is not in conversation with the player, I have to get the information through script.

Modifié par Tchos, 14 août 2013 - 05:50 .


#11
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
Excuse me for being obtuse but surely you made all the NPC's so you must know their names and couldn't the barkstring NPC just say Thalrissa ? If it's a party thing and you want to see if she's in the party before he shouts something then the gc is in party condition on the barkstring would do it.

Whatever, at least it's working, I'm just thinking of script free options which is my preferred method of operation.

#12
Tchos

Tchos
  • Members
  • 5 063 messages
No, because she's not the only one that I want the NPC to address, and you might not have Thalrissa in your party, and she might not be the one you're controlling, and you might choose to have a party made completely of your own characters instead of the NPC party members I provided, or a combination thereof. As I wanted, these barking NPCs address the character that you're controlling, whoever it is. Trust me, this is the way I want it. I'm perhaps the opposite in methods, where I freely use scripts to do exactly what I want, even if there's an almost good enough substitute that could be done without scripting.

Modifié par Tchos, 14 août 2013 - 07:17 .


#13
I_Raps

I_Raps
  • Members
  • 1 262 messages
Image IPB
Uploaded with ImageShack.us

Modifié par I_Raps, 14 août 2013 - 07:48 .


#14
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
Image IPB

#15
Dann-J

Dann-J
  • Members
  • 3 161 messages
It's so much easier when your bark-string NPCs are all rude and abrupt:

"Go away"
"Leave me alone"
"P*ss off"

Or as Xzar would say in Baldur's Gate:

"Stop touching me!"