Frictional Games Forum (read-only)
script error! help me! - 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: script error! help me! (/thread-14744.html)



script error! help me! - skirnks017 - 04-12-2012

i have a problem in amnesia custom history
help me please

this is my error : [Image: 2zexhdv.png]



and this is my script :

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerStartArea_1", "Reset", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "ApareceMounstruo", true, 0);
AddEntityCollideCallback("Player", "Scary_Area_2", "Scary_2", true, 1);
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
SetEntityPlayerInteractCallback("music", "Roar2", true);
SetEntityPlayerInteractCallback("music", "Roar1", true);
AddUseItemCallback("", "llave1", "puerta1", "KeyOnDoor", true); //Puerta1
AddUseItemCallback("", "llave3", "puerta3", "KeyOnDoor3", true); //Puerta3

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("puerta1", false, true);
PlaySoundAtEntity("", "unlock_door", "puerta1", 0, false);
RemoveItem("llave1");
}

void KeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("puerta3", false, true);
PlaySoundAtEntity("", "unlock_door", "puerta3", 0, false);
RemoveItem("llave3");
}

void ApareceMounstruo(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
PlaySoundAtEntity("amb_hunt", "amb_hunt.snt", "player", 5, false);
}

void Scary_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("cotito_1", true);
AddPropImpulse("cotito_1", 30, 0, 0, "world");
PlaySoundAtEntity("cotito_1", "24_iron_maiden.snt", "Player", 0, false);
AddTimer("", 0.3f, "Timer_2");
}
void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("HxH48Piano.ogg", true, 1.5, 2, 1, true);
}

void Roar1(string &in Entity)
{
PlaySoundAtEntity("Roar1", "Skirnks theme.snt", "Roar1", 0, false);
}

void Roar2(string &in Entity)
{
PlaySoundAtEntity("Roar2", "HxH48Piano1.snt", "Roar2", 0, false);
}


void Reset (string &in asParent, string &in asChild, int alState)
{


}

void OnLeave()
{

}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "Idle");
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
SetEntityActive("servant_grunt_1", true);
}

////////////////////////////
// Run when leaving map



Bye!



RE: script error! help me! - Strembitsky - 04-12-2012

Code:
void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "Idle");
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
SetEntityActive("servant_grunt_1", true);
}

Isn't in OnLeave, OnStart, or OnEnter. Move it to where you want it.


RE: script error! help me! - skirnks017 - 04-12-2012

(04-12-2012, 11:06 PM)Strembitsky Wrote:
Code:
void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "Idle");
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
SetEntityActive("servant_grunt_1", true);
}

Isn't in OnLeave, OnStart, or OnEnter. Move it to where you want it.
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerStartArea_1", "Reset", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "ApareceMounstruo", true, 0);
AddEntityCollideCallback("Player", "Scary_Area_2", "Scary_2", true, 1);
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
SetEntityPlayerInteractCallback("music", "Roar2", true);
SetEntityPlayerInteractCallback("music", "Roar1", true);
AddUseItemCallback("", "llave1", "puerta1", "KeyOnDoor", true); //Puerta1
AddUseItemCallback("", "llave3", "puerta3", "KeyOnDoor3", true); //Puerta3

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("puerta1", false, true);
PlaySoundAtEntity("", "unlock_door", "puerta1", 0, false);
RemoveItem("llave1");
}

void KeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("puerta3", false, true);
PlaySoundAtEntity("", "unlock_door", "puerta3", 0, false);
RemoveItem("llave3");
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "Idle");
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
SetEntityActive("servant_grunt_1", true);
}

void ApareceMounstruo(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
PlaySoundAtEntity("amb_hunt", "amb_hunt.snt", "player", 5, false);
}

void Scary_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("cotito_1", true);
AddPropImpulse("cotito_1", 30, 0, 0, "world");
PlaySoundAtEntity("cotito_1", "24_iron_maiden.snt", "Player", 0, false);
AddTimer("", 0.3f, "Timer_2");
}
void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("HxH48Piano.ogg", true, 1.5, 2, 1, true);
}

void Roar1(string &in Entity)
{
PlaySoundAtEntity("Roar1", "Skirnks theme.snt", "Roar1", 0, false);
}

void Roar2(string &in Entity)
{
PlaySoundAtEntity("Roar2", "HxH48Piano1.snt", "Roar2", 0, false);
}


void Reset (string &in asParent, string &in asChild, int alState)
{


}

void OnLeave()
{

}



////////////////////////////
// Run when leaving map

not work Sad



RE: script error! help me! - Strembitsky - 04-12-2012

Did the error message change?


RE: script error! help me! - DRedshot - 04-12-2012

Unexpected end of file means there is a '}' missing somewhere. Look all the way through your code again, make sure every open bracket ends with a close bracket.



RE: script error! help me! - skirnks017 - 04-12-2012

(04-12-2012, 11:29 PM)DRedshot Wrote: Unexpected end of file means there is a '}' missing somewhere. Look all the way through your code again, make sure every open bracket ends with a close bracket.
Gracias! Faltaba un corchete("}") en void start Big Grin

void OnStart()

{

AddEntityCollideCallback("Player", "PlayerStartArea_1", "Reset", true, 1);

SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);

AddEntityCollideCallback("Player", "ScriptArea_1", "ApareceMounstruo", true, 0);

AddEntityCollideCallback("Player", "Scary_Area_2", "Scary_2", true, 1);

AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);

SetEntityPlayerInteractCallback("music", "Roar2", true);

SetEntityPlayerInteractCallback("music", "Roar1", true);

AddUseItemCallback("", "llave1", "puerta1", "KeyOnDoor", true); //Puerta1

AddUseItemCallback("", "llave3", "puerta3", "KeyOnDoor3", true); //Puerta3
}