(10-08-2014, 01:11 PM)FlawlessHappiness Wrote: Let's start from the top.
You have a void OnStart()
In that, you are specifying what functions you want to create, such as.
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
Right here you are saying a lot of things.
You want the Parent object to be the "Player".
You want the Child object (the object the parrent collides with) to be "Ljud".
You want your function to be named "start".
You want it to only happen once by setting "true".
And you make it happen, only when you enter the Child ("Ljud") by using 1.
That is all the information the script needs, and that's what you gave it.
Now you said that you want the function to be named "start", but where is it?
Correct, it's nowhere, because you haven't created it yet.
So how do we do that?
Like this:
void FunctionName(parameters)
The FunctionName is the name of the function. In our case, it's "start".
The parameters are special parameters that the script needs, to understand what kind of function it is.
The function we are using right now is a Collide function.
A collide function needs 3 parameters.
(string &in asParent, string &in asChild, int alState)
To understand what all these does, please read this:
http://www.frictionalgames.com/forum/thread-18368.html
Now that we know all the things we need, we can create the function.
void start(string &in asParent, string &in asChild, int alState)
All you need to do now is fill in something inside the function. Fx. play a sound.
void start(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "25_strain_wood.snt", "Player", 0.0f, false);
}
Oh my god..
To be completely honest, this doesn't make any sense to me. I mean, i see that lines like "PlaySoundAtEntity" corresponds to functions within the scripts and the game, but i get seriusly confused. This is math to me (and i have dyscalculia)
I will read trough and see if i can make any sense of it if i repeat. If i want to add another script area, it made sense (in my head) to add another function, but that only got me the error "A function with the same name and parameters already exists"
I might look like an idiot but so be it.