Problem with Items, need to save time!

Started by Chomba, Thu 12/11/2020 09:54:15

Previous topic - Next topic

Chomba

Hi! I hope you are all doing fine!

I'm making my first game with AGS. So far I could manage just looking at the forum, the manual and youtube videos (Densming, you are a God!  :grin:).

But I have a problem that I couldn't find a solution to, maybe I overlooked it, since English is not my mother tongue.

The problem

The thing is that I have the dialogs defined for when an interaction with some item is not assigned and they work well.
Except when some object or hotspot already has a defined interaction with some inventory object. Then I have to set the interactions with all the other items that are not the one to be used in that situation so that the player has some response when using the wrong object. There are some commands to basically put to the program that:

-If you use inventory X, do this.
-If you don't use inventory X in this object Do / say this

instead of going one by one?

I'm sorry if this already had an answer, but if so I couldn't find it anywhere.

Thank you

Khris

Ok, so you're using the global unhandled_event() for this?

Do this:
1) open Globalscript.ash (the header) and add
Code: ags
import function unhandled_event(int what, int type);

Now you can call the function in your room scripts.

Next, do this for your hotspots/objects:

Code: ags
function hExample_Useinv()
{
  if (player.ActiveInventory == iSomeItem) { ... }
  else unhandled_event(1, 3); // use inv on hotspot
}


You have to do this because AGS can only detect that you are not handling a specific cursor mode at all, but it cannot detect that using a certain item has no effect. So you have to call it manually.

Chomba

#2
I will try it and let you know how it went!

Thanks!

QuoteOk, so you're using the global unhandled_event() for this?

Yes, te one that comes with the two clicks template.

Edit to avoid another reply:

Thanks a lot Khris! That was just what I needed! It worked perfectly!

SMF spam blocked by CleanTalk