I kind of got in a bit of a mess when trying to make only ONE item open a chest. Can anyone help?
PS If this is too complicated and the moderators delete this, ill understand.
function igumkey_a;
function oChest_UseInv()
{
if (player.ActiveInventory == igumkey)
{
player.LoseInventory(igumkey);
player.Say("Great it's unlocked!");
oChest.Graphic = 6;
chestUnlocked = true;
}
else
{
player.Say("As you can see, it's locked and I need some sort of key");
}
}
function oChest_Interact()
{
if (!chestUnlocked)
{
player.Say("It's locked, and I can't reach inside.");
}
else
{
if (!chestEmpty)
{
player.Say("Now I have the camera.");
player.AddInventory(icamera);
chestEmpty = true;
oChest.Visible = false;
}
else
{
player.Say("Nothing in that chest.");
}
}
}
It seems you made a mess between your own code and the one I send you, so I'll run it past again:
1) In AGS, you can not simply copy code someone wrote into an empty room script (as I already told you several times). You need to set up interactions by clicking on the little button with the flash icon, and then enter the code in between those {} brackets (as I told you several times too). While the code you send seems mostly functional- where is it, and what happens when you compile it?
2) You seem to use variables I provided in my code without declaring them first. This will result in your game not compiling. (I told you too, I think, several times).
3) You seem to include the header to a function (iGumkey_a) without reason. This will also cause errors.
To allow people to help you, please include:
* What exactly happens when you compile this? Do you get error messages? Does something not work?
* Where is the code you posted? Global script, room file?
* Which version of AGS do you use?
That way forum members will have a much easier job helping you.
[action]resumes playing Peggle[/action]
You already posted this in the Beginners forum. Please DO NOT double post threads.