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 Error with sound script
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#1
Error with sound script

Hi. I've got a error with script to play sounds.
ExecuteString (1, 1) : No matching signatures to OnLeave()
main (8,1) Unexpected token {


It's my .hps file:
void OnStart()

{
AddEntityCollideCallback("Player", "sound01", "ScarySound1", true, 1);
}

void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
{
PlaySoundAtEntity("explosion_rock_large", "explosion_rock_large.snt", "sound01", 1.0f, true);
}

What I've must do?
03-13-2015, 09:47 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#2
RE: Error with sound script

void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

You don't put the code in the name of the function. It normally would be
void ScarySound1()
{

}

But since this func is after AddEntityCollideCallback, it will look like

void ScarySound1(string &in asParent, string &in asChild, int alState)
{

}

Otherwise, I think it's correct. Watch some tutorials to get the hang of scripting.

(This post was last modified: 03-14-2015, 02:16 PM by Darkfire.)
03-13-2015, 10:30 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#3
RE: Error with sound script

Youve used the function completely wrong.

void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

This doesn't have the proper setup and it also shouldn't have the ; in the end. To setup a collide function, you need three parameters:

void ScarySound1(string &in asParent, string &in asChild, int alState)

asParent = the main object colliding with asChild (in your case its the Player)
asChild = the object asParent is meant to collide with ("sound01")
alState = checking whether player is colliding with asChild or leaving the area (0 = check if player is both leaving and entering the area, 1 = check if player is entering area, -1 check if player is leaving area)

Derp.
03-13-2015, 10:33 PM
Find




Users browsing this thread: 1 Guest(s)