Frictional Games Forum (read-only)

Full Version: My custom level keeps crashing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It keeps saying unexpected end of file, I am trying to make the brute patrol in front of the character patrol out of sight till he collides with a script thingy and then disappear. But it will not work, I need some help.

////////////////////////////
// Run when entering map
void OnEnter()
{

AddEnemyPatrolNode(servant_brute_1","PathNodeArea_1",0,"");
{


AddEnemyPatrolNode("servant_brute_1","PathNodeArea_2",4,"");
{


}
}
}

void EnemyDisabled(string &in asEntity, string &in asType)
{

if(GetEntitiesCollide("servant_brute_1", "ScriptArea_1"))
{

SetPropActiveAndFade("servant_brute_1", true, 0.5f);

}
}





////////////////////////////
// Run when leaving map
void OnLeave()
{

}
You have too many unnecessary {'s and }'s. These are to open and close function blocks. Not for fancy look.

Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
    AddEnemyPatrolNode(servant_brute_1","PathNodeArea_1",0,"");
    AddEnemyPatrolNode("servant_brute_1","PathNodeArea_2",4,"");
}

void EnemyDisabled(string &in asEntity, string &in asType)
{

    if(GetEntitiesCollide("servant_brute_1", "ScriptArea_1"))
    {
        SetPropActiveAndFade("servant_brute_1", true, 0.5f);
    }
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I tried that and it did not work, it said unexpected end of file. Here is the revised code. Also does it look right, as in everything like the monster disappearing should work? Also they were not their for fancy look, they were there because i saw a forum about monster patrolling and that is what the code looked like.


////////////////////////////
// Run when entering map
void OnEnter()
{
SetEntityActive("servant_grunt_1", true);
AddUseItemCallback("", "key_tomb_rusty_1", "sewer_arched_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_tomb_1", "hatch_ceiling_1", "UsedKeyOnDoor1", true);





}



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



}

void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("hatch_ceiling_1", false, true);
ChangeMap("level2.map", "PlayerStartArea_1", "", "");

}









////////////////////////////
// Run when leaving map
void OnLeave()
{

}
If you are going to activate the grunt upon entering map, why not letting it already activated? I mean this is for the code just you wrote.

Other code would not work, because you didn't call the function EnemyDisabled anywhere in your script. It's not an interaction function either. You should understand that one piece of code serves to the coder's intention. It's not to work under every circumstances. You need to look at wiki.
oh, well any suggestions? I have looked on the wiki and all over the internet and there are relatively resources for learning how to script for amnesia.