Frictional Games Forum (read-only)
Scripting Error - 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: Scripting Error (/thread-18024.html)



Scripting Error - Zaffre - 08-29-2012

Hi. Recently I've begun creating a custom story with the help of YourComputer's video series. Up to now, I've created scripts without problems (and fixed errors) but recently I've gotten one I can't seem to figure out. I've looked over the script multiple times, but find nothing wrong. This is what I'm getting:
Spoiler below!
[Image: 9SD6y.png]

And this is my map01.hps:
Spoiler below!
void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

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

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


When a key is picked up, a Grunt will spawn behind a door, smash the door down, and make his way outside. Once he's outside, if a lever is pulled, a cave in will spawn and a ragdoll of the Grunt will spawn and fall onto the ground.

Thanks in advance!


RE: Scripting Error - Melvin - 08-29-2012

void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Try to delete this (copy it to another notepad) and run Amnesia again, does this solve the error problem?


RE: Scripting Error - Statyk - 08-29-2012

void DoCaveIn(string &in entity, int level_state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}


(50, 44) was leading to the end of "level" in the syntax. I noticed you have a space, but in the parameters, you have an underscore. Try adding the underscore.


RE: Scripting Error - Zaffre - 08-29-2012

(08-29-2012, 04:55 PM)Statyk Wrote: void DoCaveIn(string &in entity, int level_state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}


(50, 44) was leading to the end of "level" in the syntax. I noticed you have a space, but in the parameters, you have an underscore. Try adding the underscore.
That fixed it, (thanks a bunch!)but now I'm getting a different error.
[Image: oJD8W.png]
Since I'm relatively new to AngelScript, I'm not sure what this means. If I'm correct, the integers in the parentheses mean the line of code and the character of code.

[quote="SmokeMelvin"]
Quote:void DoCaveIn(string &in entity, int level state)
{
if(level_state == 1);
{
SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Try to delete this (copy it to another notepad) and run Amnesia again, does this solve the error problem?
Also, this did not fix the error.

If I get an answer and I'm still getting errors, I'll stop pestering you and just try it again.


RE: Scripting Error - Steve - 08-29-2012

just taking a fast look I found the errors I think.
you have three entitiies in one calback: SetEntityActive("cave_in_1", "cave_in_2", "cave_in_3", true);
make it like this:
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
SetEntityActive("cave_in_3", true);
 
furthermore:
you have an ";" after your if statement delete it: if(level_state == 1) (like this)


RE: Scripting Error - Statyk - 08-29-2012

Try this. I highlighted changes in bold:
Spoiler below!

void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateChangeCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

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

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int alState)
{
if(alState == 1)
{
SetEntityActive("cave_in_*", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}





RE: Scripting Error - Zaffre - 08-29-2012

(08-29-2012, 06:09 PM)Statyk Wrote: Try this. I highlighted changes in bold:
Spoiler below!

void OnStart()
{
SetEntityPlayerInteractCallback("key_study_1", "ActivateMonster", true);
AddUseItemCallback("BedroomLevelDoorOpen", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("activate_player", 3, "FadeIn");

//Lever
SetEntityConnectionStateChangeCallback("lever_small01_1", "DoCaveIn");
}


void OnEnter()
{

}

void OnLeave()
{

}

void FadeIn(string &in activate_player)
{
FadeIn(2);
SetPlayerActive(true);
SetEntityActive("servant_grunt_2", false);
}

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

}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked("level_wood_1", false);
RemoveItem("key_study_1");
}

void DoCaveIn(string &in entity, int alState)
{
if(alState == 1)
{
SetEntityActive("cave_in_*", true);
FadeEnemyToSmoke("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
}

}


Thank you. All the errors are gone and everything works great. Thanks a ton!


RE: Scripting Error - Statyk - 08-29-2012

No problemo =]