The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Need some help with scripting... new to AMNESIA'S scripting...
xResorx Offline
Junior Member

Posts: 10
Threads: 2
Joined: Jul 2012
Reputation: 0
#1
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!
07-29-2012, 05:32 AM
Find


Messages In This Thread
Need some help with scripting... new to AMNESIA'S scripting... - by xResorx - 07-29-2012, 05:32 AM



Users browsing this thread: 1 Guest(s)