The game I'm currently working on features more than one player character talking to the same NPC.Ã, Rather than rewrite entire dialogues just to change the name, I was wondering if there was a way to get the character's name?
Example:Ã, Alice goes up and talks to Mr Flip
Alice: Hi, how are you?
Mr Flip: Hi Alice.Ã, I'm fine thankyou.
The player then switches to Ben, who goes up and talks to Mr Flip
Ben: Hi, how are you?
Mr Flip: Hi Ben.Ã, I'm fine thankyou.
(A/N: This example wasn't taken from the actual game ;D)
Instead of writing separate dialogues for Alice and Ben, is there a way of scripting it so that Mr Flip says, "Hi CHARACTER.Ã, I'm fine thankyou."?Ã, Please can someone help me with this?
cFlip.Say("Hi %s. I'm fine, thank you.", player.Name);
And:
If you want to use this inside an actual dialog, you'd use the dialog_request function.
Instead of writing e.g.
flip: Hi Alice, I'm fine, thank you. inside the dialog script, enter
run-script 1, then add this to the global script:
function dialog_request(int param) {
Ã, if (param==1) cFlip.Say("Hi %s. I'm fine, thank you.", player.Name);
Ã, if (param==2) cFlip.Say("Ok, see you later, %s.", player.Name);
Ã, ...
}
Of course you can use this to give different responses, too.
Ã, if (param==3) {
Ã, Ã, if (player==cAlice) {
Ã, Ã, Ã, cFlip.Say("Ok, what do you want to know?");
Ã, Ã, Ã, // unlock dialog options / give inventory items
Ã, Ã, }
Ã, Ã, if (player==cMeanie) cFlip.Say("I'm not talking to you.");
Ã, }
The possibilies are endless ;)