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
Amnesia crashes due to unexpected end in my .HPS file
EddieShoe Offline
Junior Member

Posts: 28
Threads: 6
Joined: Sep 2010
Reputation: 0
#1
Amnesia crashes due to unexpected end in my .HPS file

So I've been using this script for a while, but after I added the latest section it says: main (58, 2) : ERR Unexpected end of file. Any suggestions? It's been working so far :/ It crashes on game startup and it started after I added the "CastleSecret" func and the void for it, the bottom part of the script.

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "FlyingBodyArea", "FlyingBody", true, 1);
AddEntityCollideCallback("Player", "PotExplodeArea", "Explode", true, 1);
SetEntityConnectionStateChangeCallback("CastleLever", "CastleDoorOpen");
SetEntityConnectionStateChangeCallback("SecretLever", "CastleSecret");
}

void FlyingBody(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("pant1", "24_iron_maiden.snt", "Player", 2, true);
    SetPropHealth("CorpseWindow", 0);
    SetEntityActive("FlyingCorpse", true);
    AddPropImpulse("FlyingCorpse", -30, 0, 0, "world");
}

void Explode(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("pant2", "scare_wind.snt", "Player", 2, true);
    SetPropHealth("ExplodePot", 0);
}

void CastleDoorOpen(string &in asEntity, int alState)
{
    if (alState == 1)
{
    SetSwingDoorLocked("mansion_3", false, true);
    SetSwingDoorLocked("CastleDoor", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "Player", 0, false);
return;
}

void CastleSecret(string &in asEntity, int alState)
{
    if (alState == 1)
{
    SetMoveObjectState("CastleSecretShelf",1.0f);
    PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);  
return;

}


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

}

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

}

Currently working on: "Awake"
Progress: ~5%
(This post was last modified: 06-28-2012, 11:53 PM by EddieShoe.)
06-28-2012, 11:12 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#2
RE: Amnesia crashes due to unexpected end in my .HPS file

Your right, your missing a ending squiggly bracket for your "CastleSecret" & "CastleDoorOpen".
06-28-2012, 11:19 PM
Find
EddieShoe Offline
Junior Member

Posts: 28
Threads: 6
Joined: Sep 2010
Reputation: 0
#3
RE: Amnesia crashes due to unexpected end in my .HPS file

(06-28-2012, 11:19 PM)Rapture Wrote: Your right, your missing a ending squiggly bracket for your "CastleSecret" & "CastleDoorOpen".
Uhm, sorry if this is a stupid question. But where exactly do you mean? Been looking for a while and I can't find what you mean, and "squiggly bracket", is that the { } ?

Currently working on: "Awake"
Progress: ~5%
06-28-2012, 11:25 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Amnesia crashes due to unexpected end in my .HPS file

Here you go:


////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "FlyingBodyArea", "FlyingBody", true, 1);
AddEntityCollideCallback("Player", "PotExplodeArea", "Explode", true, 1);
SetEntityConnectionStateChangeCallback("CastleLever", "CastleDoorOpen");
SetEntityConnectionStateChangeCallback("SecretLever", "CastleSecret");
}

void FlyingBody(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("pant1", "24_iron_maiden.snt", "Player", 2, true);
SetPropHealth("CorpseWindow", 0);
SetEntityActive("FlyingCorpse", true);
AddPropImpulse("FlyingCorpse", -30, 0, 0, "world");
}

void Explode(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("pant2", "scare_wind.snt", "Player", 2, true);
SetPropHealth("ExplodePot", 0);
}

void CastleDoorOpen(string &in asEntity, int alState)
{
if (alState == 1)
{
SetSwingDoorLocked("mansion_3", false, true);
SetSwingDoorLocked("CastleDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Player", 0, false);
}
}

void CastleSecret(string &in asEntity, int alState)
{
if(alState == 1)
{
SetMoveObjectState("CastleSecretShelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
}
}


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

}

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

}

I rate it 3 memes.
06-28-2012, 11:30 PM
Find
EddieShoe Offline
Junior Member

Posts: 28
Threads: 6
Joined: Sep 2010
Reputation: 0
#5
RE: Amnesia crashes due to unexpected end in my .HPS file

It worked, thanks a lot! May I ask why this additional } is required on that func? I've never used 2 before, It's my first day using the scripts so I'm not that good at it :-)

Currently working on: "Awake"
Progress: ~5%
06-28-2012, 11:35 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: Amnesia crashes due to unexpected end in my .HPS file

(06-28-2012, 11:35 PM)EddieShoe Wrote: It worked, thanks a lot! May I ask why this additional } is required on that func? I've never used 2 before, It's my first day using the scripts so I'm not that good at it :-)
I must start by saying WOW if thats your first try at scripting and you've already implemented if/else statements. Anyways:

For if/else statements, think of it as a function within a function (funception!).

void Function()
{

}

^^ That is the most basic function, adding the if/else statement takes it one step further, and 2 additional brackets need to be added in the same manner, like so:

void Function()
{
if(alState = 1)
{
//second part
}
}


Basically, there needs to be equal amounts of open "{" and closed "}" brackets for the script to work properly.

I rate it 3 memes.
06-28-2012, 11:39 PM
Find
EddieShoe Offline
Junior Member

Posts: 28
Threads: 6
Joined: Sep 2010
Reputation: 0
#7
RE: Amnesia crashes due to unexpected end in my .HPS file

(06-28-2012, 11:39 PM)andyrockin123 Wrote:
(06-28-2012, 11:35 PM)EddieShoe Wrote: It worked, thanks a lot! May I ask why this additional } is required on that func? I've never used 2 before, It's my first day using the scripts so I'm not that good at it :-)
I must start by saying WOW if thats your first try at scripting and you've already implemented if/else statements. Anyways:

For if/else statements, think of it as a function within a function (funception!).

void Function()
{

}

^^ That is the most basic function, adding the if/else statement takes it one step further, and 2 additional brackets need to be added in the same manner, like so:

void Function()
{
if(alState = 1)
{
//second part
}
}


Basically, there needs to be equal amounts of open "{" and closed "}" brackets for the script to work properly.
Thanks, that was very helpful! I realized that when you said it, there was something familiar in RPG Maker VX which I used before, the "condition branch". May I be rude and ask for another thing? I've tried googling it myself but with no results.

When the bookshelf rotates, it rotates, obviously. But it's empty so the secret is so obvious! If I put books in it they stand still while it rotates, as expected. So I tried using the "ConnectedProps" thingie but nothing happened there either. Any suggestions? I'm searching myself at the moment, but any help is much appreciated!

(Dunno if I can ask Off-Topic questions here, if so tell me. This is a new problem.)

Currently working on: "Awake"
Progress: ~5%
(This post was last modified: 06-29-2012, 12:05 AM by EddieShoe.)
06-28-2012, 11:52 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#8
RE: Amnesia crashes due to unexpected end in my .HPS file

Well if you know how to use the Model Editor, you can convert the static_objects (I'm guessing your using the Stacked Books. Their not static_objects, but they have no body mass shall we say.) into entities that can be moved around.

http://wiki.frictionalgames.com/hpl2/tut...r_tutorial

I haven't finished this tutorial, but I got around the part to where you can convert a static_object to a entity (Still isn't even completed) but it has the neccesary steps for wha your doing. Just scroll down to the part with the Elevator and me opening it up in the Model Editor...

Or if you don't want to concern yourself with all that rubbish...

You can just put the individual books + other moveable objects on the Shelf instead.
(This post was last modified: 06-29-2012, 02:36 AM by Rapture.)
06-29-2012, 02:21 AM
Find




Users browsing this thread: 1 Guest(s)