cooleoj
Junior Member
Posts: 24
Threads: 6
Joined: Aug 2011
Reputation:
0
|
Unexpected end of file!! ;(
So i get a error when i start my map and i really suck at scripting so i could really need some help
void OnStart()
{
AddEntityCollideCallback("Player", "scarearea1", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("scaredoor1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddUseItemCallback("", "hollowneedle1", "lockeddoor1", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lockeddoor1", false, true);
PlaySoundAtEntity("", "unlock_door", "lockeddoor1", 0, false);
RemoveItem("hollowneedle1");
{
AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState);
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}
That is my script.
|
|
10-06-2011, 07:41 AM |
|
Gamemakingdude
Senior Member
Posts: 470
Threads: 82
Joined: Nov 2010
Reputation:
9
|
RE: Unexpected end of file!! ;(
No wait. This is completely wrong! Give me 2 minutes to fix this up and please take the time to read through the code and see what was wrong!
void OnStart() { AddEntityCollideCallback("Player", "scarearea1", "func_slam", true, 1); AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1); AddUseItemCallback("", "hollowneedle1", "lockeddoor1", "FUNCTION", true); }
void func_slam(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("scaredoor1", true, true); PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); GiveSanityDamage(5.0f, true);
} void FUNCTION(string &in asItem, string &in asEntity) { SetSwingDoorLocked("lockeddoor1", false, true); PlaySoundAtEntity("", "unlock_door", "lockeddoor1", 0, false); RemoveItem("hollowneedle1"); }
void MonsterFunction(string &in asParent, string &in asChild, int alState); { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); }
The problem was you had code in the wrong places, put backets where they werent supposed to go to and it wasnt indented correctly..
(This post was last modified: 10-06-2011, 07:56 AM by Gamemakingdude.)
|
|
10-06-2011, 07:52 AM |
|
cooleoj
Junior Member
Posts: 24
Threads: 6
Joined: Aug 2011
Reputation:
0
|
RE: Unexpected end of file!! ;(
Nope...
Now it crashes and says this instead:
main (25,1) : ERR : Unexpected token '{'
|
|
10-06-2011, 07:59 AM |
|
xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
RE: Unexpected end of file!! ;(
void OnStart()
{
AddEntityCollideCallback("Player", "scarearea1", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("scaredoor1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddUseItemCallback("", "hollowneedle1", "lockeddoor1", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lockeddoor1", false, true);
PlaySoundAtEntity("", "unlock_door", "lockeddoor1", 0, false);
RemoveItem("hollowneedle1");
}
AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1);
{
void MonsterFunction(string &in asParent, string &in asChild, int alState);
}
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}
This might work.
BTW: if it works, don't be mad if your script doesn't work because it's like Gamemakingdude said "completly wrong".
If you can launch your map without any errors, tell me and I can fix the script for you.
Dubstep <3
|
|
10-06-2011, 08:09 AM |
|
cooleoj
Junior Member
Posts: 24
Threads: 6
Joined: Aug 2011
Reputation:
0
|
RE: Unexpected end of file!! ;(
main (23,25) : ERR : Expected identifier
main (24,1) : ERR : unexpected token '{'
main (28,1) : ERR : unexpected token '{'
hmmm..
BTW everything worked before i tried to add a monster script
(This post was last modified: 10-06-2011, 08:27 AM by cooleoj.)
|
|
10-06-2011, 08:13 AM |
|
Gamemakingdude
Senior Member
Posts: 470
Threads: 82
Joined: Nov 2010
Reputation:
9
|
RE: Unexpected end of file!! ;(
void OnStart() { AddEntityCollideCallback("Player", "scarearea1", "func_slam", true, 1); AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1); AddUseItemCallback("", "hollowneedle1", "lockeddoor1", "FUNCTION", true); }
void func_slam(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("scaredoor1", true, true); PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); GiveSanityDamage(5.0f, true);
} void FUNCTION(string &in asItem, string &in asEntity) { SetSwingDoorLocked("lockeddoor1", false, true); PlaySoundAtEntity("", "unlock_door", "lockeddoor1", 0, false); RemoveItem("hollowneedle1"); }
void MonsterFunction(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); }
Fixed it i found an ; at the end of one of your procedures.
|
|
10-06-2011, 08:27 AM |
|
cooleoj
Junior Member
Posts: 24
Threads: 6
Joined: Aug 2011
Reputation:
0
|
RE: Unexpected end of file!! ;(
main (4,5) : ERR : no matching signatures to 'AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1); '
Gahhh seems i messed up some crazy shit
|
|
10-06-2011, 08:36 AM |
|
Gamemakingdude
Senior Member
Posts: 470
Threads: 82
Joined: Nov 2010
Reputation:
9
|
RE: Unexpected end of file!! ;(
Have you got that trigger in the map by any chance and is it named right?
|
|
10-06-2011, 08:45 AM |
|
cooleoj
Junior Member
Posts: 24
Threads: 6
Joined: Aug 2011
Reputation:
0
|
RE: Unexpected end of file!! ;(
Yes i have and its named "monstertrigger1"
|
|
10-06-2011, 08:46 AM |
|
Gamemakingdude
Senior Member
Posts: 470
Threads: 82
Joined: Nov 2010
Reputation:
9
|
RE: Unexpected end of file!! ;(
Try changing true to false.
|
|
10-06-2011, 09:07 AM |
|
|