Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-15-2006, 07:37 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Uhm...

Is their a way to make it so if your close to an npc that is streaming a song you will hear it louder, and if you walk away it will go lower. :O
Reply With Quote
  #2  
Old 01-15-2006, 08:56 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
setmusicvolume(left,right); changes the volume. I haven't used it, though, so I don't know how left and right work. I'm assuming left brings it down, right puts it up?
Reply With Quote
  #3  
Old 01-15-2006, 10:42 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
No... left/right as in left/right speakers.

Values are most likely 0-100.
Reply With Quote
  #4  
Old 01-15-2006, 10:50 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Then use the distance formula! =D
__________________
Reply With Quote
  #5  
Old 01-16-2006, 03:47 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
HTML Code:
play2 filename,x,y,volume;	        plays a sound/music at x,y with the specified volume 
                                            (1=default volume)
I believe this function changes the volume depending on how far away from x,y the player is.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 01-16-2006, 04:39 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
I think if you ran that function more than once, it would just play the file over again. Not sure.
__________________
Reply With Quote
  #7  
Old 01-16-2006, 07:52 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Right, so which answers correct? :O
Reply With Quote
  #8  
Old 01-16-2006, 09:49 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ZeLpH_MyStiK
Then use the distance formula! =D
Well... partially the distance value. If you want it to be realistic... gotta use 1/d^2.
Reply With Quote
  #9  
Old 01-16-2006, 10:04 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
NPC Code:
  $pref::graal::midivolume
$pref::graal::mp3volume
$pref::graal::sfxvolume
$pref::graal::radiovolume



You could try modifying these, but they effect all sounds, not just that one sound. I was playing the option variables, but I found that some of them didn't apply until I restarted Graal.
If you don't want to modify the volume of all sounds, I suggest using the setvolume function.
Reply With Quote
  #10  
Old 01-16-2006, 10:09 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally Posted by ApothiX
HTML Code:
play2 filename,x,y,volume;	        plays a sound/music at x,y with the specified volume 
                                            (1=default volume)
I believe this function changes the volume depending on how far away from x,y the player is.
That plays it as if it were coming from x,y. If you are further away it will be softer, if you are at x,y it will be quite loud.

I used it for fireworks once. I wish I could find those. They were on DD a long time ago.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #11  
Old 01-17-2006, 04:31 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by jake13jake
Well... partially the distance value. If you want it to be realistic... gotta use 1/d^2.
Since you put it that way, why not include the npcs, and certain tiles that block the sound into the equation as well
__________________
Reply With Quote
  #12  
Old 01-17-2006, 05:08 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ZeLpH_MyStiK
Since you put it that way, why not include the npcs, and certain tiles that block the sound into the equation as well
because there's no way of knowing the density or height of a tile :P.
Reply With Quote
  #13  
Old 01-17-2006, 06:22 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by jake13jake
because there's no way of knowing the density or height of a tile :P.
Estimate?
density = mass / volume
__________________
Reply With Quote
  #14  
Old 01-17-2006, 06:48 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ZeLpH_MyStiK
Estimate?
density = mass / volume
uhh, what I'm saying is that it makes more sense to go by the distance of the focus rather than where the player is.
Reply With Quote
  #15  
Old 01-17-2006, 06:56 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
O.o, wait wait.

So now you guys are making it not go through walls, but find a lil crack somewhere to get to me? lol.
Reply With Quote
  #16  
Old 01-17-2006, 03:41 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by adam
That plays it as if it were coming from x,y. If you are further away it will be softer, if you are at x,y it will be quite loud.

I used it for fireworks once. I wish I could find those. They were on DD a long time ago.
That's what this thread is about, and what's why I suggested it
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #17  
Old 01-19-2006, 07:10 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally Posted by ApothiX
That's what this thread is about, and what's why I suggested it
I must have been tired when i said that. :/

Anywho, I dont' think it will work for songs.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #18  
Old 01-20-2006, 04:18 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by KuJi
Is their a way to make it so if your close to an npc that is streaming a song you will hear it louder, and if you walk away it will go lower. :O
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

For music: eventually save the position where the music should be loudest (position of the radio npc or so) and then change the music volume with setmusicvolume all few moments (0.05 seconds) depending on the distance of the player to the distance of the music source / radio npc.
This kind of system is also good for environmental sound effects, we are using that for the ocean sound on Era and the shephard melody on Kingdoms (xmas quest), changing the volume depending on the distance to the source (with play2).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:43 PM.


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