[SOLVED] "Look-At" command, possible to give different answers?

Started by tobulos1, Sun 22/03/2015 11:19:04

Previous topic - Next topic

tobulos1

Hi!
I tried to search the forums for this as well as the manual, but nothing came up, so I'll post it here:

I'm making a game with the Verb 9 (LA-template). Is it possible to receive different answers when you "Look-At" something?
E.g. when you use Look-At on a tree the first time your character will say "Text1" and the next time you Look-At the tree, the character will say "Text2".


Also, a minor problem I have is to delay my character's change of direction when he looks at something. I wanted him to be confused, so he would look right, then left, then right again. However, if I use the "player.FaceDirection(eDir_x);" command, he'll do it so quickly. I want him to stop up for a second and just look at that direction before changing. This is my code:

Code: ags
function hPath1_AnyClick()
{
  if(UsedAction(eGA_LookAt)) {
    Game.TextReadingSpeed = 7;
    player.FaceDirection(eDir_Right);
    player.Say("Is that a path...");
    player.FaceDirection(eDir_Left);
    player.Say("Or is that...?");
    player.FaceDirection(eDir_Right);
    player.FaceDirection(eDir_Left);
    player.FaceDirection(eDir_Down);
    player.Say("I'm confused!");
  }
  else Unhandled();
}


I've read that you can use the Animation and LockView, but those didn't really work because I couldn't set a delay timer on them. Any thoughts?

Thanks!

AprilSkies

if you want him to stop for a second just add
Wait(40);

waits for 40 loops which is around 1 second.

www.apemarina.altervista.org

tobulos1

Quote from: AprilSkies on Sun 22/03/2015 11:21:42
if you want him to stop for a second just add
Wait(40);

waits for 40 loops which is around 1 second.

Ah yes, that worked perfectly!
How come I've never seen that before? Oh well, worked wonders! Thank you very much :)

Cassiebsg

As for your first question, just add a counter...

something like:
Code: ags

Look_Counter = 0;

    function hPath1_AnyClick()
    {
      if(UsedAction(eGA_LookAt)) {
        if (Look_Counter == 0) {
            Game.TextReadingSpeed = 7;
            player.FaceDirection(eDir_Right);
            player.Say("Is that a path...");
            player.FaceDirection(eDir_Left);
            player.Say("Or is that...?");
            player.FaceDirection(eDir_Right);
            player.FaceDirection(eDir_Left);
            player.FaceDirection(eDir_Down);
            player.Say("I'm confused!");
            Look_Counter = ++;
        }
        else if (Look_Counter == 1) {
            // do something else
            // add more to counter if you wish more than 2 replies...
        }
      }
      else Unhandled();
    }
There are those who believe that life here began out there...

tobulos1

Quote from: Cassiebsg on Sun 22/03/2015 13:10:26
As for your first question, just add a counter...

something like:
Code: ags

Look_Counter = 0;

    function hPath1_AnyClick()
    {
      if(UsedAction(eGA_LookAt)) {
        if (Look_Counter == 0) {
            Game.TextReadingSpeed = 7;
            player.FaceDirection(eDir_Right);
            player.Say("Is that a path...");
            player.FaceDirection(eDir_Left);
            player.Say("Or is that...?");
            player.FaceDirection(eDir_Right);
            player.FaceDirection(eDir_Left);
            player.FaceDirection(eDir_Down);
            player.Say("I'm confused!");
            Look_Counter = ++;
        }
        else if (Look_Counter == 1) {
            // do something else
            // add more to counter if you wish more than 2 replies...
        }
      }
      else Unhandled();
    }



Hi! Thanks for the reply.
However, I'm just receiving this error: "Parse error: unexpected 'Look_Counter'"

What should I make of that?


EDIT:
Nevermind, I figured it out!
I had to use the int counter before the command, like so:
Code: ags
int Look_Counter = 0;


Thank you for the help! :)

Haggis

If you've not done so - you need to define look_counter as an integer.

int look_counter = 0;

EDIT: Doh, just as I thought I had finally helped someone ;)

tobulos1

Quote from: Haggis on Sun 22/03/2015 17:25:48
If you've not done so - you need to define look_counter as an integer.

int look_counter = 0;

EDIT: Doh, just as I thought I had finally helped someone ;)

Haha, sorry! I was starting at the tutorial manual and noticed they used the integer before their counters. So I figured, maybe that's what I have to do. But thank you anyway, much appreciated! ;-D

Cassiebsg

Good you figured it out. :-D

I'm still novice and I mostly use bool in my scripts so far. So forgot about the int... (laugh) No wait, stratch that... I didn't forgot, I wanted you to find it out for your self... ;)(roll)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk