01-07-2013, 02:28 PM
Are you sure there isn't a bug in the script itself? The fact that AddPropForce() works only means that OnStart() get's called, it doesn't tell you anything about the other functions. There could be other subtle errors.
For example, here:
Are you sure that the first script area is named "area" in the editor?
You can use AddDebugMessage() to check which functions get called when. If a callback should be called but isn't, then it means that it wasn't hooked up correctly. Something along these lines:
For example, here:
PHP Code:
AddEntityCollideCallback("Player", "area", "cake", false, 0);
Are you sure that the first script area is named "area" in the editor?
You can use AddDebugMessage() to check which functions get called when. If a callback should be called but isn't, then it means that it wasn't hooked up correctly. Something along these lines:
PHP Code:
// Debugging using AddDebugMessage()
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)
{
AddDebugMessage("In cake().", false);
SetEntityActive("suitor", true);
AddEnemyPatrolNode("suitor", "PathNode1", 0, "");
AddEnemyPatrolNode("suitor", "PathNode2", 0, "");
AddEntityCollideCallback("suitor", "ScriptArea_1", "cake1", false, 1);
}
void cake1(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("In cake1().", false);
SetEntityActive("suitor", false);
}