Hello. I'm having an issue with Sierra-style speech to a character.
I want my player character to say one thing to the sergeant on first speaking to him, something else the second and any subsequent times up until an event happens and then a third thing when speaking to him after that event has happened.
It all sort of works. However, I can't stop him saying the first and second thing together the first time. My code is below. (The event which happens changed the variable sargespoken to 3).
function csarge_Talk()
{
{cEgo.Walk (75, 125, eBlock);
cEgo.FaceCharacter (csarge);
}
if(sargespoken == 0)
{cEgo.Say ("You wanted to see me, sergeant?");
csarge.Say ("Ah, Private Smith. That latrine needs cleaning. Hop to it.");
sargespoken = 1;
}
if (sargespoken == 1)
{csarge.Say ("Have you cleaned that latrine yet?");
}
if (sargespoken == 3)
{csarge.Say ("That explosion came from up the trench!");
}
}
I know its because as soon as the sargespoken value changes to 1 he wants to say the second thing. How can I put a break in so he doesn't?
Thanks
Proper indention would help. but try this: (basically what your missing is an else condition to not check the second if.
function csarge_Talk()
{
cEgo.Walk (75, 125, eBlock);
cEgo.FaceCharacter (csarge);
if(sargespoken == 0)
{
cEgo.Say ("You wanted to see me, sergeant?");
csarge.Say ("Ah, Private Smith. That latrine needs cleaning. Hop to it.");
sargespoken = 1;
} else if (sargespoken == 1)
{
csarge.Say ("Have you cleaned that latrine yet?");
}
if (sargespoken == 3)
{
csarge.Say ("That explosion came from up the trench!");
}
}
Thanks very much. That worked perfectly.