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
Script Help No sound playing in script area
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#20
RE: No sound playing in script area

(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.

PHP Code: (Select All)
AddEntityCollideCallback("Player""Ljud""start"true1); 

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:

PHP Code: (Select All)
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.

PHP Code: (Select All)
void start(string &in asParentstring &in asChildint alState

All you need to do now is fill in something inside the function. Fx. play a sound.

PHP Code: (Select All)
void start(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("""25_strain_wood.snt""Player"0.0ffalse);



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. Huh
10-08-2014, 04:55 PM
Find


Messages In This Thread
No sound playing in script area - by LDOriginal - 10-07-2014, 07:03 PM
RE: No sound playing in script area - by Neelke - 10-07-2014, 07:43 PM
RE: No sound playing in script area - by Neelke - 10-07-2014, 07:59 PM
RE: No sound playing in script area - by Neelke - 10-07-2014, 08:10 PM
RE: No sound playing in script area - by LDOriginal - 10-08-2014, 04:55 PM



Users browsing this thread: 3 Guest(s)