Hi
i downloaded ags yesterday and i need help
my problem:
in ags 3.00 i want my character (cEgo) to use inventory number 4 (or Ticket) on character (cEgo1) to get in
to the room 3 (airplane)
please help
function cEgo1_UseInv()
{
cEgo.Walk(110, 165, eBlock);
player.LoseInventory(inventory[4]);
DisplayMessage(17);
DisplayMessage(21);
DisplayMessage(22);
DisplayMessage(23);
player.ChangeRoom(3, 78, 70);
}
It would help if you posted exactly what error/problem you were getting, but I'm guessing that whatever inventory item you use the player will get in. You need a check to find out what inventory item was used, and a way to do this is add an if function to your code...
function cEgo1_UseInv()
{
if (player.ActiveInventory==iTicket)
{
cEgo.Walk(110, 165, eBlock);
player.LoseInventory(inventory[4]);
DisplayMessage(17);
DisplayMessage(21);
DisplayMessage(22);
DisplayMessage(23);
player.ChangeRoom(3, 78, 70);
}else{
cEgo1.Say("I'm sorry, I can't let you in with that");
}
}
The ActiveInventory property holds the currently used inventory item of the player, so you can use this to check which item they just used. Personally I'd name the other character something other than Ego1, as Ego is a recognised way of referring to the player character. Up to you though.
thank you
i appreciate your help :)