Frictional Games Forum (read-only)

Full Version: Enemy path script issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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'
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.