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


[SOLVED] I suck at scripting, help! - TarkoRehin - 01-21-2011

First I want to apologize for making a thread like this (I'm guessing you guys get them alot..)

I've been reading around and trying to script for a few days now, and not a single script I've done works.. It's getting on my nerves really.

Here's one of my scripts.. (You'll probably laugh at my stupidity when you see this, but please bear with me.)

Code:
void TakeTinder("tinderbox_1", "OnPickup")
{
    SetEntityActive("servant_grunt_1", true);
}

What I want this to do is when I pickup the tinderbox a grunt should spawn (or activate).

I'm assuming when guides say things like "string &in asEntity" they want me to replace that text entirely with the entities name? correct me if I'm wrong, I've never found a clear explanation of it.

Some more information to make things clear:
I've named the tinderbox "tinderbox_1". (duh)
I've named the grunt "servant_grunt_1". (duh)
I've written "TakeTinder" without quotations in the tinderbox's CallbackFunc.
The grunt is currently not "active".
The grunt is a hallucination, but that's not the problem as it never actually appears anyways.

That's it for now, I will add information if required.


RE: I suck at scripting, help! - ThePaSch - 01-21-2011

Quote:I'm assuming when guides say things like "string &in asEntity" they want me to replace that text entirely with the entities name? correct me if I'm wrong, I've never found a clear explanation of it.

Alright.
You're wrong! Big Grin
Don't replace the parameters with their names, leave them as they are. At least in the declaration of the function, you'll of course have to replace them inside the function brackets.

Basically, whenever you call a function, replace the parameters.
Whenever you define a new function, leave them as they are.


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

Okay then I got
Code:
void TakeTinder(string &in asEntity, string &in asType)
{
    SetEntityActive("servant_grunt_1", true);
}

I tried this once before changing the parameters and it didn't work, tried it again now same result.
Just gonna take another guess that I'm using the wrong parameters?
If so what parameters should I use, and where can I read about when to use what parameters? Thank you ^^


RE: I suck at scripting, help! - Sharkhead - 01-21-2011

Hey, i'm new in this forum (I register today) and i really suck too with scripts...

I mean, when i just want something to happen in my custom story, i search here and copy-paste in my .hps file... and then, just a few scripts works, i don't understand these "codes" of scripts...

I really liked this topic, maybe i can learn something.


RE: I suck at scripting, help! - Tanshaydar - 01-21-2011

You sound like a spam to me. No offense.


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

Me or Sharkhead? Regardless, none offense taken Tongue


RE: I suck at scripting, help! - Tanshaydar - 01-21-2011

Sharkhead.
I have a blog that receives too many spams to drive me nuts, which starts with "I'm new here" and ends "I liked it here".


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

Going to bed, hoping to figure this out tomorrow xD


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

Do you have anything else in your script file except for those 3 lines? :p


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

My script file looks like this:

Code:
void TakeTinder(string &in asEntity, string &in asType)
{
    SetEntityActive("servant_grunt_1", true);
}

void OnStart()
{

}

void OnEnter()
{

}

void OnLeave()
{

}