Interact with hotspots/objects while dialog is ongoing [SOLVED/WORKAROUND]

Started by Héctor Bometón, Tue 20/09/2022 20:13:38

Previous topic - Next topic

Héctor Bometón

I noticed when a dialog starts, the only clickable elements are the dialog options, but the background "blocks". Is there any way to bypass this or fake it easily?

Thank you!

Pax Animo

#1
This may help,

Try setting Run game loops while dialog settings are displayed option on General settings page.

Though I'm not sure this allows hotspots/objects as clickable.
Misunderstood

Crimson Wizard

#2
On one hand, the custom dialog options rendering may allow to make any part of the screen interactable. You decide and script yourself where on screen player may click and what happens.

One problem with this approach is that, because of how AGS script works, you won't be able to run certain functions or events directly. For example, a quick test shows that while it's possible to run hotspot's interaction out of the dialog script, it won't work if you try running it from "dialog_options_mouse_click" and similar.

A workaround could be to have a dummy hidden dialog option (or a number of these), which you run following a click over a hotspot. You will have to save a hotspot reference in a global variable, and use that to know which hotspot was meant to be interacted with. Alternatively, of course, if a dialog is room-specific, you may have a separate dialog option per hotspot, and run corresponding option. The choice mostly depends on what kind of action do you like to have as a response to clicking over a hotspot.



Another approach would be to avoid AGS own dialog options altogether, and script a completely separate options system, running in e.g. repeatedly_execute, drawn on a regular GUI, for instance.

With this approach the main problem will be... lots of scripting. Also, you will need to be able to run necessary dialog option. As AGS does not let you directly start certain option, but only start a dialog itself. This in turn may be worked around by temporarily disabling all options except the one you need to run - that will force AGS to run that only available option on dialog start.


EDIT:
Quote from: Pax Animo on Tue 20/09/2022 20:21:51Try setting Run game loops while dialog settings are displayed option on General settings page.

Though I'm not sure this allows hotspots/objects as clickable.

No, it won't allow that. During dialogs any clicks are intercepted by the dialog system.

Khris

If this is about asking somebody about objects in the room for instance, it's probably easier to end the dialog and switch the game into "asking about room objects" mode using a variable.

Can you elaborate a bit about the context?

Héctor Bometón


First of all, thank you very much for the answers.

QuoteCan you elaborate a bit about the context?

Yes.



The player is having an interview and whenever he tries to speak, his voice wont come out. You can click on any of the options, but he's too nervous to answer and it always loops back to the same options.

I want the water bottle to be clickable, so he clears his throat and THEN you can go on with the dialog.

I hope that is clear!

Khris

I see, this won't be easy. The only way to detect the click during a dialog is to check the position and button state of the mouse inside repeatedly_execute_always. Which also means you cannot run any blocking code as a result of clicking the bottle.

You could set a variable though, and play a non-blocking drinking animation I guess.
When an option is clicked you check the variable and proceed accordingly.

heltenjon

A variation of what CW said above: From how you describe it, perhaps you can make it look like you're in a dialog by having a GUI or clickable objects that look identical to the dialog options. Then when he drinks the water, these goes invisible and you start the real dialog script. (That's a "fake it" solution, I don't have the coding chops to suggest anything like Khris or CW.)

Héctor Bometón

Again, thanks for the help!

QuoteFrom how you describe it, perhaps you can make it look like you're in a dialog by having a GUI or clickable objects that look identical to the dialog options

Good idea! That might be exactly the workaround that I was looking for! The dialog optionas for this first dialog are always the same, so I think I can fake that fairly easily.

I'll let you knok when I try it!

Héctor Bometón

#8
So... Yeah, I finally went with the "fake dialog gui" workaround and it worked like a f****ng charm!

Thank you very much.

[youtube width=720 height=405]hhl-XIAPbSQ[/youtube]

SMF spam blocked by CleanTalk