Frictional Games Forum (read-only)
[SOLVED] I suck at scripting, help! - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: [SOLVED] I suck at scripting, help! (/thread-6319.html)

Pages: 1 2


RE: I suck at scripting, help! - Som1Lse - 01-22-2011

(01-22-2011, 02:49 PM)TarkoRehin Wrote: My script file looks like this:

Replace it with this:
Code:
void TakeTinder(string &in asEntity)
{
    SetEntityActive("servant_grunt_1", true);
}

void OnStart()
{
SetEntityPlayerInteractCallback("tinderbox_1", "TakeTinder", true);
}

void OnEnter()
{

}

void OnLeave()
{

}
What it means is, that when the level starts, it adds a callback (basically when something happens, the callback activates a function).
Thus when you interact with "tinderbox_1", the function "TakeTinder" is run with the parameters ("tinderbox_1").

The parameter "string &in asType" is only used when you specify the callback in the editor, but I recommend always add callbacks in the scripts to keep the stuff more organised. (thus you only have to look once to find what you are looking for, and it is searchable)

Oh, and I totally forgot to say:
"You don't suck, you only haven't learned it yet."
~Someone else

Think of it that way.


RE: I suck at scripting, help! - TarkoRehin - 01-22-2011

Thanks alot, finally got the script working.

Also had to delete the script file once, no idea why as the one I recreated was entirely the same.

Regardless thanks again, and time to get working Big Grin