Secondary Inventory Window

Started by steptoe, Wed 28/03/2012 08:17:49

Previous topic - Next topic

steptoe

Hi

I know that having a secondary Inventory window was not supported in earlier versions of AGS and wonder if it is now at all possible?

Inv 1 window: invCustomInv - Items found, equipment etc
Inv 2 window: Special Inv - Memory items/conversations

At the moment I am having to use buttons of characters/ visual items on the Inventory GUI which open up other GUI's which show animating character portraits or visual clues (buttons) each with Label text. So far this works ok and is adequate for the job.

My only thought is being able to position buttons on Inv GUI in order as you get them. At the moment they are displayed in no particular order an become visible and active when you obtain them.

I'm not sure if there is a Variable of some kind I could use to position buttons in respect of order they are got.

Would it be better to assign a button the correct image as it is got and then:
Code: ags

 function Button3_OnClick(GUIControl *control, MouseButton button)
{
  if(Button3.Graphic==20) //  Display appropriate image to open that GUI with other button image checks etc
 {
  


EDIT: This works but unfortunately AGS now says "You already have Maximum number of controls" so not able to finish using this method :-X

All help on this subject appreciated

Thank you


miguel

#1
I'm having the same problem, after http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45616.0 I decided to give it a go and build a icon based dialogue system where you could mix items to produce other icons that you could use on a conversation. I did a 1 room test and I managed to make it work.
This was my approach:

-I built a custom INV gui and gave the player to start a icon representing a generic location and one that represents a generic character (unknown);
-I let the player click on several objects and hotspots on the room, also a NPC; everytime the players does that a icon is added to the custom INV window;
-icons can be mixed just like normal INV items could;
-when the player talks to the NPC the INV gui shows up on the bottom of the screen and a new gui on the top of the screen;
-the player can click on icons in any order, those are added to the upper gui in order to build sentences;

I also used the second gui with empty (graphically) buttons and checked if they were empty so that an icon would be added to it; of course this was done with shitty coding (lot's of IF's) and I know that an Array should do it.

So, the thing is perfectly executable even for a bad coder like me, but it does take a lot of work. I had to program every choice available for the player and even with a few objects (knife,pen) and hotspots (vase,window,door knob) the possibilities are immense.
But I must say it was really cool testing it myself, I could start with the generic location icon and add the knife and produce a question related to a plot, "This is a kitchen knife, mind if I check your kitchen?". Use the window icon with the generic character icon and ask "Is it possible that someone could have seen the murder from outside the window?".

Working on a RON game!!!!!

Khris

Quote from: steptoe on Wed 28/03/2012 08:17:49I know that having a secondary Inventory window was not supported in earlier versions of AGS and wonder if it is now at all possible?
Not sure where you got that from, you can have multiple inventory windows since at least 2.62.

What you can't do though is have two different inventories per character. So in order to use a second inventory, you have to use a dummy character and do all the click handling yourself since you can't set an inventory item as active that the current player character doesn't possess. That's not that complicated to work around though.

miguel

I knew Khris would show up!

So, I could make a simple function that sets the dummycharacter as the activeplayer and use GUI.ID to add items to the new inv window? Is there a way to permanently relate the new inv gui to the dummycharacter?
Working on a RON game!!!!!

Khris

To answer the last question first: After you add an InventoryWindow to a GUI, enter the character's ID in the properties. (You can't add items to an inv window, only to a character, so in order for the inv window to show anything, it has to be assigned to a character anyway.)

If an item is supposed to be added to the second inventory, call cDummy.AddInventory(iItem).

To select an item, you don't necessarily have to switch the character, this should also work:
Code: ags
// eMouseLeftInv

  if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == invSecondaryInv) {
    ActiveItem = inventory[game.inv_activated];
    mouse.Mode = eModeUsermode1;
    mouse.ChangeModeGraphic(eModeUsermode1, ActiveItem.Graphic);
  }


To be able to use the item on hotspots, add the Usermode1 event and in there, check for ActiveItem (which is a global InventoryItem pointer).

miguel

I knew that items were added to characters, not inv windows, sorry for that.
Only now I noticed the character's ID in the properties because I've never used more than one inv gui before!

I can now simplify my test game and new clues will be added into the second gui without having to do lots of scripting, thank you again Khris.

Steptoe, I'm sorry I've high-jacked your post but I believe that we where seeking for the same answer. 
Working on a RON game!!!!!

steptoe

No worries.. as you say..

I will endeavor to do just that Khris, although I did start using Items found via a Text Box.

cheers mucho Khris / miguel




SMF spam blocked by CleanTalk