'Type mismatch: Cannot convert Int to inventoryitem*'

Started by testingstuff, Sun 13/08/2006 15:40:38

Previous topic - Next topic

testingstuff

test

Ishmael

, because it's quite clearly stated in there:

AddInventory

(Formerly known as global function AddInventory, which is now obsolete)
(Formerly known as global function AddInventoryToCharacter, which is now obsolete)


Character.AddInventory(InventoryItem *item, optional int addAtIndex)

Adds the specified item to the character's inventory. This ensures that the item gets added to the character's inventory list, and that any on-screen inventory display gets updated if appropriate.
The first parameter is the inventory item's Script O-Name from the editor (for example, iPoster).

By default, the new item is added to the end of the character's inventory list. However, you can insert it in a particular position in the list by supplying the second parameter. The new item is inserted before the current item at addAtIndex. Indexes are numbered from 0, so to add the item at the start of the list, pass 0 as the second parameter.

Example:

character[EGO].AddInventory(iKey);

will give inventory item iKey to character EGO.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

monkey0506

If you want to use an integer index, you can do it like this:

Code: ags
cEgo.AddInventory(inventory[1]);

SMF spam blocked by CleanTalk