Aller au contenu

Photo

Conversational Custom Tokens


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

#1
Badwater

Badwater
  • Members
  • 113 messages
I need some help on a basic question. I'm afraid I get some good ideas going and have zero scripting know-how to follow through with it.

This is a conversation where I want a follower of a diety to greet them using the diety's name. I wanted to used a custom conversational token so that I could have a string variable on the NPC and use any diety's name in the greeting.

The conversation might go as:

<CUSTOM30300>'s blessings to you!

For Action Taken on that line of conversation I had this script:

void main()
{
    string sDiety;

    SetCustomToken(30300, sDiety);
}


Then the NPC has a string name in their variables of sDiety

What am I neglecting here? The conversation comes out as:

's blessings to you!

Sorry to bother you folks with something basic, but custom tokens are new to me and I've spent a lot of time getting to this point. Thanks for all your help!

#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
First the Action Taken script does not fire ontill after the line is displayed.  Therefore the token will not be set when the line is displayed,  and it has to be set before it is displayed. 
second

Badwater wrote...


void main()
{
    string sDiety;

    SetCustomToken(30300, sDiety);
}



sDeity is not given a value therefor it is euqal to "".
You would need something more like
string sDiety= GetDeity(oPC);

of cource if the diety field is already set for the PC you could just use.
<Deity>'s blessings to you!

Modifié par Lightfoot8, 17 août 2011 - 04:39 .


#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
sorry, looks like I only half answered the question above. 

To get the token set before the conversation node is displayed you can use the Text appears when script to handle it.  Something like

int StartingConditional()
{
    string sDiety = GetLocalString(OBJECT_SELF,"VAR_NAME");

    if (sDiety=="")  sDiety = "Luck";
  
   SetCustomToken(30300, sDiety);

   return TRUE; // the nood will always show.


p.s. 
Looks like you just made the 1000th Topic on the scripting boards. 

Modifié par Lightfoot8, 17 août 2011 - 05:19 .


#4
Badwater

Badwater
  • Members
  • 113 messages
Well, rather than using the PC's deity, I want the NPC to have a deity variable because the NPC will be a follower of sDeity and have the appropriate variable on them. That way I can use a few greetings for any of the deities on our PW.

So I guess that crux of my question concerns having the custom token use the sDeity variable that will be a string variable on the NPC.

Modifié par Badwater, 17 août 2011 - 05:39 .


#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
the answer is just above your last post.  Link

#6
Badwater

Badwater
  • Members
  • 113 messages
Thank you, Lightfoot.

* Edit * - works exactly as intended, thanks again!

Modifié par Badwater, 17 août 2011 - 07:39 .


#7
Badwater

Badwater
  • Members
  • 113 messages
When a custom token is used, is that the only instance in a conversation in which that custom token can be used?

I ask because the first line works fine and the conversation uses the sDeity variable from the NPC. I don't seem to be having any success in using that custom token in any configuration later in the dialogue tree. To try and find out what might be going on I just put in a standard line on the first line of the conversation and then tried using the custom token along with the conditional and action script a few lines down in the tree and got nothing.

So what am I not getting here? (btw, this is why I hate scripting issues...my work grinds to a complete halt when I have to do quest and script work. <_<)

#8
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
The token should still work. It will also keep what ever you set it to, Untill either you change it or it is changed by another script. So if you where doing tis for say a single player module, you could set the token when the conversation started and use it during the entire conversation, without fear of it changing. MP modules would be a different matter all together.

#9
Badwater

Badwater
  • Members
  • 113 messages
So what in the world might be causal if the token is used later in the dialogue tree but does not appear in conversation? That's what is happening and for the life of me I can't figure out why.

#10
Badwater

Badwater
  • Members
  • 113 messages
Anyone?

All I wanted was a Pepsi.

#11
Baragg

Baragg
  • Members
  • 271 messages
We would probably need to see your scripts.

#12
henesua

henesua
  • Members
  • 3 879 messages
 FYI - You can also create new tokens in custom content (2da and custom TLK)

Thread Here

#13
Badwater

Badwater
  • Members
  • 113 messages
First line of dialog:

<CUSTOM30300>'s blessings to you! What can I do for you?

Text Appears When:

int StartingConditional()
{
string sDeity = GetLocalString(OBJECT_SELF,"sDeity");

if (sDeity=="") sDeity = "Good Fortune";

SetCustomToken(30300, sDeity);

return TRUE; // the nood will always show.
}


Actions Taken (same line):

void main()
{
string sDeity;

SetCustomToken(30300, sDeity);
}


The sDeity on the NPC shows up in the NPCs conversation on this first line. When I use the custom token later in dialog nothing happens (so no <UNRECOGNIZED TOKEN> or any other token msgs.

#14
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
That ActionsTaken script is setting the custom token to a blank string. string sDeity needs to equal something. And you shouldn't need it if you are already setting the custom token in the starting conditional script.  Try getting rid of the actions taken script all together and see if it helps.

If you do need to use the actions taken script though to make sure you keep the custom token refreshed for multiplayer conversation purposes or what not, then you need to keep it more like what the starting conditional is like:

void main()
{
    string sDeity = GetLocalString(OBJECT_SELF,"sDeity");
    if (sDeity=="") sDeity = "Good Fortune";

    SetCustomToken(30300, sDeity);
}

Modifié par GhostOfGod, 21 août 2011 - 10:32 .


#15
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Your best option is to just remove that Action taken script. Do your refreshing in the Text appears when script if needed(Multiplayer games).

#16
Badwater

Badwater
  • Members
  • 113 messages
Thanks! Of course, that took care of the issue.