Frictional Games Forum (read-only)
Amnesia custom story .hps file problem HELP ASAP - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Amnesia custom story .hps file problem HELP ASAP (/thread-12187.html)



Amnesia custom story .hps file problem HELP ASAP - Dynomite33 - 12-30-2011

when I go to play my custom story it says
"
FATAL ERROR: could not load script file
'custom_stories/Mine/maps/00_tutorial.hps'!
main (11,2) : ERR : Unexpected end of file
this is my .hps

void OnStart()
{
AddUseItemCallback("", "BedroomKey_1", "bedroom_1, "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in as Entity);

{
SetSwingDoorLocked("bedroom_1", false, true);
PlaySoundAtEntity("", "unlock_door", "bedroom_1", 0, false);
RemoveItem("BedroomKey_1");
}

I've been playing around with this for about 5 HOURS



RE: Amnesia custom story .hps file problem HELP ASAP - Tanshaydar - 12-30-2011

This is a Custom Story support question so doesn't belong to Technical Help section.
Your problem is that you forgot to close the " in your AddUseItemCallback function, exactly here:
AddUseItemCallback("", "BedroomKey_1", "bedroom_1, "UsedKeyOnDoor", true);
It should be like this:
AddUseItemCallback("", "BedroomKey_1", "bedroom_1", "UsedKeyOnDoor", true);



RE: Amnesia custom story .hps file problem HELP ASAP - Dynomite33 - 12-30-2011

but now i have a problem that says
main (8,1) unexpected token '{'



RE: Amnesia custom story .hps file problem HELP ASAP - Apjjm - 12-30-2011

You have a semi-colon at the end of "void UsedKeyOnDoor(string &in asItem, string &in as Entity)". Also you have "as Entity" instead of "asEntity". The following should work:
Code:
void OnStart()
{
AddUseItemCallback("", "BedroomKey_1", "bedroom_1", "UsedKeyOnDoor", true);
}

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

Edit: Code formatting fixed.


RE: Amnesia custom story .hps file problem HELP ASAP - Dynomite33 - 12-30-2011

(12-30-2011, 03:20 PM)Apjjm Wrote: You have a semi-colon at the end of "void UsedKeyOnDoor(string &in asItem, string &in as Entity)". Also you have "as Entity" instead of "asEntity". The following should work:
Code:
void OnStart()
{
AddUseItemCallback("", "BedroomKey_1", "bedroom_1", "UsedKeyOnDoor", true);
}

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

Edit: Code formatting fixed.
my door doesnt work now :/
EDIT:
the key works on the door, but the door isnt locked to start with
my .hps

void OnStart()
{
AddUseItemCallback("", "bedroomkey_1", "bedroom_1", "UsedKeyOnDoor", true);
}

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

void OnEnter()
{
}

void OnLeave()
{
}





RE: Amnesia custom story .hps file problem HELP ASAP - Apjjm - 12-30-2011

You will need to put "SetSwingDoorLocked" in the onStart event or mark the door as locked in the level editor.


RE: Amnesia custom story .hps file problem HELP ASAP - Xeronaile - 02-01-2012

I'll show you my portion of my script file (Took some help for me as well) but it works for me.

Hps:


void OnStart()
{
AddUseItemCallback("", "cellar_key", "cellar_wood01_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cellar_wood01_1", false, true);
PlaySoundAtEntity("", "unlock_door", "cellar_wood01_1", 0, false);
RemoveItem("cellar_key");
}