Josh9810
Junior Member
Posts: 34
Threads: 9
Joined: Oct 2012
Reputation:
0
|
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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: How to fix the error
Your age doesnt tell us anything about how noob you are
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.
|
|
10-23-2012, 01:27 PM |
|
GrAVit
Senior Member
Posts: 580
Threads: 15
Joined: Oct 2011
Reputation:
22
|
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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: How to fix the error
Makes sense 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 |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
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.
|
|
10-23-2012, 05:43 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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 |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
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
|
|
10-23-2012, 06:54 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
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 |
|
Josh9810
Junior Member
Posts: 34
Threads: 9
Joined: Oct 2012
Reputation:
0
|
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 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 |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
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 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
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
10-24-2012, 06:36 AM |
|
|