Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Playlooped not functioning properly! (https://forums.graalonline.com/forums/showthread.php?t=71852)

konidias 02-01-2007 01:21 AM

Playlooped not functioning properly!
 
Quote:

Originally Posted by Stefan (Post 1143383)
For looping wavs: call playlooped all few moments to update the position of the sound, the volume will automatically be adjusted depending on the position of the npc on the screen

I've tried this and discovered that playlooped only adjusts the volume in relation to the player one time. (when the player enters the level or the npc is created)

This was tested on both a single level and a gmap and both times it's only adjusting the volume once.

NPC Code:
//#CLIENTSIDE
function onCreated() {
setTimer(.05);
}
function onTimeout() {
playlooped("bomb.wav");
setTimer(.05);
}



This is technically supposed to make it so if the player walks away from the npc, it should get quieter... but it only sets the volume of the playlooped the first time. (same with playlooped2)

Chandler 02-01-2007 12:42 PM

HTML Code:

//#CLIENTSIDE
function onCreated()
{
  this.onTimeout();
}
function onTimeout()
{
  playlooped2("bomb.wav", this.x, this.y, 1); //The '1' is the player's distance
}

Should work, not tested.

konidias 02-01-2007 12:47 PM

Neither of them work properly. They only adjust volume for the position on the player's initial entry and then no longer do it. The "1" in playlooped2 is the volume I believe.

Chandler 02-01-2007 12:50 PM

Indeed
Quote:

Plays the specified sound file at location x, y with the specified volume. Volume should be between 0 and 1, if volume is set to 1 default volume is used (depending on how far away the player is).

Crow 02-01-2007 04:26 PM

Use a gani playing the .wav you want to play. Works. Only problem is -> has to contain a little part of an image, or the gani wont work and it wont play the sound.

konidias 02-01-2007 09:49 PM

Quote:

Originally Posted by Crow (Post 1272047)
Use a gani playing the .wav you want to play. Works. Only problem is -> has to contain a little part of an image, or the gani wont work and it wont play the sound.

Actually you can make a totally blank gani, put the sound in there and set it as PARAM1 and use showani to play the sound to everyone on a level... But that's neither here nor there.

I posted this in the bug report area so that this will get fixed, not so that I can find ways to work around things that should be doing what I need done. >_<

I'm sure there are several methods of playing a looped wav, but they all have their faults. (playing them in a gani only works until the player walks out of the level and then the gani disappears, along with the sound) (running a timeout with "play" can also loop a wav but it runs the risk of being choppy or skipping and also the needs the exact length of each wav that you plan to use) etc

I just want playlooped and playlooped2 to work like they should. From what I can make out, they are SUPPOSED to change their volume automatically when the player gets closer or farther from the x/y (if you're calling the command repeatedly in a for loop) Which means each time the command is called it should be updating the volume accordingly. But instead, it's ignoring it after the first time.

As far as I know... the only difference between playlooped and playlooped2 is that playlooped2 allows you to specify an x/y (instead of it being forced to be the npc's x/y) and also let's you set the volume... although I really don't understand that parameter at all... Seeing as how if you set the volume and this thing is supposed to adjust it's volume based on it's position... what difference would it make if you set the volume to .5 when the player is right next to it? Wouldn't it be .9 or 1 or something anyway? The only other thing I can assume is that the volume param in playlooped2 is actually to set the maximum volume that the sound can reach.

Either that, or it does indeed set the volume to whatever you desire and doesn't change due to it's position... which is bad and good. Good because that option is needed, and bad because it's taking away the other option of having the volume adjust based on position. x_x

I wish Stefan would read this thread and reply. :(

Chandler 02-01-2007 10:08 PM

Quote:

Originally Posted by konidias (Post 1272150)
I wish Stefan would read this thread and reply. :(

I cropped it down.

I noticed why. If you were to do it in a timeout, it'd repeat the same sound. If it's not in a timeout, it'd do it on how far the players distance is from when it was called.
HTML Code:

function onCreated()
{
  this.setImg("block.png");
  setTimer(20);
}
function onTimeout()
{
  this.destroy();
}
//#CLIENTSIDE
function onCreated()
{
  this.onTimeout();
}
function onTimeout()
{
  playlooped2("bomb.wav", this.x, this.y, 1);
  setTimer(0.05);
}

Removing the clientside timeout and only having the playlooped2 would work, but it isn't updated.

Admins 02-02-2007 07:44 PM

It will be fixed in the next Graal version.

konidias 02-03-2007 01:29 AM

Yay! When will that be? :p

Rapidwolve 02-03-2007 01:48 AM

Don't ask for any release dates z.z
theyll probobly be broken ='[

xXziroXx 10-22-2010 03:30 PM

Bump!

Admins 10-24-2010 12:38 PM

What? Works in v5, at least for the ocean sound on Kingdoms.

xXziroXx 10-24-2010 01:16 PM

Quote:

Originally Posted by Stefan (Post 1608271)
What? Works in v5, at least for the ocean sound on Kingdoms.

Quote:

Originally Posted by Crow (Post 1607851)
When using play2() or playlooped2() with coordinates, the "direction" of the sound playing doesn't update when the player moves, but stays the same all the time, from the point where the function is called. Not cool. Can't we make this dynamic?


The "problem" is that the sound doesn't update automatically when the player moves. This would ideally be the only thing needed:

PHP Code:

//#CLIENTSIDE
function onCreated()
  
playlooped2("mal_caveambience.wav"this.xthis.y1); 

Then it would continuously refresh the sound strength/direction whenever the player moves, but that's not the case. For it to work, you need to use it in a timeout and run the command over and over again:

PHP Code:

//#CLIENTSIDE
function onCreated()
  
setTimer(.05);
function 
onTimeOut()
{
  
playlooped2("mal_caveambience.wav"this.xthis.y1);
  
setTimer(.05);




All times are GMT +2. The time now is 05:57 PM.

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