exclusive inventory item for interact with an hotspot (SOLVED)

Started by PERXEO, Thu 20/04/2023 22:20:32

Previous topic - Next topic

PERXEO

What is the way to indicate which is the exclusive inventory object with which we want to interact so that it is the only one possible and any other interaction is interpreted as invalid and is not detected by the function hotspot.IsInteractionAvailable(mouse.Mode)


In other words:
1) If I use the correct inventory item with an hotspot i want to run the correct action with isInteractionAvailable
2) If i don't use the correct inventory item with an hotspot i want to run a personal unhandled event to manage it.
 

Khris

If you assign a function to that event, IsInteractionAvailable(eModeUseinv) will be true.

In your handler function you need to check player.ActiveInventory and call your custom function in the else clause (you have to make it global for that, i.e. import it in the global header).

Code: ags
function hGriffoBarra_Useinv() {
  if (player.ActiveInventory == iExclusiveItem) {
    // ...
  }
  else MyUnhandled();
}

PERXEO

thanks!!! I supose that it's not managed with the unhandled_event native of Ags, it isn't?

Khris

No, the automatic calling of unhandled_event only happens if there's no function linked to the event.


SMF spam blocked by CleanTalk