Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Iron Lawnmower on Mon 02/06/2014 16:16:04

Title: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Mon 02/06/2014 16:16:04
What I want to do is when the character tries to talk to a hotspot there will be a line of dialog unique to each hotspot E.G. "I can't talk to a fucking window you stupid asshole" but in game when I click the talk button and click the hotspot nothing happens.

Code (ags) Select
function hHotspot3_Talk()
{
cEgo.Say("Hey window how are you today?");
cEgo.Say("That's good to hear.");
cChar1.Say("Are you talking to a fucking window?");
cEgo.Say("Yes is there something wrong with that?");
cChar1.Say("You aren't transparent but you are a pane.");
}


is the script I have right now.
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Intense Degree on Mon 02/06/2014 16:52:22
Have you linked the function?

In other words, did you click on the three dots next to "Talk to Hotspot" in the properties pane when editing the room, or did you just type it in to the room script?
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Mon 02/06/2014 17:31:38
yessir I have.
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Khris on Mon 02/06/2014 19:47:43
1) double check that you have actually drawn a hotspot, not a walkbehind or region, etc.
2) hotspots need to be filled, an outline is not enough; only colored pixels are active
3) if the hotspot is small, the talk cursor's hotspot might be outside hHotspot3 when you click
4) are you using any modules, plugins, templates? or is it a default game?
5) if all those fail to produce a result put the source files on dropbox or something so we can take a look
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Mon 02/06/2014 20:32:02
1)Yes I have
2)Indeed.
3)No it's quite a large hotspot.
4)I'm using the lucas arts monkey island style template.
5)Which files are source files or should I just upload the entire game folder?
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Snarky on Mon 02/06/2014 21:05:15
You've verified that talking works in general, right? I mean, you use cEgo.Say() in other places and it works?
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Mon 02/06/2014 21:19:18
Yep talking works quite well.
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Khris on Wed 04/06/2014 13:26:22
You always need to mention used templates and modules in your initial post, saves a lot of time.

The MI style template doesn't allow talking to hotspots or objects; the easiest solution is changing the hotspot into a character.

You can also disable the check:
1. open "guiscript.asc"
2. find line 332
3. replace "cond = ..." with "cond = false;"

Note that the MI template doesn't use the standard interaction events; to add a "talk to" interaction, you're supposed to use the AnyClick event and add this:
Code (ags) Select
    // other verbs
    else if (UsedAction(eGA_TalkTo)) {
      player.Say("I'm not talking to a cup.");
    }


This is explained in the pdf that comes with the template, you can find it in the game dir.
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Wed 04/06/2014 20:23:34
So replace
  else if (parameter == 3)
    cond =((isAction(eGA_TalkTo) || (isAction(eGA_GiveTo) && (Mouse.Mode == eModeUseinv))) && (GetLocationType(mouse.x, mouse.y) != eLocationCharacter));
with just
  else if (parameter == 3)
    cond =false
?
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Khris on Thu 05/06/2014 00:20:52
Yes, don't forget the semicolon.
Code (ags) Select
  if (parameter == 3)
    cond = false;
Title: Re: How can I make it so the player can talk to hotspots?
Post by: Iron Lawnmower on Thu 05/06/2014 12:18:00
Thanks. :)