use inventory item

Started by Proskrito, Thu 03/04/2003 12:11:59

Previous topic - Next topic

Proskrito

i want some inventory items to do something if the player interacts with them, like, "use -> something" and then run a script.
Now, if i "use" the inventory item, it waits for me to click something to interact with the item. ("use -> something ->with -> ...")
hope you can help me!!  :)
thanks!!!
edit: i use lucas type gui, if it matters

Felipe

Quote from: Proskrito on Thu 03/04/2003 12:11:59
i want some inventory items to do something if the player interacts with them, like, "use -> something" and then run a script.
Now, if i "use" the inventory item, it waits for me to click something to interact with the item. ("use -> something ->with -> ...")
hope you can help me!!  :)
thanks!!!
edit: i use lucas type gui, if it matters
Sorry but... what exactly you want to do?
Interact with an inventory item in the inventory window?
Use "objects" in in your background?
???
Don't blame me - I didn't know it!   (I have the feeling this will come handy...)

-

Proskrito

ok, ill try to explain it better.... (hard with my poor english):
in lucasarts games, inventory items are supossed to be used with another thing, you click button USE,you click on the inventory item, and then you click on whatever you want to use the inventory item with.
but sometimes, there are some items that you want to use alone, for example, "use amberfish", you click USE, and click amberfish, and then amberfish is used 'alone'. I would like to know if there is a way to be able to do both things, depending on which inv item is 'used'.

Mennuz

he means like when he has a chicken ands some scissors in his inventory, he can do:

Use
Use scissors
Use siccors on chicken

when he clicks the scissors on the chicken..
I allready have dificulties putting the score on the upside of the screen, so i cant awnser :D

ThunderStorm

In the main options tab, you can check 'handle inventory clicks in script', I guess that should enable you to do what you want. I haven't used that option yet, though, so I'm afraid I can't help any further.

Proskrito

#5
Quote from: Mennuz on Fri 04/04/2003 14:32:38
he means like when he has a chicken ands some scissors in his inventory, he can do:

Use
Use scissors
Use siccors on chicken

when he clicks the scissors on the chicken..
mmmm its not that...
i mean like when i have a flute in my inventory, an i can do:

Use
Use flute

and then the player plays the flute (just an example). I can make this, but if i do it, then i cant make the "default" action ;

Use
Use inv item
Use inv item on char/on hotspot/on object.

If i can do one behaviour, i cant do the other.
What i want is to be able to choose between the two behaviours depending on which item you click on, like, having the dafault behaviour as defaut, but some items (like the flute) to be able to be used on its own.
I thought using "Ifisinteractionavailable(mouse.x,mouse.y,MODE_USE)" on inventory, but its not possible, so i dont know....
maybe this post should be at the technical forum...???
i REALLY hope you to have understood this...

Ishmael

Make it a use on player style system...

use flute on player -> Beautiful music!
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Proskrito

QuoteMake it a use on player style system...

use flute on player -> Beautiful music!
but my player is not clickable   :P  and finally i found a (crappy) way to do what i wanted  ;D

Lennart26

You said you find a crappy way to fix the problem. Can you tell me what your idea is? I'm really curious now, you see...

Proskrito

I activated "handle inventory clicks in script" option in general settings, an then use the following code in the "on_mouse_click() function:

function on_mouse_click(int button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
 int invitem;
 if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
 }
 else if (button==LEFT) {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else if (button == (RIGHT) || button == (RIGHTINV)) { // right-click,
   SetCursorMode(0); //mode walk
   SetGlobalString(49,"Ir a");
 }
////////here comes the crappy part:
 else if (button == LEFTINV){ //left click on inventory
  invitem = GetInvAt (mouse.x, mouse.y);
  if (Accion("dar")) SetActiveInventory(invitem); //if you pushed GIVE
  if (Accion("usar") && GetCursorMode()==2){// if you pushed USE && then pushed on any inv. item
    if (invitem == 1 || invitem == 4 || invitem == 3){ /*put here the numbers of the inventory items you want to use on its own, and then put the code you want to be run in "interact inventory item" in the interaction editor in each one.*/
      RunInventoryInteraction(invitem, MODE_USE);
     }
    else SetActiveInventory(invitem); //all other inv. items will perform the default behaviour
  }
  else RunInventoryInteraction(game.inv_activated, GetCursorMode());
 }
}
//// end

I hope it to be understandable (english?)

SMF spam blocked by CleanTalk