How would I make it so when he stops he will face forward ?
I have him following with FollowCharacterEx with FollowCharacterEx(SIDE_KICK, EGO, 25, 80); but I would like him to face forward when ever he stops .
Try this in rep_ex:
if ((character[SIDE_KICK].walking == 0) && (character[SIDE_KICK].loop != 0)) {
// if SIDE_KICK isn't moveing, and isn't already facing down
FaceLocation (SIDE_KICK, character[SIDE_KICK].x, character[SIDE_KICK].y + 20);
}
Sorry where is this rep_ex: .
Create it in your global script. Like this:
function repeatedly_execute () {
}
Whe I added it in there it gave me a if error ?
Check your braces... thats all I can say without seeing some code.
Yeah, sorry, rep_ex is repeatedly_execute (specificly, the global repeatedly_excute, unless you only want this to happen in one room), I was just too lazy to type the whole thing.
What is the error exactly? As Alynn said as I was typing this, chances are it's just a problem with the braces ({ and }).
This is the error .
---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was in 'Global script':
Error (line 23): Nested functions not supported (you may have forgotten a closing brace)
where would that closing brace be ?
Hard to tell without seeing the script.
Could you post the script at line 23, and a few before, so we can see what's what?
I did a // so I could run the script for now .
#sectionstart repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
// put anything you want to happen every game cycle here
//if ((character[SIDE_KICK].walking == 0) && (character[SIDE_KICK].loop != 0)) {
// if SIDE_KICK isn't moveing, and isn't already facing down
//FaceLocation (SIDE_KICK, character[SIDE_KICK].x, character[SIDE_KICK].y + 20);
}
#sectionend repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function show_inventory_window () {
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
// ** DEFAULT INVENTORY WINDOW
InventoryScreen();
/*
// ** CUSTOM INVENTORY WINDOW
GUIOn (INVENTORY);
// switch to the Use cursor (to select items with)
SetCursorMode (MODE_USE);
// But, override the appearance to look like the arrow
SetMouseCursor (6);
*/
}
OK, I see it. It needs to go before the #sectionend repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE line, like so:
#sectionstart repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
Ã, // put anything you want to happen every game cycle here
Ã, //if ((character[SIDE_KICK].walking == 0) && (character[SIDE_KICK].loop != 0)) {
Ã, Ã, // if SIDE_KICK isn't moveing, and isn't already facing down
Ã, Ã, //FaceLocation (SIDE_KICK, character[SIDE_KICK].x, character[SIDE_KICK].y + 20);
Ã, }
} // This one right here.
#sectionend repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
And don't forget to un-comment the code (remove the //).
For future reference, you could use the 'Match Brace' function in the script editor ('Edit -> Match brace' or 'Ctrl-B') to check for you. I always forget about it though, which is why I didn't mention it earlier.
I was doing some testing and need it to run and it won't with the code wrong so I did the // so it would run .
Now I get the if stuff ?
---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was in 'Global script':
Error (line 8): Parse error: unexpected 'if'
// main global script file
#sectionstart game_start // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
// called when the game starts, before the first room is loaded
}
#sectionend game_start // DO NOT EDIT OR REMOVE THIS LINE
if ((character[SIDE_KICK].walking == 0) && (character[SIDE_KICK].loop != 0)) {
// if SIDE_KICK isn't moveing, and isn't already facing down
FaceLocation (SIDE_KICK, character[SIDE_KICK].x, character[SIDE_KICK].y + 20);
}
#sectionstart repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
// put anything you want to happen every game cycle here
#sectionend repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
Now the code is outside of the repeatedly_execute function, so the engine doesn't know how to deal with it - hence the 'unexpected if' error. Move it back in, so that section of code looks like this:
// main global script file
#sectionstart game_startÃ, // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
Ã, // called when the game starts, before the first room is loaded
}
#sectionend game_startÃ, // DO NOT EDIT OR REMOVE THIS LINE
// Code was here, for some reason.
#sectionstart repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
Ã, // put anything you want to happen every game cycle here
Ã, if ((character[SIDE_KICK].walking == 0) && (character[SIDE_KICK].loop != 0)) {
Ã, Ã, // if SIDE_KICK isn't moveing, and isn't already facing down
Ã, Ã, FaceLocation (SIDE_KICK, character[SIDE_KICK].x, character[SIDE_KICK].y + 20);
Ã, }
}
#sectionend repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
Thank you for taking the time to help me . sorry I was being a dumb A@@ .
It works now . I was never good at this stuff..
Thank you again .
No problem, that's what I'm here for. Glad you got it sorted.