Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - an4vy

#1
Hi Khris, thank you for your reply!
:) Now i'm feeling a little bit stupid   :-D
You're right!  I forgot to write that code for the other item too!
Everything works fine now.
I'm a very beginner with AGS :)
#2
Thank you Khris for your reply.
It work perfectly now for every Use_inv function on other things like NPC or objects.

But the problem for using an inventory item on another one is still the same:
Ags answer me using the unhundled function instead of combining the items.

Here is an example of the code I use for combining two items, Ags seems to ignore all the 'if lines', using only the last one,
even if I use 'iPesce' on 'iSonnifero':

Code: AGS


function iPesce_UseInv()
{ 

if (cLaura.ActiveInventory==iSonnifero){
  cLaura.LoseInventory(iPesce);
  cLaura.LoseInventory(iSonnifero);
  cLaura.AddInventory(iPesceSonn);
  Display("Hai aggiunto il sonnifero al pesce.");
}
else unhandled_event(5, 3);
}



I don't think that code is wrong...
Maybe should I add  any other code lines in my on_mouse_click function to solve this?

Thank you in advance for any useful reply!
#3
Hallo everybody and sorry for my very poor english.
I have a problem when i try to use an inventory item with any other thing (characters, hotspot, object...)
Seems like AGS doesn't recognise the item selected by the player.

For example, I try to give an apple to someone and I want him to answer "Thank you", otherwise,
if I give him any other inventory item, I'll have the answer written in unhandled event function,
for example "bad idea".


Code: ags


function cPescatore_UseInv()
{

if (cLaura.ActiveInventory==iApple){
cPescatore.Say("Thank you!");
cLaura.LoseInventory(iApple);
}
else unhandled_event(3, 3);
}
  


AGS always answer with the unhandled function "bad idea", even if I give the apple to the NPG...

I solved the problem adding, at the beginning of the function, the code:

player.ActiveInventory = inventory[game.inv_activated];

and it works fine now, but I don't understand why i have to write that line for every Use_Inv function
in order to make it works!

This is my code for on_mouse_click:

Code: ags


function on_mouse_click(MouseButton button) 
  {
 //....here there is the 'eMouseLeft and Right' button code, then:
else if ((button == eMouseLeftInv)&&(mouse.Mode != eModeLookat)&&(player.ActiveInventory == null)) { 
     player.ActiveInventory = inventory[game.inv_activated];
     Mouse.ChangeModeGraphic(eModeUseinv,inventory[game.inv_activated].Graphic);
    Mouse.Mode = eModeUseinv;
    }
     
    else if ((button == eMouseLeftInv)&&(mouse.Mode == eModeLookat)) { 
    inventory[game.inv_activated].RunInteraction(eModeLookat);
    }
   
     else if ((button == eMouseLeftInv)&&(mouse.Mode == eModeUseinv)&&(player.ActiveInventory != null)) {
      player.ActiveInventory.RunInteraction(eModeUseinv); 
     }

      else if ((button == eMouseRightInv)&&(player.ActiveInventory != null)) {
     player.ActiveInventory = null;
     }   
 
     else {
       //player.ActiveInventory = inventory[game.inv_activated];
      player.ActiveInventory=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
      mouse.Mode=eModeUseinv;
    } 
  } 



Can anyone help me?
SMF spam blocked by CleanTalk