Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: punk_Blood on October 07, 2010, 10:27:29 pm

Title: Script to Mute sound
Post by: punk_Blood on October 07, 2010, 10:27:29 pm
anyone know how to do this?
i have a selection in my options menu i made, and you can set the sound ON/OFF, and i was wondering what do i have to put to mute the sound?
Title: Re: Script to Mute sound
Post by: stripe103 on October 08, 2010, 09:49:56 am
I haven't tried it, but looking at Ryex's Collapsing CMS and it's Options menu, the codes for changing music and sound volume is
$game_system.bgm_volume = VALUE IN PERCENT
$game_system.sfx_volume = VALUE IN PERCENT
Title: Re: Script to Mute sound
Post by: punk_Blood on October 08, 2010, 03:32:23 pm
it says it cant be coerced into fixum

whatever that means...
Title: Re: Script to Mute sound
Post by: Valdred on October 08, 2010, 04:01:47 pm

$game_system.bgm_volume = 0
$game_system.sfx_volume = 0


No %s
Title: Re: Script to Mute sound
Post by: nathmatt on October 08, 2010, 07:25:44 pm
just to clarify don't add the percent sign
Title: Re: Script to Mute sound
Post by: stripe103 on October 09, 2010, 05:50:21 am
What I meant with "in percent" was that the lowest value is 0 and the highest is 100.
Title: Re: Script to Mute sound
Post by: Blizzard on October 09, 2010, 06:44:22 am
No offense to anybody, but I simply have to post this:

LOL!

A levelup for everybody here, you just made my day.
Title: Re: Script to Mute sound
Post by: punk_Blood on October 11, 2010, 06:43:17 pm
it doesnt work for me :/
this comes up AND YES, i did try it in a new game to see if there would be any script collisions
(http://img830.imageshack.us/img830/1224/24994660.png)
Title: Re: Script to Mute sound
Post by: Ryex on October 11, 2010, 09:46:43 pm
you have to make the instance variables public first
Title: Re: Script to Mute sound
Post by: punk_Blood on October 12, 2010, 01:21:31 am
wut? i am a n00b scripter... i dont understand what you mean
Title: Re: Script to Mute sound
Post by: stripe103 on October 12, 2010, 03:51:11 am
Add this below all attr_accessors in Game_System.
attr_accessor :bgm_volume
attr_accessor :sfx_volume
Title: Re: Script to Mute sound
Post by: nathmatt on October 12, 2010, 08:00:06 am
no wounder id doesn't work decided to look at Game_System add this script above main

Spoiler: ShowHide
class Game_System
 
  def bgm_volume(vol)
    bgm = @playing_bgm
    Audio.bgm_play("Audio/BGM/" + bgm.name, vol, bgm.pitch)
    Graphics.frame_reset
  end
 
  def bgs_volume(vol)
    bgm = @playing_bgm
    Audio.bgs_play("Audio/BGM/" + bgs.name, vol, bgs.pitch)
    Graphics.frame_reset
  end
 
  def me_volume(vol)
    bgm = @playing_bgm
    Audio.bgm_play("Audio/BGM/" + me.name, vol, me.pitch)
    Graphics.frame_reset
  end
 
end


to use put this to change the bgm volume
$game_system.bgm_volume(vol)

this to change the bgs volume
$game_system.bgs_volume(vol)

and this to change the me volume
$game_system.me_volume(vol)

vol is the volume you want
Title: Re: Script to Mute sound
Post by: ForeverZer0 on October 12, 2010, 12:23:48 pm
I always just use the Mute button on my computer, but hey, that's me.
Title: Re: Script to Mute sound
Post by: punk_Blood on October 12, 2010, 08:09:16 pm
freakin awesome man thanks :D

oh and @ForeverZer0,
my games in fullscreen and i want the person to be able to mute the music if he or she wishes without having to go the extra mile and push the power on their speakers