Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Joseph on Sat 15/05/2010 22:06:00

Title: SetPlayer and 2 inventories Conundrum **SOLVED
Post by: Joseph on Sat 15/05/2010 22:06:00
Ok, second question and last question of the day!

Im using a trick I found in the forums to fake 2 inventories for the same player (create a dummy character with its own inventory and scripting "InvWindow.CharacterToUse" +  "Character.SetAsPlayer" as needed).

The problem is this, however:

Say I switch the playable character to the dummy character to gain access to his inventory. I select an item in the dummy inventory, and return to the room. Cool, the mouse cursor has the right item cursor, and I can do interactions with it. BUT...when I go to walk, talk, look, etc...its still the dummy character, so my "real" main character doesnt move or do anything.

What I want to know is:

How do I change it back to the "real" main character without losing the dummy inv item I took from the dummy inventory?

What I though of trying but seems stupid (perhaps in rep_exec?):

if (mouse.mode != 4)
{
if (player != cMainChar) cMainChar.SetAsPlayer();
}


as in...if the mouse mode isnt an inventory item being used, set the player to my "real" main character (and not the dummy).

Is there a better way?

EDIT--->

Ok, I found a solution: in on_mouse_click

   if (mouse.Mode == eModeWalk)
   {
     if (player != cMainChar) cMainChar.SetAsPlayer();
   }


I just do that for all the mouse modes except the use inv.