Additional Inventory

Started by PureGhostGR, Thu 06/11/2003 22:12:42

Previous topic - Next topic

PureGhostGR

I wanted to ask if it is possible to add a second inventory in the game.

(or at least something along these lines).

I want the character to be able to collect "special" objects that will be stored in a GUI other than the inventory one, yet used just like other objects.

I figured one way to do it would be by making x number of GUIs with the "extra" objects faked as buttons. However, this would make the plot somewhat linear.

Is there a different way? An easier way at least?

Any help will be appreciated.

Thanks.

Gilbert

Each character in AGS has his own inventory, so you can do this by adding a dummy character (with transparent graphics).

Say, when you want to add "items" to the inventory of this nonplayer character, you may use something like "character[DUMMY].inv[5]+=1;" instead of the AddInventory(0 function, etc.

When you want to display the dummy character's inventory in a GUI, you can do the following sequence:
1. Change the room the dummy character to which the player character is currently in (so you wont experience a room change when the character is changed, you may also change the position of the dummy to match the player's coordinates, in care you're in a scrollable room and don't want the viewport be changed), eg:
character[Dummy].room=character[EGO].room;
character[Dummy].x=character[EGO].x;
character[Dummy].y=character[EGO].y;

2. Temporially change the player character to that dummy one, so you can display his inventory, eg:SetPlayerCharacter(DUMMY);

3. Just turn on a GUI with inventory, the inventory content displayed should be those of the dummy character.

4. When finished, just set the player character back, eg:
SetPlayerCharacter(EGO);

PureGhostGR

#2
Thank you Gilbot, I will try this at once and see if I can make it work.

SMF spam blocked by CleanTalk