Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rocco on Mon 05/04/2004 08:16:01

Title: Inventory - 2 charakter game
Post by: Rocco on Mon 05/04/2004 08:16:01
hi all,

sorry for my bad englisch in advance.
i try to make a game, where you can switch between two charakters.
how can i solve it easily, when 1 charakter gives an inventory item to the other one?
cause i dont no, which item and i have to remove it by the one and add it to the other.

thanks for hints
greets
rocco
Title: Re:Inventory - 2 charakter game
Post by: Scummbuddy on Mon 05/04/2004 08:56:53
check out this, and aee Also: AddInventory, LoseInventory

UpdateInventory ();

Updates the player's inventory display. If you add or remove inventory items manually (ie. by using the character[].inv[] variables rather than the AddInventory/LoseInventory functions), the display may not get updated. In this case, after making your changes, call this function to update what is displayed to the player.
-----------------

you may want to use the character[script name].inv[ # ] along with the update, but you'll probably need to run a check to see which character is currently being played.


Your English is really not all that bad. Very readable, but just some spelling mistakes, but nothing too bad at all. Nicely done.
Title: Re:Inventory - 2 charakter game
Post by: Rocco on Mon 05/04/2004 10:49:39
thanks scummbuddy, it works  8)

in the variable:whichplayer i stored which character is controlled at the moment by the player.
so i have a runscript command for example in:
charakter-editor/syd/interactioneditor/useinventoryoncharakter/runscript

 // script for character1: Use inventory on character
character[SYD].inv[game.inv_activated ] +=1;
character[whichplayer].inv[character[whichplayer].activeinv] -=1;
UpdateInventory ();
SetActiveInventory(-1);

greets
rocco

EDIT: but the charakter dont walk to the other.
which command can achieve this?

Title: Re:Inventory - 2 charakter game
Post by: Scummbuddy on Mon 05/04/2004 16:01:33
Use this command twice, once for each character.
----------------
MoveCharacterBlocking (CHARID, int x, int y, int direct);

Moves the character CHARID to location (X,Y), waiting until they arrive there before returning to the script.
If DIRECT is 0, this acts like MoveCharacter; if it is 1 then this acts like MoveCharacterDirect.

Example:

MoveCharacterBlocking(EGO,234,122,1);

will make the character EGO walk to 234,122 ignoring walkable areas and return the control to the player when he gets there.
---------------
so, move both characters to a close enough point, then use the facecharacter command again for both, and then you should be set.
Title: Re:Inventory - 2 charakter game
Post by: Rocco on Mon 05/04/2004 21:42:01
thx, i solved it this way:

int sydx = character[SYD].x;
int sydy = character[SYD].y;
MoveCharacterBlocking(whichplayer, sydx, sydy, 0);
FaceCharacter(whichplayer,SYD);
FaceCharacter(SYD,whichplayer);