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 FATAL ERROR: Could not load script file
MarkoJ Offline
Junior Member

Posts: 9
Threads: 1
Joined: Oct 2015
Reputation: 0
#11
RE: FATAL ERROR: Could not load script file

PHP Code: (Select All)
void OnStart()
{  
    
AddEntityCollideCallback("Player""SoundArea_1""PlaySound"true1);
}

void PlaySound(string &in asParentstring &in asChildint alState
{
    
PlayMusic("18_amb.ogg"true181true);


Here's what I've got so far. Now I've managed to play the sound with this command because I couldn't get the fade in sound command to work.

Now I don't know how to make it fade out. You said to make the sound appear at another script area, how do I do that?

btw I have tried setting it like this
PHP Code: (Select All)
PlayMusic("18_amb.ogg"false181true); 
but for some reason it still doesn't stop.
(This post was last modified: 10-05-2015, 08:12 AM by MarkoJ.)
10-05-2015, 08:02 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#12
RE: FATAL ERROR: Could not load script file

Use StopMusic() to stop it. That's also where you choose how fast it should fade out. Just be sure to match the priority value from the music track you started using PlayMusic().

10-05-2015, 08:48 AM
Find
DaDaniel1949 Offline
Junior Member

Posts: 2
Threads: 0
Joined: Oct 2015
Reputation: 0
#13
RE: FATAL ERROR: Could not load script file

Can you do a basic step-by-step tutorial on how sounds work and how to put them in use and what script commands to use? Your tutorials have helped me greatly. But this is missing
10-08-2015, 06:42 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#14
RE: FATAL ERROR: Could not load script file

If you really want help from HIM, okey, but I can give it a try too.

If you want a sound to Appear if you do something, like Breaking a debris, handle, door breaking etc, use
PlayGuiSound(string& asSoundFile, float afVolume);
Let's say you want to use Wood_Explosion.snt (Idk if that does excist haha)
Then you need to do this:
PlayGuiSound("Wood_Explosion.SNT", 1);
The "1" is the volume.

If you want to use a sound ON an entity, like on a door, barrel, book idk.
use this :
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

Soundname is something you can call whatever you want, the soundfile is the soundfile you want to play, like Unlock_Door String& asEntity is on what entity you want the sound play on, and fade time is the fade time etc, and the last one is just to remember the playback state if you re-enter the map.

If you want to stop a sound:
StopSound(string& asSoundName, float afFadeTime);
BUT be advised, Instead of putting the Sound file in the "soundName"
You have to put your internal sound name, SO this part ;string& asSoundName of this :
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);


Sorry for my bad English, hopefully you will Atleast understand haha
10-08-2015, 06:57 PM
Find
DaDaniel1949 Offline
Junior Member

Posts: 2
Threads: 0
Joined: Oct 2015
Reputation: 0
#15
RE: FATAL ERROR: Could not load script file

Thank you for your reply, but I want to play the sound when I enter a certain area. Which commands do I use, how do I setup the function?
10-08-2015, 07:33 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#16
RE: FATAL ERROR: Could not load script file

If it is only when you enter the area it will look something like this:
PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""Area""Function"true1);
}

void Function(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("""NAMEOFSOUND""Player"0.0ffalse);


Trying is the first step to success.
(This post was last modified: 10-08-2015, 09:03 PM by FlawlessHappiness.)
10-08-2015, 09:02 PM
Find
MarkoJ Offline
Junior Member

Posts: 9
Threads: 1
Joined: Oct 2015
Reputation: 0
#17
RE: FATAL ERROR: Could not load script file

Do you have to create a new function for like every single sound ? O_O
10-08-2015, 09:20 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#18
RE: FATAL ERROR: Could not load script file

That depends. If it's the music you're talking about, then no. This should suffice:

PHP Code: (Select All)
for(int i 050i++) StopMusic(1.0fi); 

This will loop through 50 music tracks and end each one. All that is required to input is the priority. Of course this would have to be tuned to your scenario, but in theory it should work just fine.


Edit: I might've replied wrong. Was thinking of that PlayMusic thing.
What is it you mean MarkoJ?

(This post was last modified: 10-08-2015, 09:41 PM by Mudbill.)
10-08-2015, 09:38 PM
Find
MarkoJ Offline
Junior Member

Posts: 9
Threads: 1
Joined: Oct 2015
Reputation: 0
#19
RE: FATAL ERROR: Could not load script file

(10-08-2015, 09:38 PM)Mudbill Wrote: Edit: I might've replied wrong. Was thinking of that PlayMusic thing.
What is it you mean MarkoJ?

I was talking about the code that FlawlessHappiness wrote, like when you colide with area you activate a function so I was wondering do you create a seperate function for every area you collide with 'cos you have to put
PHP Code: (Select All)
AddEntityCollideCallback("Player""Area""Function"true1); 
for each sound you add I suppose?
10-08-2015, 09:46 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#20
RE: FATAL ERROR: Could not load script file

A similar thing can be done there. If you want multiple similar collision events, you can use

PHP Code: (Select All)
for(int i 050i++) AddEntityCollideCallback("Player""Area_" i"Function"true1); 

That will make them all run the same function callback as well. You can then reference asParent or asChild, if you want events to happen at those areas respectively.

10-08-2015, 09:53 PM
Find




Users browsing this thread: 1 Guest(s)