Frictional Games Forum (read-only)
Scripting help needed please, fatal 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 help needed please, fatal error... (/thread-11394.html)



Scripting help needed please, fatal error... - TheDavenia - 11-17-2011

Hey guys I'm getting this error every time i try to load up my map:


[Image: fatalerrorqy.png]

And here's my script:


void OnStart()
{
AddEntityCollideCallback("Player", "BruteSpawn", "ActivateBrute", true, 1);
MonsterPath();
MonsterPath1();
AddEntityCollideCallback("servant_brute_1", "ScriptArea_3", "BruteDisable", true, 1);
AddEntityCollideCallback("servant_grunt_1", "GruntDisable", "GruntDisable", true, 1);
SetEntityPlayerInteractCallback("prison_1", "LockCheck", false);
}

void LockCheck(string &in asEntity)
if(GetSwingDoorLocked("prison_1") == true)
{
PlaySoundAtEntity("GruntSlash", "attack_claw_hit.snt", "Scream", 1, true);
AddTimer("", 0.5f, "Scream");
SetPlayerActive(true);
StartPlayerLookAt("LookAtGrunt", 10, 50, "");
}

void Scream(string &in asTimer)
{
PlaySoundAtEntity("HumanScream", "21_intro_scream.snt", "Scream", 1, true);
AddTimer("", 1.0f, "Grunt");
}

void Grunt(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
}

void MonsterPath1()
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, "");
}

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

void ActivateBrute(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
AddTimer("", 0.1f, "TimerStopPlayerLookAtWall");
SetPlayerActive(true);
}

void TimerStopPlayerLookAtWall(string &in asTimer)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
StopPlayerLookAt();
AddTimer("", 0.0f, "FalconPunch");
}

void MonsterPath()
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.0f, "");
}

void FalconPunch(string &in asTimer)
{
PlaySoundAtEntity("HitWall", "attack_claw_hit.snt", "SlashSound", 1, true);
CreateParticleSystemAtEntity("WallSlash", "ps_break_cavein.ps", "LookAtWall", false);
AddTimer("", 0.3f, "BreakWall");
}

void BreakWall(string &in asTimer)
{
PlaySoundAtEntity("WallBreak", "03_break_wall.snt", "LookAtWall", 1, true);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_2", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_3", false);
SetEntityActive("BreakWall_1", false);
SetEntityActive("BrokenWall_1", true);
SetEntityActive("rock_debris01_1", true);
SetEntityActive("rock_debris01_2", true);
SetEntityActive("rock_debris01_3", true);
SetEntityActive("rock_debris01_4", true);
SetEntityActive("rock_debris01_5", true);
SetEntityActive("rock_debris01_6", true);
SetEntityActive("servant_brute_1", true);
StopPlayerLookAt();
StartPlayerLookAt("servant_brute_1", 10, 50, "");
}

void BruteDisable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
StopPlayerLookAt();
SetPlayerActive(false);
}

Please help someone!


RE: Scripting help needed please, fatal error... - Unearthlybrutal - 11-17-2011

Try thisSmile
Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "BruteSpawn", "ActivateBrute", true, 1);
MonsterPath();
MonsterPath1();
AddEntityCollideCallback("servant_brute_1", "ScriptArea_3", "BruteDisable", true, 1);
AddEntityCollideCallback("servant_grunt_1", "GruntDisable", "GruntDisable", true, 1);
SetEntityPlayerInteractCallback("prison_1", "LockCheck", false);
}

void LockCheck(string &in asEntity)
{
if(GetSwingDoorLocked("prison_1") == true)
{
PlaySoundAtEntity("GruntSlash", "attack_claw_hit.snt", "Scream", 1, true);
AddTimer("", 0.5f, "Scream");
SetPlayerActive(true);
StartPlayerLookAt("LookAtGrunt", 10, 50, "");
}
}

void Scream(string &in asTimer)
{
PlaySoundAtEntity("HumanScream", "21_intro_scream.snt", "Scream", 1, true);
AddTimer("", 1.0f, "Grunt");
}

void Grunt(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
}

void MonsterPath1()
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, "");
}

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

void ActivateBrute(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
AddTimer("", 0.1f, "TimerStopPlayerLookAtWall");
SetPlayerActive(true);
}

void TimerStopPlayerLookAtWall(string &in asTimer)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
StopPlayerLookAt();
AddTimer("", 0.0f, "FalconPunch");
}

void MonsterPath()
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.0f, "");
}

void FalconPunch(string &in asTimer)
{
PlaySoundAtEntity("HitWall", "attack_claw_hit.snt", "SlashSound", 1, true);
CreateParticleSystemAtEntity("WallSlash", "ps_break_cavein.ps", "LookAtWall", false);
AddTimer("", 0.3f, "BreakWall");
}

void BreakWall(string &in asTimer)
{
PlaySoundAtEntity("WallBreak", "03_break_wall.snt", "LookAtWall", 1, true);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_2", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_3", false);
SetEntityActive("BreakWall_1", false);
SetEntityActive("BrokenWall_1", true);
SetEntityActive("rock_debris01_1", true);
SetEntityActive("rock_debris01_2", true);
SetEntityActive("rock_debris01_3", true);
SetEntityActive("rock_debris01_4", true);
SetEntityActive("rock_debris01_5", true);
SetEntityActive("rock_debris01_6", true);
SetEntityActive("servant_brute_1", true);
StopPlayerLookAt();
StartPlayerLookAt("servant_brute_1", 10, 50, "");
}

void BruteDisable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
StopPlayerLookAt();
SetPlayerActive(false);
}




RE: Scripting help needed please, fatal error... - TheDavenia - 11-17-2011

(11-17-2011, 06:25 PM)Unearthlybrutal Wrote: Try thisSmile
Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "BruteSpawn", "ActivateBrute", true, 1);
MonsterPath();
MonsterPath1();
AddEntityCollideCallback("servant_brute_1", "ScriptArea_3", "BruteDisable", true, 1);
AddEntityCollideCallback("servant_grunt_1", "GruntDisable", "GruntDisable", true, 1);
SetEntityPlayerInteractCallback("prison_1", "LockCheck", false);
}

void LockCheck(string &in asEntity)
{
if(GetSwingDoorLocked("prison_1") == true)
{
PlaySoundAtEntity("GruntSlash", "attack_claw_hit.snt", "Scream", 1, true);
AddTimer("", 0.5f, "Scream");
SetPlayerActive(true);
StartPlayerLookAt("LookAtGrunt", 10, 50, "");
}
}

void Scream(string &in asTimer)
{
PlaySoundAtEntity("HumanScream", "21_intro_scream.snt", "Scream", 1, true);
AddTimer("", 1.0f, "Grunt");
}

void Grunt(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
}

void MonsterPath1()
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, "");
}

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

void ActivateBrute(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
AddTimer("", 0.1f, "TimerStopPlayerLookAtWall");
SetPlayerActive(true);
}

void TimerStopPlayerLookAtWall(string &in asTimer)
{
StartPlayerLookAt("LookAtWall", 10, 50, "");
StopPlayerLookAt();
AddTimer("", 0.0f, "FalconPunch");
}

void MonsterPath()
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.0f, "");
}

void FalconPunch(string &in asTimer)
{
PlaySoundAtEntity("HitWall", "attack_claw_hit.snt", "SlashSound", 1, true);
CreateParticleSystemAtEntity("WallSlash", "ps_break_cavein.ps", "LookAtWall", false);
AddTimer("", 0.3f, "BreakWall");
}

void BreakWall(string &in asTimer)
{
PlaySoundAtEntity("WallBreak", "03_break_wall.snt", "LookAtWall", 1, true);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_xlarge.ps", "Smoke_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_1", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_2", false);
CreateParticleSystemAtEntity("Smoke", "ps_area_fog_moving.ps", "SmokePush_3", false);
SetEntityActive("BreakWall_1", false);
SetEntityActive("BrokenWall_1", true);
SetEntityActive("rock_debris01_1", true);
SetEntityActive("rock_debris01_2", true);
SetEntityActive("rock_debris01_3", true);
SetEntityActive("rock_debris01_4", true);
SetEntityActive("rock_debris01_5", true);
SetEntityActive("rock_debris01_6", true);
SetEntityActive("servant_brute_1", true);
StopPlayerLookAt();
StartPlayerLookAt("servant_brute_1", 10, 50, "");
}

void BruteDisable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
StopPlayerLookAt();
SetPlayerActive(false);
}

I don't get the error anymore, thanks for that.
But now the event doesn't happen when i click the door?


RE: Scripting help needed please, fatal error... - Unearthlybrutal - 11-17-2011

The event should happen when you touch the door when it's locked. If it's not locked, nothing happens.
Make sure that the door is locked when you touch it


RE: Scripting help needed please, fatal error... - TheDavenia - 11-17-2011

(11-17-2011, 06:50 PM)Unearthlybrutal Wrote: The event should happen when you touch the door when it's locked. If it's not locked, nothing happens.
Make sure that the door is locked when you touch it
It's locked i checked the level editor...
The player gets deactivated, but the sounds don't happen and the grunt doesn't spawn either


RE: Scripting help needed please, fatal error... - Unearthlybrutal - 11-17-2011

You haven't named the timers. I don't know if that has something to do with that.
For example: AddTimer("screamtimer", 0.5f, "Scream");


RE: Scripting help needed please, fatal error... - TheDavenia - 11-17-2011

(11-17-2011, 09:27 PM)Unearthlybrutal Wrote: You haven't named the timers. I don't know if that has something to do with that.
For example: AddTimer("screamtimer", 0.5f, "Scream");
Well... I don't really think that's the problem cause in my other scripts I din't name them as well... But I'll try...
Nope... Still not working...