Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: eatbeans2 on Tue 15/07/2008 19:56:53

Title: i am having troubles with item pickup script
Post by: eatbeans2 on Tue 15/07/2008 19:56:53
i have been working on this for 2 days but i still cant figure it out. the pickup item script isnt working ive tryed everything i can think of but nothing works the script im using is( (item name).visible=false
player.AddInventory(item name);) please help
Title: Re: i am having troubles with item pickup script
Post by: Khris on Tue 15/07/2008 20:07:05
I assume you're using an object to display the item in the room, right?
It's supposed to be:
function oBall_Interact() {
  oBall.Visible = false;
  player.AddInventory(iBall);
}

(Assuming that you're using the Interact mouse mode and the object's scriptname is "oBall" while the inventory item's is "iBall".)

What exactly isn't working? Do you get any error messages? Is anything happening at all when you click the object? (Is the function properly linked in the object's events pane?)
Title: Re: i am having troubles with item pickup script
Post by: eatbeans2 on Tue 15/07/2008 20:12:46
i got an error message and it woudnt let me play the game
Title: re
Post by: eatbeans2 on Tue 15/07/2008 20:18:28
wen i ty to play it says unable to convert object to inventory item
Title: Re: i am having troubles with item pickup script
Post by: Khris on Tue 15/07/2008 20:47:24
Yep, exactly what I thought.

Room objects and inventory items are completely unrelated, except to the game designer.
You'll have to create an inventory item to represent the object in the inventory after it's been picked up.
(I tried to make this clear in my previous post, btw.)