07-28-2014, 04:16 AM
I don't know what I'm doing.
I have 2 separate scripts for different monsters spawning when you enter different areas. The game crashes if they're both in the script, but if there's only one at a time it runs perfectly.
I have 2 separate scripts for different monsters spawning when you enter different areas. The game crashes if they're both in the script, but if there's only one at a time it runs perfectly.
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0.0001, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.0001, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0.001, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0.0001, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_17", 0.0001, "");
SetEntityActive("servant_brute_1", true);
}
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide_2", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_18", 5, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_26", 0.0001, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_29", 0.0001, "");
SetEntityActive("servant_brute_2", true);
}