Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Fri 31/03/2006 21:14:01

Title: Unhandled_event (SOLVED)
Post by: sloppy on Fri 31/03/2006 21:14:01
In the unhandled_event function, how would I get a different display message depending on which character I use an inventory item on?
Title: Re: Unhandled_event
Post by: Ashen on Fri 31/03/2006 21:22:31
Use the Character.GetAtScreenXY(..) function, e.g. (untested):

function unhandled_event (int what, int type) {
  if (what == 3 && type == 3) { // Use inv on character
    Character *theChar = Character.GetAtScreenXY(mouse.x, mouse.y);
    //Creates a pointer to the character clicked on
    if (theChar == cEgo) cEgo.Say("Why would I want to use that on myself?");
    else if (theChar == cBob) cEgo.Say("I don't think he'd like that...");
    // etc
  }
}
Title: Re: Unhandled_event
Post by: sloppy on Fri 31/03/2006 21:59:05
Thanks.