Frictional Games Forum (read-only)
Enemy path script issue - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Enemy path script issue (/thread-9612.html)



Enemy path script issue - Synestral - 08-05-2011

alright, so i have been trying to get an enemy to walk a path, and disapppear. this is the script i have
Code:
void OnStart()
{
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in entity)
{
SetEntityActive("servant_brute_1", true);
void AddEnemyPatrolNode("servant_grunt_1", "Node_1", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_2", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_3", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_4", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_5", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_6", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_5", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_4", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_3", float 0, string& "");
void AddEnemyPatrolNode("servant_grunt_1", "Node_2", float 0, string& "");
}

void MosterEnd(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", false);
}

and i get this error

FATAL ERROR: could not load script file
'custom_stories/Stalker?maps/Beginning.hps'!
main (9,60) : ERR : Expected '('
main (10,60) : ERR : Expected '('
main (11,60) : ERR : Expected '('
main (12,60) : ERR : Expected '('
main (13,60) : ERR : Expected '('
main (14,60) : ERR : Expected '('
main (15,60) : ERR : Expected '('
main (16,60) : ERR : Expected '('
main (17,60) : ERR : Expected '('
main (18,60) : ERR : Expected '('

Does anyone know ehat i am doing wrong?



RE: Enemy path script issue - MrCookieh - 08-05-2011

Yours:
Code:
void Spawn_Monster(string &in entity)
How it should be:
Code:
void Spawn_Monster(string &in asEntity)

you forgot the 'as' in front of the entity, and you put an e instead of an E.

ah, and remove those 'string&', same with the 'float'


RE: Enemy path script issue - Apjjm - 08-05-2011

Code:
void OnStart()
{
SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
}

void Spawn_Monster(string &in entity)
{
SetEntityActive("servant_brute_1", true);
void AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_6", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
void AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
}

void MosterEnd(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", false);
}

Angelscript was interpreting the "float 0" as an attempted cast, which, incidentally, would be written "float(0)". This is not necessary, as the game can implicitly cast from integers to floats correctly.

Edit:
The "asEntity" correction is unnecessary, you can call your identifiers anything as long as the function signature is correct - you could call it "giantMarshmellow" without a problem, if you really wanted Wink.