My game features 3 playable characters, who you can control anytime you want and will say different things when interacting with people/objects.
What i'm having trouble with, is having different dialogs for each object, depending on who's in the room with you.
For example:
if BARRY is in the room on his own and looks at a car, he'll say "Nice Car".
But if JOHN is in the room with him, he'll say something else like "Can I drive your car?" and JOHN replies with "No."
Whenever i try to do that, it'll always say the "Nice Car" bit first, regardless if he's on his own or not.
This is the code i have.
function hCar_Look()
{
if (player == cBarry) {
cBarry.Say("Nice car.");
}
if (player.Room == cLee.Room)
if (player == cBarry) {
cBarry.Say("I like his car?.");
if (player.Room == cLee.Room) cLee.Say("We should take it for a drive.");
if (player.Room == cBarry.Room) cBarry.Say("I'll get John's permission first.");
}
if (player.Room == cJohn.Room)
if (player == cBarry) {
cBarry.Say("Can I drive your car John?.");
if (player.Room == cJohn.Room) cJohn.Say("No, no you can't.")
I'm not sure if that makes any sense or not, if it doesn't i'll try to explain a bit more clearly when i'm less tired.
What i'm having trouble with, is having different dialogs for each object, depending on who's in the room with you.
For example:
if BARRY is in the room on his own and looks at a car, he'll say "Nice Car".
But if JOHN is in the room with him, he'll say something else like "Can I drive your car?" and JOHN replies with "No."
Whenever i try to do that, it'll always say the "Nice Car" bit first, regardless if he's on his own or not.
This is the code i have.
function hCar_Look()
{
if (player == cBarry) {
cBarry.Say("Nice car.");
}
if (player.Room == cLee.Room)
if (player == cBarry) {
cBarry.Say("I like his car?.");
if (player.Room == cLee.Room) cLee.Say("We should take it for a drive.");
if (player.Room == cBarry.Room) cBarry.Say("I'll get John's permission first.");
}
if (player.Room == cJohn.Room)
if (player == cBarry) {
cBarry.Say("Can I drive your car John?.");
if (player.Room == cJohn.Room) cJohn.Say("No, no you can't.")
I'm not sure if that makes any sense or not, if it doesn't i'll try to explain a bit more clearly when i'm less tired.
