Need some help with scripting... new to AMNESIA'S scripting...
Hello there, I need some help with a few scripts.
NOTE: Amnesia was capitalized because I do play some other games that allow you to script. However those games use Lua. Quite honestly I can only do basic stuff within the constraints of that game, it has a limited version of the Lua language, but I would be extremely glad if you guys could help me out some.
Okay so heres the situation, Ive just got through testing my custom story (FINALLY, stupid hidden file extensions....) and I have several scripted encounters already. I also have scripts for said encounters. Honestly I have no idea how theyre supposed to be placed in the .hps file. So I went looking in the .hps files of some of the main story maps(Usually how I learn script languages, editing). Perhaps Im not following the pattern right, or maybe my scripts are incorrect in their syntax. So if one of you more experienced coders could take a look and do two things for me Id be eternally grateful. Those two things are:
1.Help me with the correct syntax
2.Tell me how they should go in the .hps folder
SORRY FOR NO SPOILERSSS! Im on a phone and its hard.
So here they are:
Script One- Blows out the lights when the player touches the correct area.
void OnStart()
{
AddEntityCollideCallback("Player", "LightsOut", true);
}
void LightsOut(string &in asParent, string &in asChild, int alState)
{
[SetLampLit("outlamp_1", false, true);
AddTimer("", 2, "Out2");
} ]--This bracketed line is repeated enough times to satisfy my lamp outtage needs. The following repetitions increase only the number behind "outlamp_" and "Out"
after that comes
voidOnEnter()
{
}
voidOnLeave()
{
}
Second script spawns a monster when the player grabs a specific Tenderbox
voidOnStart()
{
SetEntityPlayerInteractCallback("monster_tinderbox", "function", true);
}
void function (string &in entity)
{
SetEntityActive("tinbox_prolwer", true);
Third and final script Id like you guys to look at, slams a door in the players face when they touch an area
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", true
}
void func_slam(string &in asParent, string %in asChild, int alState)
{
SetSwingDoorClosed("slamdoor1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false
PlaySoundEntity("", "react_scare", "Player", 0, false); PlaySound
GiveSanityDamage(5, 0f, true);
}
I do have some basic insight into what each part of the scripts do. Very basic but I can read down and give a pretty accurate guess as to what part of the script executes what action. Please help though. I still have HIGHLY limited knowledge on this.
Thanks in advance guys!
|