Clickable Hotspots while in Dialog Tree

Started by nads, Thu 02/05/2013 13:43:31

Previous topic - Next topic

nads

Heya,

I was just wondering if it's at all possible to have a Clickable Hotspot that can be clicked while you are in a dialog tree?

For example;

The player will have they dialog options on display but if they click on a Hotspot it will run its own sequence of actions. (Player could ask about that certain item)

Thank you,

san.daniele

as you didn't get an answer yet I assume there's no easy way.

you probably already have an idea how to navigate around the problem, but let me get creative :)

I imagine a scenario where you're in a shop and want to ask for prices of different things inside the dialog.
Dialog options:
1. How much costs ... (click on object/hotspot)?
2. Do you have free samples?

i would do something like: once the player clicks on option 1, the dialog stops, a custom GUI is rendered visible and shows the 2 dialog options (looking exactly like the Dialog GUI). At the same time variable AskCost = true; and with that variable being active, clicks on the hotspots return a cVendor.Say("XX bucks");.
If player clicks on option 2, back to the/a dialog.

Khris

There should be a setting in General Settings -> Dialogs that basically makes dialogs no longer block the rest of the game.

nads

Mmmm - The only option I have under dialog is "Run game loops while dialog options are displayed" - Tried running the game, but the hotspot is still not showing up.

Khris

This seems to do the trick:

Code: ags
void noloopcheck ask_about() {

  int new_mode, lt;
  String location;
  
  int wait_graphic = mouse.GetModeGraphic(eModeWait);

  bool done;
  while (!done) {

    lt = GetLocationType(mouse.x, mouse.y);
    if (lt != eLocationNothing) {
      new_mode = eModeInteract;
      if (mouse.IsButtonDown(eMouseLeft)) {
        location = Game.GetLocationName(mouse.x, mouse.y);
        done = true;
      }
    }
    else new_mode = eModePointer;    
    mouse.ChangeModeGraphic(eModeWait, mouse.GetModeGraphic(new_mode));
    Wait(1);
  }
  
  mouse.ChangeModeGraphic(eModeWait, wait_graphic);
  
  if (String.IsNullOrEmpty(location)) return;
  if (location.CompareTo("door") == 0) {
    player.Say("What's with the door?");
    player.Say("Well, it's hidden.");
  }
}


Now just import this function in GlobalScript.ash:
Code: ags
import void ask_about();


Then add a dialog option called "Ask about..." and in the script, call that function.

nads

Thanks for your reply Khris. I do like this bit of script, have an idea that could put that to good use. But it's not exactly what I want to happen.



So pretty much I want this "green blob" (for example sake) to be clickable. And if the player clicks on this hotspot something will happen (meant to be there as an easter egg) So is it at all possible to have the hotspot clickable at the same time as when a player can choose a dialog option?

Thanks again.

Khris

You'd have to detect and process the click in repeatedly_execute_always. But you can't call blocking functions inside it; if you do, AGS crashes.
So it depends on what you want to happen. If you just want to show a message, you could put it on a GUI and turn it visible. But using for instance a Display command won't work.

SMF spam blocked by CleanTalk