Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fix the error
Josh9810 Offline
Junior Member

Posts: 34
Threads: 9
Joined: Oct 2012
Reputation: 0
#1
Question  How to fix the error

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.
10-23-2012, 01:16 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: How to fix the error

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.

Trying is the first step to success.
(This post was last modified: 10-23-2012, 01:30 PM by FlawlessHappiness.)
10-23-2012, 01:27 PM
Find
GrAVit Offline
Senior Member

Posts: 580
Threads: 15
Joined: Oct 2011
Reputation: 22
#3
RE: How to fix the error

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

10-23-2012, 04:12 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: How to fix the error

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

Trying is the first step to success.
10-23-2012, 04:35 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#5
RE: How to fix the error

(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.

[Image: 2H1Mc.jpg]
10-23-2012, 05:43 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: How to fix the error

(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!

Trying is the first step to success.
10-23-2012, 06:34 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#7
RE: How to fix the error

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

[Image: 2H1Mc.jpg]
10-23-2012, 06:54 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#8
RE: How to fix the error

(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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-23-2012, 06:56 PM
Website Find
Josh9810 Offline
Junior Member

Posts: 34
Threads: 9
Joined: Oct 2012
Reputation: 0
#9
RE: How to fix the error

(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?
(This post was last modified: 10-24-2012, 04:39 AM by Josh9810.)
10-24-2012, 04:13 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#10
RE: How to fix the error

(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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-24-2012, 06:36 AM
Find




Users browsing this thread: 3 Guest(s)