Disable walk before dialog

Started by godofredo, Mon 24/09/2012 19:38:38

Previous topic - Next topic

godofredo

Hi,

whenever I start a dialog with an NPC,my main character walks close to the NPC before
starting the dialog. I wan't to disable this as the main character is placed in the
top left corner of the NPC area. How do I do this?

Many thanks.

Andail

Can you provide the code please? What command are you using to have the character walk to begin with? The coordinates are yours to set anywhere you want.

Khris

godofredo uses the 9-verb template (godofredo: you should mention that in every relevant thread) which has a special set of functions (Go(), GoToCharacter(), etc.) that get called automatically.

This is hardcoded into on_mouse_click, for instance here:
Code: ags
      // talkto
      else if (GSagsusedmode==eModeTalkto && IsInteractionAvailable(x, y, GSagsusedmode) && GSloctype==eLocationCharacter) {
        ActionLine.TextColor=ActionLabelColorHighlighted;
        if (GoToCharacter(character[GSlocid], eDir_None, NPC_facing_player, 1)) character[GSlocid].RunInteraction(GSagsusedmode);
        SetAction(eMA_Default);
      }


To fix this, add a custom property to characters.
Let's call it "approach", any description, type Boolean, default value "true". (Or false of course, if that's going to happen more often.)
Open guiscript.asc, go to line 1475 and change it to this:

Code: ags
        if (!character[GSlocid].GetProperty("approach") || GoToCharacter(character[GSlocid], eDir_None, NPC_facing_player, 1))
          character[GSlocid].RunInteraction(GSagsusedmode);


Also, line 1521 (right click).
That should fix it.

godofredo

WOW! What can I say, many thanks!!!

Pretty elegant solution that worked just perfect, and also gave me the opportunity
to play with custom properties.

Also sorry for not having mentioned my ASG and GUI versions, I gave it for granted as I had
posted another thread a couple of days ago.

Thanks again.

Khris

Yes, I vaguely remembered that and checked your other posts.

Small correction for future readers of this: when setting up a bool in the custom properties editor, the default value has to be either 0 or 1, not "true" or "false".

rmonic79

hello, can you specify what lines i must change?

SMF spam blocked by CleanTalk