Making script command work before dialogue starts

Started by Alexei101mercurio, Mon 13/11/2023 04:15:43

Previous topic - Next topic

Alexei101mercurio

Hello everybody! I am new to this forum and to the game-creating world.

First of all, I apologize if this question was already answered in boards. Unfortunately, search didn't do much for me.

I want my character to walk in a designated coordinates before she starts dialogue.

For example, my script looks like this:

Code: ags
function cSea_AnyClick()
{
  if(Verbs.UsedAction(eGA_TalkTo))
  {
  cJune.Walk(875, 246, eBlock, eWalkableAreas);
  dDarkSea2.Start();
  }
}
[/color]

So here I want June to walk first and start dialogue after and only after that. But she starts with walking towards the sea which is breaking the in-game rules so to speak.
I was trying to implement the walking action command in the in-dialogue script, but the result was the same.

Khris

Hey Alexei, welcome to the forums  :)

Can you please re-read and fix your post? Because your code and your post says 1. walk 2. talk.
Is this the order you want or not? Or is something else not working as intended?

Quote from: Alexei101mercurio on Mon 13/11/2023 04:15:43So here I want June to walk first and start dialogue after and only after that. But she starts with walking towards the sea which is breaking the in-game rules so to speak.

What does that mean exactly?

AndreasBlack

#2
I'm a little confused aswell. If you want her to walk in coordinates the most simple way is to cordinate her halfway thru, then go Wait(1); and then next cordinate, she will stop really fast and switch direction. If you'd want her to wait longer you'd have to use timers (type settimer and push f1) you'll see the manual, very handy to know about! Manual sometimes can be confusing, but mostly there are examples!

Edit: Also to find out cordinates you can look in the view editor with the mouse and click with the scrollwheel then AGS captures the cordinates for you if you accept..

Code: ags
@1

//Stupid example. If you are lazy and don't want to use timers..

  player.Walk(2,1,eBlock,eAnywhere);
 Wait(1);
 player.Walk(10,4,eBlock,eAnywhere);
Hologram: Greetings to you too.
  if (dDialog1.HasOptionBeenChosen(1))
    dDialog1.SetHasOptionBeenChosen(1, true);
return


Alexei101mercurio

Thank you for your answers guys! Yeah, it's totally my mistake, I made it look confusing. Yes, I wanted my girl to walk where I told her to, and THEN to walk in direction of the dialogue start. I think you hit the nail here, i will try when i will be near my PC.  :)

Khris

You can also take a look at the AddWaypoint() function. It should work with blocking walks, too.

https://adventuregamestudio.github.io/ags-manual/Character.html#characteraddwaypoint

Alexei101mercurio

Thank you! Will try all the methods above and the one you suggested.

 :smiley:

SMF spam blocked by CleanTalk