Action not found

Posted By: Thehawk

Action not found - 04/28/06 16:24

Hello,

Where do I add actions to a script when I'm loading a new level?

I'm currenty calling the load level function, but after the level is loaded, I get an "Action_X" not found message.

Thank you in advance. Let me know if this is unclear.
Posted By: ROMAC

Re: Action not found - 04/28/06 16:29

You have function main which is a function that is called when the engine starts. In there you need to call level_load(level_name)
Actions are defined outside of the function anywhere in the code, they look like this:
Code:

action test
{
// code goes here
while (1)
{
wait(1);
}
}


You can't make an action inside a function, it must be outside, anywhere you want.
Posted By: Michael_Schwarz

Re: Action not found - 04/28/06 16:30

a common mistake is to place functions/actions OVER the main function, which also results in a action not found.

you must place it AFTER the main function in order to make it work correctly
Posted By: ROMAC

Re: Action not found - 04/28/06 16:32

Quote:

a common mistake is to place functions/actions OVER the main function, which also results in a action not found.

you must place it AFTER the main function in order to make it work correctly




That shouldn't be a problem. Placing actions/functions over the main function is fine, you do it all the time when you use include.
Posted By: Michael_Schwarz

Re: Action not found - 04/28/06 16:36

Quote:

Quote:

a common mistake is to place functions/actions OVER the main function, which also results in a action not found.

you must place it AFTER the main function in order to make it work correctly




That shouldn't be a problem. Placing actions/functions over the main function is fine, you do it all the time when you use include.




actually, when I place a action over the main function it gives me the same error... could be a unique problem for me though
Posted By: FoxHound

Re: Action not found - 04/28/06 17:03

I've never had a problem when placing functions over Main. I always do this.

However the orginal quesiton is not answered.

I think you need to make a script, and from there put in your actions. If you have done this then you have not connected the script with that level. If you have done both of these make sure that you have spelled the name of your action correctly.
Posted By: Thehawk

Re: Action not found - 04/28/06 19:58

Thanks for all of your replies. Foxhound you are closer to the solution to my problem. I've tried to create a script seperate from my main level. These included all the actions and functions than I would need for the second level of the game. (Where the player goes after stepping through the teleporter in level 1)

the script looks like this:

Code:
 action level_change
{
my.event = impact;
my.function = Load_level;
}

function load_level

{
if blah blah blah
{
load_level (levelname.wmb)
/*The tutorial i used said to place any actions for the next level after that level's loading function... which would be here
*/

other stuff
}



But the problem is when I do that, the engine says: action Change_level is an unkown parameter.

i hope this is clearer.
Posted By: Michael_Schwarz

Re: Action not found - 04/28/06 20:03

maybe becuase its called level_change and not change_level?
Posted By: Filipe

Re: Action not found - 04/28/06 21:11

i don't know if i understood your code correctly, but if i did i think that's the problem:

Code:


function load_level
{
if blah blah blah
{
level_load ("levelname.wmb");//you forgot the ""
/*The tutorial i used said to place any actions for the next level after that level's loading function...*/
other stuff
}
/*...which would be HERE, outside the load_level function*/
action level_change
{
//my.event = impact; //'my.event' is actually the function
// that handles the event
//my.function = Load_level;//as far as i know, 'my.function' only works for particles...
my.enable_impact = on;
my.event = load_level;
}


Posted By: FoxHound

Re: Action not found - 04/29/06 00:34

I think I know your problem. You haven't included your scecond script into your main script. Basically you only make on set of scripts. You add them as "includes" into the main script, which is what you set for all the levels. You don't make one script for each level.
Posted By: Thehawk

Re: Action not found - 04/30/06 03:41

hmm most of the errors stopped foxhound. Filipe you were also correct. But now I get an error that says "Next Level Action not found" But the thing is I did a search in files and I don't have an action with that name.
© 2024 lite-C Forums