02-28-2012, 03:18 PM
Hey.
i've have startet making a custom story in Amnesia.
but something i dont understand is following:
1: The scripting i make, should i make it in 1 .hps file or multiple?
2: if only in 1 file, what is the problem here:
The problem with the code is that when i only have the code for slamming the door, it works. but when i have the code for key to a door in there at same time it wont work. Game crashes.
I have attached a .txt file with the code in.
Thanks for the help!
i've have startet making a custom story in Amnesia.
but something i dont understand is following:
1: The scripting i make, should i make it in 1 .hps file or multiple?
2: if only in 1 file, what is the problem here:
Code:
void OnStart()
{
AddUseItemCallback("", "key01", "Door01", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door", "Door01", 0, false);
RemoveItem("key01");
}
{
AddEntityCollideCallback("Player", "Script_slam01", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_slam01", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
The problem with the code is that when i only have the code for slamming the door, it works. but when i have the code for key to a door in there at same time it wont work. Game crashes.
I have attached a .txt file with the code in.
Thanks for the help!