How can I make it so the player can talk to hotspots?

Started by Iron Lawnmower, Mon 02/06/2014 16:16:04

Previous topic - Next topic

Iron Lawnmower

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
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.

Intense Degree

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?


Khris

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

Iron Lawnmower

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?

Snarky

You've verified that talking works in general, right? I mean, you use cEgo.Say() in other places and it works?


Khris

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
    // 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.

Iron Lawnmower

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
?

Khris

Yes, don't forget the semicolon.
Code: ags
  if (parameter == 3)
    cond = false;


SMF spam blocked by CleanTalk