Unexpected end of file!! ;( - cooleoj - 10-06-2011
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.
RE: Unexpected end of file!! ;( - Gamemakingdude - 10-06-2011
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!
PHP Code: 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..
RE: Unexpected end of file!! ;( - cooleoj - 10-06-2011
Nope...
Now it crashes and says this instead:
main (25,1) : ERR : Unexpected token '{'
RE: Unexpected end of file!! ;( - xtron - 10-06-2011
Code: 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.
RE: Unexpected end of file!! ;( - cooleoj - 10-06-2011
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
RE: Unexpected end of file!! ;( - Gamemakingdude - 10-06-2011
PHP Code: 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.
RE: Unexpected end of file!! ;( - cooleoj - 10-06-2011
main (4,5) : ERR : no matching signatures to 'AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1); '
Gahhh seems i messed up some crazy shit
RE: Unexpected end of file!! ;( - Gamemakingdude - 10-06-2011
Have you got that trigger in the map by any chance and is it named right?
RE: Unexpected end of file!! ;( - cooleoj - 10-06-2011
Yes i have and its named "monstertrigger1"
RE: Unexpected end of file!! ;( - Gamemakingdude - 10-06-2011
Try changing true to false.
|