Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alexei101mercurio on Mon 13/11/2023 04:15:43

Title: Making script command work before dialogue starts
Post by: Alexei101mercurio on Mon 13/11/2023 04:15:43
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) Select
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.
Title: Re: Making script command work before dialogue starts
Post by: Khris on Mon 13/11/2023 07:18:46
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?
Title: Re: Making script command work before dialogue starts
Post by: AndreasBlack on Mon 13/11/2023 10:28:16
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..

@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

Title: Re: Making script command work before dialogue starts
Post by: Alexei101mercurio on Mon 13/11/2023 15:25:09
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.  :)
Title: Re: Making script command work before dialogue starts
Post by: Khris on Mon 13/11/2023 15:58:08
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
Title: Re: Making script command work before dialogue starts
Post by: Alexei101mercurio on Mon 13/11/2023 16:47:37
Thank you! Will try all the methods above and the one you suggested.

 :smiley: