Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My custom level keeps crashing
Starkiller2000 Offline
Junior Member

Posts: 5
Threads: 3
Joined: Mar 2011
Reputation: 0
#1
Solved: 8 Years, 8 Months, 4 Weeks ago My custom level keeps crashing

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()
{

}
03-30-2011, 02:38 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
Solved: 8 Years, 8 Months, 4 Weeks ago RE: My custom level keeps crashing

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

////////////////////////////
// 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()
{
}

03-30-2011, 02:56 AM
Website Find
Starkiller2000 Offline
Junior Member

Posts: 5
Threads: 3
Joined: Mar 2011
Reputation: 0
#3
Solved: 8 Years, 8 Months, 4 Weeks ago RE: My custom level keeps crashing

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()
{

}
(This post was last modified: 03-30-2011, 11:53 PM by Starkiller2000.)
03-30-2011, 11:52 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
Solved: 8 Years, 8 Months, 4 Weeks ago RE: My custom level keeps crashing

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.

03-31-2011, 06:42 AM
Website Find
Starkiller2000 Offline
Junior Member

Posts: 5
Threads: 3
Joined: Mar 2011
Reputation: 0
#5
Solved: 8 Years, 8 Months, 4 Weeks ago RE: My custom level keeps crashing

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.
03-31-2011, 09:55 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#6
Solved: 8 Years, 8 Months, 4 Weeks ago RE: My custom level keeps crashing

http://wiki.frictionalgames.com/hpl2/tut...tutorial_1
This might be a good start.

04-01-2011, 11:24 AM
Website Find




Users browsing this thread: 2 Guest(s)