I've tested the script - as far as code goes, it's well formed (should work in theory).
Is your monster by any chance completely inside (or at least intersects with) ScriptArea_1? Like, did you want it to be deactivated once it exits that area? That would explain it all. If it is, then almost as soon as you activate it in cake(), a collision is detected with the script area, so cake1() is called, where the monster is immediately disabled. It happens so fast you can't even see the enemy appearing in game.
If that's it, you can simply fix the problem by editing the cake() function, replacing the last parameter to AddEntityCollideCallback() from 1 (collision detected on enter) to -1 (collision detected on exit):
AddEntityCollideCallback("suitor", "ScriptArea_1", "cake1", false, -1);
BTW, to avoid errors of this kind, which arise when code is based on "magic numbers", it's a good idea to use named constants - you don't have to worry about actual values all the time,
and it improves code readability.
Something like this:
// First you consult the wiki once, to see what the values mean,
// and then you declare them as named constants (use descriptive names).
// Note: constants are oftern written in all caps, to easily distingusih them,
// but it's not required.
const int COLLIDE_ON_ENTER = 1;
const int COLLIDE_ON_LEAVE = -1;
const int COLLIDE_ON_BOTH = 0;
void OnStart()
{
AddDebugMessage("In OnStart().", false); // The message will be displayed in the lower left corner
AddPropForce ("rope_beam02_Body_1", 500, 0, 0, "world");
PlayMusic("12_amb.ogg", true, 0.8, 1, 1, true);
AddEntityCollideCallback("Player", "area", "cake", false, 0);
}
void cake(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("suitor", true);
AddEnemyPatrolNode("suitor", "PathNode1", 0, "");
AddEnemyPatrolNode("suitor", "PathNode2", 0, "");
// ----- HERE: -----
AddEntityCollideCallback("suitor", "ScriptArea_1", "cake1", false, COLLIDE_ON_LEAVE);
}
void cake1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("suitor", false);
}
P.S. In code editors you can usually make use of the auto-completion feature. In Notepad++, you can start to type the name of the constant, or function you've allready defined/used elsewhere (like: COLL), and then press Ctrl+Enter (on Windows) to get auto-completion suggestions (which will be, in this case, the three constants declared at the top).