i am having troubles with item pickup script

Started by eatbeans2, Tue 15/07/2008 19:56:53

Previous topic - Next topic

eatbeans2

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

Khris

I assume you're using an object to display the item in the room, right?
It's supposed to be:
Code: ags
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?)

eatbeans2

i got an error message and it woudnt let me play the game

eatbeans2

wen i ty to play it says unable to convert object to inventory item

Khris

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.)

SMF spam blocked by CleanTalk