Dialog option change hotspot, enable/disable hotspots? [SOLVED]

Started by iamlowlikeyou, Tue 02/11/2010 19:28:27

Previous topic - Next topic

iamlowlikeyou

Does anybody know if it's possible to have a dialog option trigger a hotspot on/off or change the events of a hotspot?
And if it is, is it possible to have it trigger abilities of a hotspot in another room (actually I'm not sure, if dialogs are room specific...)?

Any help would be much appreciated :)

Khris

First of all, you can run standard script commands in dialog scripts by putting a blank space before them.
You can access hotspots in dialog scripts using the hotspot array (this will always point to the current room though).
Note the hotspot's ID in the room editor, then put a line like this in the dialog script:
Code: ags
 hotspot[3].Enabled = false;


Now, to change the state of your game, what you use is variables.
In the Global variables pane, create a variable of type bool, name it appropriately (e.g. "door_unlocked") and give it an initial value of 0 ( = false).
Now you can set the variable to a new value in the dialog script, like this:
Code: ags
 door_unlocked = true;


Dialogs aren't room specific, btw.
In the other room, in the "interact with hotspot" event's function, use code like this:
Code: ags
function hDoor_Interact() {
  if (door_unlocked == true) {
    Display("You open the door and walk through.");
    player.ChangeRoom(5, 120, 250);
  }
  else {
    player.Say("Unfortunately, the door is locked.");
  }
}

iamlowlikeyou

Thanks a lot!

That was exactly what I was looking for :)

monkey0506

To get around the issue with dialogs not being room-specific you could do this:

Code: ags
  if (player.Room == 1) hotspot[3].Enabled = true;

SMF spam blocked by CleanTalk