Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   playlooped won't stop (https://forums.graalonline.com/forums/showthread.php?t=134270140)

scriptless 12-16-2015 02:36 PM

playlooped won't stop
 
So I was using playlooped() and I noticed that if I did stopmusic() it didn't always stop the music. Actually sometimes I could hear multiple songs playing at once. Does anyone have any ideas how to get songs to stop?

Elk 12-16-2015 04:58 PM

can you not index them by doing playlooped(1) and stopmusic(1) :0?

ffcmike 12-16-2015 07:30 PM

What format are the music files?
Wav are treated as sound effects and are therefore unaffected by stopmusic(), for those you would have to use stopsound("filename");.

scriptless 12-16-2015 08:26 PM

Quote:

Originally Posted by Elk (Post 1737848)
can you not index them by doing playlooped(1) and stopmusic(1) :0?

Not sure exactly what you mean by indexed?

Quote:

Originally Posted by ffcmike (Post 1737849)
What format are the music files?
Wav are treated as sound effects and are therefore unaffected by stopmusic(), for those you would have to use stopsound("filename");.

There mp3 format, tho I didn't know that for wav. Will keep that in the mind for the future. Another thing I noticed was sometimes it plays the music very faintly then if it plays again it plays a louder version over the old one. Also I am only able to test only my mac at the moment and I know I get the same kinda bug on GK as well sometimes. Logging on other servers does not help and neither does reconnecting.

ffcmike 12-16-2015 08:30 PM

Quote:

Originally Posted by scriptless (Post 1737851)
Another thing I noticed was sometimes it plays the music very faintly then if it plays again it plays a louder version over the old one.

It sounds as if playlooped() is being invoked from a level NPC rather than a weapon?

scriptless 12-16-2015 09:56 PM

Quote:

Originally Posted by ffcmike (Post 1737852)
It sounds as if playlooped() is being invoked from a level NPC rather than a weapon?

I am invoking it from a weapon npc actually, not a level npc. As well as invoking stopmusic() from a weapon npc too. The script I'm using is

PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  
temp.song getmusicfilename(); // current song playing
  
if ( player.level == "desert2.nw" temp.song "stef49.mp3";
  if ( 
player.level == "level2.nw" temp.song "npulse_svrvilla.mp3";
  
  
// only play song if not already playing
  
if ( getmusicfilename() != temp.song) {
    
stopmusic();
    
playlooped(temp.song);
  }



ffcmike 12-17-2015 03:58 AM

It looks as if getmusicfilename() may be acting faulty. You could try out-putting it's value for debugging to see if it's somehow being reset, and if necessary store the current playing song in a variable instead.

I actually use stopmidi() even though it's supposedly the same function as stopmusic() and kept just for compatibility purposes, does this work better?

Also while this is not the problem here player.level is an object, to compare it with a string it's better to use "player.level.name".

scriptless 12-17-2015 05:04 AM

Quote:

Originally Posted by ffcmike (Post 1737854)
It looks as if getmusicfilename() may be acting faulty. You could try out-putting it's value for debugging to see if it's somehow being reset, and if necessary store the current playing song in a variable instead.

I actually use stopmidi() even though it's supposedly the same function as stopmusic() and kept just for compatibility purposes, does this work better?

Also while this is not the problem here player.level is an object, to compare it with a string it's better to use "player.level.name".

Actually stopmidi() doesn't work any better for me. Regardless of what getmusicfilename() returns I would still think that adding a stopmusic() to a onCreated() of another weapon would have stopped it, but it didn't.

As for the player.level being an object. I knew I should have been using player.level.name.. but I guess I never thought of player.level as an actual object itself, thats neat. I'll change that right away but still looking for ideas on the music. Would love to test out on PC to see if it's maybe a mac bug or for everyone.

Also, I am very disappointed that midi no longer work with graal.. they were so awesome :(


All times are GMT +2. The time now is 08:37 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.