Frictional Games Forum (read-only)
How to fix the 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: How to fix the error (/thread-18893.html)

Pages: 1 2 3


How to fix the error - Josh9810 - 10-23-2012

I am really new to scripting and just want a monster to walk out a door go away then disappear so I can get a key to get out.

My script is here and it says FATAL ERROR: could not load script file
(map stuff)
main (32,2) : ERR : Unexpected end of file

I need help on how to fix these problems I dont have much experience with scripting at all.
-------------------------------------------------------------------------------------------------
void OnStart()
{
AddEntityCollideCallback("Player", "brutey", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Brute", true);
AddEnemyPatrolNode("Brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_12", 0, "");
AddUseItemCallback("", "key", "unlock", "unlockdoor", true);

void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("unlock", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false);
RemoveItem("key");
AddEntityCollideCallback("Brute", "brute_go", "Monsterdisappear", true, 1);
}
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
SetEnemyDisabled("Brute", true);
}
-----------------------------------------------------------------------------------------
sorry if ultimate noob but Im 13.


RE: How to fix the error - FlawlessHappiness - 10-23-2012

Your age doesnt tell us anything about how noob you are Wink

Unexpected end of file, means you have missed to close these "" or () or { }

Is this you full scripts? I don't think it is since you don't have an OnEnter() and OnLeave()

Could you post the whole scripts.. Nothing looks wrong with your script here except:

PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false); did you call your door "unlock"? if not, then this should be changed to the door name

And you might want to put this into void OnStart()

AddUseItemCallback("", "Key", "unlock", "unlockdoor", true); The "unlock" is your doorname. If this is not your doorname, change it.


RE: How to fix the error - GrAVit - 10-23-2012

According to my experience, OnEnter() and OnLeave() aren't mandatory. Especially if you intend that level to be visited only once by the player.


RE: How to fix the error - FlawlessHappiness - 10-23-2012

Makes sense Smile Though i'd still like to know if there is more than just this.


RE: How to fix the error - ZodiaC - 10-23-2012

(10-23-2012, 01:16 PM)Josh9810 Wrote: I am really new to scripting and just want a monster to walk out a door go away then disappear so I can get a key to get out.

My script is here and it says FATAL ERROR: could not load script file
(map stuff)
main (32,2) : ERR : Unexpected end of file

I need help on how to fix these problems I dont have much experience with scripting at all.
-------------------------------------------------------------------------------------------------
void OnStart()
{
AddEntityCollideCallback("Player", "brutey", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Brute", true);
AddEnemyPatrolNode("Brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_12", 0, "");
AddUseItemCallback("", "key", "unlock", "unlockdoor", true);

void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("unlock", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false);
RemoveItem("key");
AddEntityCollideCallback("Brute", "brute_go", "Monsterdisappear", true, 1);
}
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
SetEnemyDisabled("Brute", true);
}
-----------------------------------------------------------------------------------------
sorry if ultimate noob but Im 13.
I don't see any Logic error here..But you have a Syntax Error.If you are using notepad++ go to line:21,Col:1 (Between AddUseItemCallback("", "key", "unlock", "unlockdoor", true); and void unlockdoor(string &in asItem, string &in asEntity) ) there you forgot to put a } !
I hope this is the only error.


RE: How to fix the error - FlawlessHappiness - 10-23-2012

(10-23-2012, 05:43 PM)belikov Wrote:
(10-23-2012, 01:16 PM)Josh9810 Wrote: I am really new to scripting and just want a monster to walk out a door go away then disappear so I can get a key to get out.

My script is here and it says FATAL ERROR: could not load script file
(map stuff)
main (32,2) : ERR : Unexpected end of file

I need help on how to fix these problems I dont have much experience with scripting at all.
-------------------------------------------------------------------------------------------------
void OnStart()
{
AddEntityCollideCallback("Player", "brutey", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Brute", true);
AddEnemyPatrolNode("Brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_12", 0, "");
AddUseItemCallback("", "key", "unlock", "unlockdoor", true);

void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("unlock", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false);
RemoveItem("key");
AddEntityCollideCallback("Brute", "brute_go", "Monsterdisappear", true, 1);
}
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
SetEnemyDisabled("Brute", true);
}
-----------------------------------------------------------------------------------------
sorry if ultimate noob but Im 13.
I don't see any Logic error here..But you have a Syntax Error.If you are using notepad++ go to line:21,Col:1 (Between AddUseItemCallback("", "key", "unlock", "unlockdoor", true); and void unlockdoor(string &in asItem, string &in asEntity) ) there you forgot to put a } !
I hope this is the only error.
Oh yea! How did i miss that!


RE: How to fix the error - ZodiaC - 10-23-2012

It took me some time too...If he had more space between every void{} commands i think you would find it really fast


RE: How to fix the error - Robby - 10-23-2012

(10-23-2012, 06:54 PM)belikov Wrote: It took me some time too...If he had more space between every void{} commands i think you would find it really fast
I know what it feels like. I've had lots of script problems like the ones up above. Once I learned a little more, these errors lessened.

They still occur, but only if I write like a machinegun.


RE: How to fix the error - Josh9810 - 10-24-2012

(10-23-2012, 05:43 PM)belikov Wrote: I don't see any Logic error here..But you have a Syntax Error.If you are using notepad++ go to line:21,Col:1 (Between AddUseItemCallback("", "key", "unlock", "unlockdoor", true); and void unlockdoor(string &in asItem, string &in asEntity) ) there you forgot to put a } !
I hope this is the only error.
wow that was it...

but he wont leave the room and disappear how can I fix that like make him gone for good.

oh and how do I put the game in debug mode?

(10-23-2012, 04:35 PM)beecake Wrote: Makes sense Smile Though i'd still like to know if there is more than just this.
nope thats it
all of it nothing taken out

void OnStart()
{
AddEntityCollideCallback("Player", "brutey", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
//SetEnemyDisableTriggers("Brute", true);
SetEntityActive("Brute", true);
AddEnemyPatrolNode("Brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_12", 0, "");
AddUseItemCallback("", "key", "unlock", "unlockdoor", true);
}
void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("unlock", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false);
RemoveItem("key");
AddEntityCollideCallback("Brute", "brute_go", "Monsterdisappear", true, 1);
}
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
FadeEnemyToSmoke("Brute", true);
}

He doesnt disappear what can I change?


RE: How to fix the error - The chaser - 10-24-2012

(10-24-2012, 04:13 AM)Josh9810 Wrote:
(10-23-2012, 05:43 PM)belikov Wrote: I don't see any Logic error here..But you have a Syntax Error.If you are using notepad++ go to line:21,Col:1 (Between AddUseItemCallback("", "key", "unlock", "unlockdoor", true); and void unlockdoor(string &in asItem, string &in asEntity) ) there you forgot to put a } !
I hope this is the only error.
wow that was it...

but he wont leave the room and disappear how can I fix that like make him gone for good.

oh and how do I put the game in debug mode?

(10-23-2012, 04:35 PM)beecake Wrote: Makes sense Smile Though i'd still like to know if there is more than just this.
nope thats it
all of it nothing taken out

void OnStart()
{
AddEntityCollideCallback("Player", "brutey", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
//SetEnemyDisableTriggers("Brute", true);
SetEntityActive("Brute", true);
AddEnemyPatrolNode("Brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Brute", "PathNodeArea_12", 0, "");
AddUseItemCallback("", "key", "unlock", "unlockdoor", true);
}
void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("unlock", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlock", 0, false);
RemoveItem("key");
AddEntityCollideCallback("Brute", "brute_go", "Monsterdisappear", true, 1);
}
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
FadeEnemyToSmoke("Brute", true);
}

He doesnt disappear what can I change?
void Monsterdisappear(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Brute", false);
}

Try this Smile