Scripting help for FollowCharacter

Started by Imhotep, Sun 30/07/2006 12:41:31

Previous topic - Next topic

gypsysnail

The error message was:
There was an error compiling your script. The problem was in: 'Global Script' Error (line 16): parse error: unexpected if

(and from my understanding, I think I have done it all wrong with the 'if')

ok here is my script - it might seem a silly addition by me but you know me being new so be patient pleaseÃ,  ;)

Code: ags
#sectionstart repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here
}
function repeatedly_execute_always(){cJonah.FollowCharacter(cEgo, 5, 15);
}
	if (character[EGO].x > 299) {
Ã,  character[JONAH].StopMoving();
}
#sectionend repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

The if-statement isn't inside the function:

Code: ags
function repeatedly_execute_always() {
  cJonah.FollowCharacter(cEgo, 5, 15);
  if (character[EGO].x > 299) {
    character[JONAH].StopMoving();
  }
}


(You don't need to put character[JONAH].StopMoving(); in {}s, that's only needed for grouping commands together. And you can write cJonah instead of character[JONAH].

gypsysnail

Ok thanks Khris. Now the problem is the bird stops at co-ordinate >299 (300) - not what I wanted, I got the script from the manual to test to see what would happen. Now I need to take the next step to making the bird stop and sit on my character's shoulder whenever she stops. I have only one frame of the bird sitting - how will I put this into use through the script? Many thanks for the help
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

m0ds

About this command, I'm using the new code but after clicking something I want the following character to STOP following the main character. I just can't for the life of me figure it out. The manual says to pass it as "null"...what does that mean? I put null in the chartofollow, eagerness and the other one but the sheep is still following!

How do I stop them from following please? :)

Khris


m0ds


Dualnames

The stupid question but whatever does follow function work globally? Which means does the character(follower) change room when the character does? I think he doesn;t but I'm not sure since of the big way big mind boggingly big size of script in my game.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Khris

What does the size of your script have to do with anything...?
The following character does follow through all the rooms; he starts out at the coordinates the player entered the room at. And with a short delay, too, depending on the command's parameters.

Dualnames

It has. It has. So thanks a lot Khris. Valuable info.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk