spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * Character functions and properties

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:

cEgo.AddInventory(iKey);
will give inventory item iKey to character EGO.

See Also: Character.HasInventory, Character.LoseInventory, UpdateInventory


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.