You have Inventory added [SOLVED]

Started by Candle, Wed 22/12/2004 22:01:15

Previous topic - Next topic

Candle

What would be the best way so anytime a Inventory item is added it says Inventory added in some font ?
I know I could do a add message but don't want to add that to every Inventory item .

:=   felt like using this .  face . lol

Kikutaâ„¢

maybe you want something like this :

AddInventoryItem(number);
Display("I got a key");

Candle

No I just want it to say " Inventory Added " and the way you have I have to add it to each Inventory item .

hms

well im quit new to AGS but..

You could save it as a global message i dont think it's too hard work for you to do the answer above? Take it as a rutine..
-------------------------------------------------------
It takes 42 muscles to look angry, but it only takes 6 to slap the idiot down!

strazer

Look in the manual for the "on_event" function. Is that what you're looking for?

Candle

#5
I'll take a look strazer right now and see . thanks .
Well found the part you talk about but not sure how I would code it to   display  a font on the screen saying " inventory item added" ?


strazer

I don't quite understand what you mean by displaying a "font"?
If you want to display a generic message each time an inventory item is added to the inventory, put this in the global script:

function on_event(int event, int data) {
  if (event == ADD_INVENTORY) {
    Display("Inventory added");
  }
}

Candle

Thats what i wanted to do . anyway to remove the white background from it and  change the color of the font that is display ? if not thats ok I'm happy with that .
I just happen to see that the game  Melrin: The Dragon Menace had it done that way and I liked it .

Gilbert

Quote from: Candle on Thu 23/12/2004 03:39:33
anyway to remove the white background from it and change the color of the font that is display ? if not thats ok I'm happy with that .

You mean the background of the message? If you're not using "Always display text as speech" option it would be displayed in a message GUI, if you use the Display() function. One simple way is to just check the "Always display text as speech" option, but if you really want texts in message boxes in your game, you change the Display() of the codes to DisplaySpeechBackground(), for example:
function on_event(int event, int data) {
  if (event == ADD_INVENTORY) {
     DisplaySpeechBackground(GetPlayerCharacter(),"Inventory added");
  }
}

Candle

Thank you Gilbot , I didn't think to check that .
That makes it lose the background color of white and looks much better .
Thank you both for the help .

strazer

And if you want it to display at another location than above the player character's head, do

int oid = DisplaySpeechBackground(GetPlayerCharacter(), "Inventory added");
MoveOverlay(oid, 10, 300); // tweak coordinates for your game resolution

Candle

Ok great .. I think above the head is ok ..

Joacim Andersson

I know you've put SOLVED in the subject line but I just wanted to add my 5 cents. The way I did this in the Melrin games was to create a simple GUI with the text "New Inventory Item". I also created my own function named AddInv(int inv) in which I called the AddInventory function, show the GUI and started a timer that when it's fired removes the GUI, so the text is removed automatically after a few seconds.

Candle

Thanks for how you did it . I think what I have now will work fine but good to know how others do things too .

SMF spam blocked by CleanTalk