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!
Conversational Custom Tokens
Débuté par
Badwater
, août 17 2011 04:21
#1
Posté 17 août 2011 - 04:21
#2
Posté 17 août 2011 - 04:39
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
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!
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
Posté 17 août 2011 - 05:14
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
p.s.
Looks like you just made the 1000th Topic on the scripting boards.
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
Posté 17 août 2011 - 05:34
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.
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 .
#6
Posté 17 août 2011 - 06:17
Thank you, Lightfoot.
* Edit * - works exactly as intended, thanks again!
* Edit * - works exactly as intended, thanks again!
Modifié par Badwater, 17 août 2011 - 07:39 .
#7
Posté 17 août 2011 - 08:57
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. <_<)
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
Posté 17 août 2011 - 02:31
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
Posté 18 août 2011 - 12:53
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
Posté 20 août 2011 - 09:32
Anyone?
All I wanted was a Pepsi.
All I wanted was a Pepsi.
#11
Posté 20 août 2011 - 12:12
We would probably need to see your scripts.
#12
Posté 20 août 2011 - 02:10
#13
Posté 20 août 2011 - 10:14
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.
<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
Posté 21 août 2011 - 10:25
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);
}
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
Posté 21 août 2011 - 03:02
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
Posté 21 août 2011 - 08:44
Thanks! Of course, that took care of the issue.





Retour en haut






