I need help with GUI Inventory

Started by Cpt_Jigglypuff, Thu 09/09/2004 22:57:11

Previous topic - Next topic

Cpt_Jigglypuff

K, so I just started, and I'm using the default game that comes in AGS and I'm editing it to my needs, I find that easier than starting from scratch, especially since I'm new to this....

So, the inventory GUI has three buttons, the magnifying glass, arrow, and OK button, I want it to have the interact button too.  I added the button, set it to the sprite I want, and set the cursor mode and number....but when I run the game, it still only has the original three buttons...how do I apply my changes?

Also, I have another question, I don't wanna flood the forums with my noob questions, so I'll just add it in here....

It's about items and their application to eachother... So, I have an egg, I want to make it so I use a specific item on it...and it hatches...then on the baby, I want to use a different item, say an apple,(actualy multiple apples) and the baby grows up!...how do I go about doin that?  ???

Thanks! ;D

Cpt_Jigglypuff

okay i figured out how to disable the default inventory GUI...Now I just need to know the rest of my post....maybe i'll try to edit the title??

dreammaster

You could make your egg, baby, and so on as different inventory items, and then set each's Interaction for Use Inventory on Item to remove that item from the inventory and add the next one in the growth sequence, if the correct activiting item is used. Since each stage of growth is internally a distinct inventory item, they can each have their own interaction handling.

Cpt_Jigglypuff

I see, so,  What I would do is use uhm...hammer on egg  ;D then have it so it egg is removed and baby is added..then..use apple1 on baby,  keep baby, but remove apple, use apple2 on baby, keep baby remove apple, use apple3 on baby, remove apple AND baby, create adult??  What if I want the adult to be a character?  just do the 'move NPC' command?

dreammaster

Exactly. If you want to require several uses of apples to make the child grow up, you could use a global variable to keep track of how many times you've used an apple on the child, and then trigger the adult when appropriate.

As for the adult being a chracter, it depends on whether you want to keep the adult in your inventory or not. If it's staying in your inventory, then you'd just keep it as an object. If however, it will appear on-screen when it becomes an adult (ie. such as following you around), then yes, you'd make it a character - in this case you'd define an adult character with it's starting room to -1. Then when you wanted it to appear, you could do something like:

character[ADULT].room = player.room;
character[ADULT].x = character[EGO].x;
character[ADULT].y = character[EGO].y

This would put the adult character right where you are.

Cpt_Jigglypuff

Okay, now it's givin' me problems....I've got some Items made: the egg, the hammer, the apple, the baby......  I want it to be that you use the hammer(and only the hammer) to crack open the egg.....but it keeps letting me use the apple too!!  I made it so it was conditional: if inventory item was used (8)  and 8 is the hammer....but it keeps allowing me to use the apple?? grrrr....I hope I don't have this much trouble when trying to make the baby grow up w/ apples...

Gilbert

You're using the interaction editor right?
Are you sure that the action(s) after the if inventory item is used (8) is(are) indented correctly ? Like this:
Ã,  if inventory item is used (8)
Ã,  Ã,  Ã,  Ã, Do something
Ã,  Ã,  Ã,  Ã, Do some more thing

Cpt_Jigglypuff

#7
I dunno how to make it indent, how do I get to the room's script??  it's not in the global script.....is it??

**EDIT**
Figured it out....ugh, I just overlooked the button....  :-[

***EDIT***
Okay, yeah I found the room script button, but where's the inventory item script button?

Cpt_Jigglypuff

And why doesn't this little window thingy work???



Isn't it supposed to show the item that is seleted in the inventory?

Edwin Xie

hmm, mario game.....seems ok.... And that thing does not work for me. At least when I modify the button sprite.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Moox

Look it up in the manual, its very simple to get it to show the item.

Edwin Xie

I'm very confused.......How is that going to help? I don't even get
character[CHARID].activeinv, character[CHARID].inv
  • , game.inv_activated or any of that related fragments of script.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Cpt_Jigglypuff

Quote from: LostTraveler on Sat 11/09/2004 04:12:39
Look it up in the manual, its very simple to get it to show the item.


where?

Edwin Xie

Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

Quote from: Cpt_Jigglypuff on Sat 11/09/2004 03:37:04
I dunno how to make it indent, how do I get to the room's script??Ã,  it's not in the global script.....is it??

**EDIT**
Figured it out....ugh, I just overlooked the button....Ã,  :-[

***EDIT***
Okay, yeah I found the room script button, but where's the inventory item script button?
Well... You can access inventory items interaction scripts via the tree on the left of the AGS main window: Game Editor - Inventory items - Interaction... button. Although you can use interaction editor action commands, it would be simplier (in that particular case) to run scripts.

Here we go:

*Open Game Editor - Inventory items
*Choose Egg
*Press the Interactions... button
*Click a Use inventory on this item
*Choose a Run Script command
*Press an Edit script... button
*Add the following script, substituting all the bold names for their values as necessary:

int PC = GetPlayerCharacter();
if (character[PC].activeinv == HAMMER_ITEM_NUMBER)
{
Ã,  Ã,  LoseInventory(EGG_ITEM_NUMBER);
Ã,  Ã,  AddInventory(BABY_ITEM_NUMBER);
}


*Save the script and close the interactions editor
*Choose Baby
*Press the Interactions... button
*Click a Use inventory on this item
*Choose a Run Script command
*Press an Edit script... button
*Add the following script, substituting all the bold names for their values as necessary:

int PC = GetPlayerCharacter();
if (character[PC].activeinv == APPLE_1_ITEM_NUMBER)
{
Ã,  Ã,  LoseInventory(APPLE_1_ITEM_NUMBER);
Ã,  Ã,  apples_fed = apples_fed + 1;
}
else if (character[PC].activeinv == APPLE_2_ITEM_NUMBER)
{
Ã,  Ã,  LoseInventory(APPLE_2_ITEM_NUMBER);
Ã,  Ã,  apples_fed = apples_fed + 1;
}
else if (character[PC].activeinv == APPLE_3_ITEM_NUMBER)
{
Ã,  Ã,  LoseInventory(APPLE_3_ITEM_NUMBER);
Ã,  Ã,  apples_fed = apples_fed + 1;
}

if (apples_fed == 3)
{
Ã,  Ã,  apples_fed = 4;
Ã,  Ã,  LoseInventory(BABY_ITEM_NUMBER);
Ã,  Ã,  character[ADULT_SCRIPT_NAME].room = character[PC].room;
Ã,  Ã,  character[ADULT_SCRIPT_NAME].x = character[PC].x + 5;
Ã,  Ã,  character[ADULT_SCRIPT_NAME].y = character[PC].y;
}


*Save the script and close the interactions editor
*Open the main global script file (Follow Main menu -> Game -> Edit global script... or press Ctrl-G)
*Add the following line at the very top of the main global script:

// main global script file
int apples_fed = 0;
[/font]

*Finally, save the main global script.

Note: The adult must me a character which Start in room property is set to -1.

Quote from: Cpt_Jigglypuff on Sat 11/09/2004 03:57:11
And why doesn't this little window thingy work???
...
Isn't it supposed to show the item that is seleted in the inventory?
Open the GUI editor panel, choose the button that's supposed to show an active inventory item and change its Text setting to (INVSHR).

Quote from: Edwinxie on Sat 11/09/2004 06:11:12
Same here;
Quote from: Cpt_Jigglypuff on Sat 11/09/2004 06:00:56
Quote from: LostTraveler on Sat 11/09/2004 04:12:39
Look it up in the manual, its very simple to get it to show the item.


where?
See AGS manual -> Tutorial -> Setting up the game -> Inventory[/b]

From the manual:
QuoteThe default option is the Sierra-style pop-up inventory window, which is popped up by clicking on the Bag icon on the icon bar (which uses the text script InventoryScreen function to display it). You can also have the current inventory item displayed in its own button on the icon bar by creating a button on the GUI and setting its text to (INV) which stretches the item picture to the button size, or (INVNS) which draws the inventory item picture straight onto the button with no resizing. Finally, (INVSHR) , probably the best option, will draw it at actual size if it will fit, or shrink it if not.


And really, the manual has many topics covered, try using its search feature to get the info you need.

Cpt_Jigglypuff

wow! thanks scorpiorus! Very helpful/informative/kind of you!

Thank you!  ;D

SMF spam blocked by CleanTalk