Hi!
Here's my problem. I wan't the player to say something for one specific inv item, something else for the second, and one general sentence for all other inv items.
My code so far:
function oBRANCH_UseInv()
{
if (player.ActiveInventory == iHANDSAW) {
player.Say("You'd have to use your stonger hand.");
}
if (player.ActiveInventory == iHANDSAWRAG) {
player.Say("Well, alright.");
player.Walk(123, 108, eBlock);
object[0].Visible=false;
player.AddInventory(iBRANCH);
}
else {
player.Say("I can't cut it with this.");
}
}
Currently "I can't cut it with this" is displayed as I wanted - when items other than those two specified are used, but it is also displayed after the sentence of the first item. What am I doing wrong?
You are missing "else" before second "if".
if (player.ActiveInventory == iHANDSAW) {
player.Say("You'd have to use your stonger hand.");
}
/* HERE!!---> */ else if (player.ActiveInventory == iHANDSAWRAG) {
player.Say("Well, alright.");
player.Walk(123, 108, eBlock);
object[0].Visible=false;
player.AddInventory(iBRANCH);
}
else {
player.Say("I can't cut it with this.");
}
Basically you structure should be:
if ()
else if()
else if()
.....
else
Thank you so much Wizard!