Frictional Games Forum (read-only)

Full Version: Unexpected end of file!! ;(
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So i get a error when i start my map and i really suck at scripting so i could really need some help Smile



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.
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"true1);
    
AddEntityCollideCallback("Player""monstertrigger1""MonsterFunction""true"1); 
    
AddUseItemCallback("""hollowneedle1""lockeddoor1""FUNCTION"true);


void func_slam(string &in asParentstring &in asChildint alState)
{
    
SetSwingDoorClosed("scaredoor1"truetrue);
    
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false); 
    
PlaySoundAtEntity("""react_scare""Player"0false); PlaySoundAtEntity("""close_door.snt""Player"0false); 
    
GiveSanityDamage(5.0ftrue);

}
void FUNCTION(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("lockeddoor1"falsetrue);
PlaySoundAtEntity("""unlock_door""lockeddoor1"0false);
RemoveItem("hollowneedle1");
}


void MonsterFunction(string &in asParentstring &in asChildint 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..
Nope...
Now it crashes and says this instead:
main (25,1) : ERR : Unexpected token '{'
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.
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
PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""scarearea1""func_slam"true1);
    
AddEntityCollideCallback("Player""monstertrigger1""MonsterFunction""true"1); 
    
AddUseItemCallback("""hollowneedle1""lockeddoor1""FUNCTION"true);


void func_slam(string &in asParentstring &in asChildint alState)
{
    
SetSwingDoorClosed("scaredoor1"truetrue);
    
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false); 
    
PlaySoundAtEntity("""react_scare""Player"0false); PlaySoundAtEntity("""close_door.snt""Player"0false); 
    
GiveSanityDamage(5.0ftrue);

}
void FUNCTION(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("lockeddoor1"falsetrue);
PlaySoundAtEntity("""unlock_door""lockeddoor1"0false);
RemoveItem("hollowneedle1");
}


void MonsterFunction(string &in asParentstring &in asChildint 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.
main (4,5) : ERR : no matching signatures to 'AddEntityCollideCallback("Player", "monstertrigger1", "MonsterFunction", "true", 1); '
Gahhh seems i messed up some crazy shit
Have you got that trigger in the map by any chance and is it named right?
Yes i have and its named "monstertrigger1"
Try changing true to false.
Pages: 1 2