Frictional Games Forum (read-only)

Full Version: Cant see the error :S
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
wtf? i dont see anything so i guess i will learn a new thing today Big Grin

Errors:

main (11,1);ERR;Expected "," or ';'
main (27,1) Same as above

Here's the rows:

11: void monsterActive(string &in asParent, string &in asChild, int alState)

27: void Happening(string &in asName, int alCount)

PS: im using notepad++
Could you give us more of the script?
Yeah. If you are ever having troubles with script, you should post the entire thing. Smile
i dont know how but its only 11,1 now and it is Another one since i moves 27,1. Here's the script Smile

void OnStart()

{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
GiveItemFromFile("lantern", "lantern.ent");
AddEntityCollideCallback("Player", "enemy_spawner_1", "monsterActive", true, 1);
AddEntityCollideCallback("Player", "PlayerStartArea_1", "Restart", true, 1);
}

void Restart(string &in asParent, string &in asChild, int alState)
void UsedKeyOnDoor(string &in asItem, string &in asEntity) <---- thats 11,1
void monsterActive(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("enemy_spawner_2", true);
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_2", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_1", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_4", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_5", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_6", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_1", "PathNodeArea_7", 1.0f, "");
CheckPoint ("FirstCheckpoint", "PlayerStartArea_1", "Happening", "DeathCategory", “Deathtext”);
}

void Happening(string &in asName, int alCount)

{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("","unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}

void OnEnter()

{
FadeOut(0.0f);
FadeIn(5.0f);
}


void OnLeave()
{

}
You have several functions behind each other without the {} for the function. I'm talking about line 10, 11 and 12.
What? O.o
This:
Code:
void Restart(string &in asParent, string &in asChild, int alState)
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
void monsterActive(string &in asParent, string &in asChild, int alState)

Needs to be:

Code:
void Restart(string &in asParent, string &in asChild, int alState)
{
//functions
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
//functions
}
void monsterActive(string &in asParent, string &in asChild, int alState)
{
//functions
}
The correct way to have your script is like
PHP Code:
void OnStart()

 {
 
AddUseItemCallback("""awesomekey_1""mansion_1""UsedKeyOnDoor"true);
 
GiveItemFromFile("lantern""lantern.ent");
 
AddEntityCollideCallback("Player""enemy_spawner_1""monsterActive"true1);
 
AddEntityCollideCallback("Player""PlayerStartArea_1""Restart"true1); 
 } 
Which you have done, but you haven't done this with your things below.
Think of it like this:
PHP Code:
void myfunction(asStringasEntityetc)
{
//place what I want to happen in here


Using an example from your code:
Assuming you want the door to unlock when you use the key on it in your code, you would have this.

PHP Code:
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
 
SetSwingDoorLocked("mansion_1"falsetrue);
 
PlaySoundAtEntity("","unlock_door""mansion_1"0false);
 
RemoveItem("awesomekey_1");
 } 
okey, i deleted the checkpoint thing cause that was just a Little test and then i changed so it looks like you guys said. But i seriously dont get this.. i dont get any description on my key or the the custom story main window.. why? :S
void OnStart()


{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
GiveItemFromFile("lantern", "lantern.ent");
AddEntityCollideCallback("Player", "enemy_spawner_1", "monsterActive", true, 1);
}

void monsterActive(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_spawner_2", true);
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_2", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_3", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_4", 1.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_5", 10.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_6", 5.0f, "");
AddEnemyPatrolNode("enemy_spawner_2", "PathNodeArea_7", 3.0f, "");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("","unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}

void OnEnter()

{
FadeOut(0.0f);
FadeIn(5.0f);
}


void OnLeave()
{

}
Your code is still incorrect.
Could you post what you would like to happen? For example:
I unlock a door. Once the door is unlocked, I get Sanity, but another door behind me slams shut.
Pages: 1 2