Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ManicMatt on Thu 01/01/2015 23:35:23

Title: Three items check
Post by: ManicMatt on Thu 01/01/2015 23:35:23
Hello, old timer ManicMatt here. I have been able to retrieve my old game in progress from years ago (Long story) and I have EGO talk to a character, run script 20, then the game crashes if EGO doesn't and says the character doesn't have the inventory items. I want the game to check if EGO has all three, then the next line of script kicks in, otherwise he says something else and we are returned to the dialogue options.  Please help! I searched the forums but strangely couldn't find an answer! (I've been at this for hours!)

Code (ags) Select

if (value==20){
if (player.ActiveInventory == inventory[26]) player.ActiveInventory = inventory[21]; player.ActiveInventory = inventory[18];
character[EGO].Say("I have all three!");
}
else {
  character[EGO].Say("I haven't got all three!");
}
}
Title: Re: Three items check
Post by: Gurok on Thu 01/01/2015 23:46:02
I think your if statement is a little bit off. Try this:

if (player.HasInventory(inventory[26]) && player.HasInventory(inventory[21]) && player.HasInventory(inventory[18]))
Title: Re: Three items check
Post by: ManicMatt on Fri 02/01/2015 19:40:39
That did the trick! Thanks a million!! The dialogue is placeholder by the way!