Jump to content
Rpg²S Forum
  • 0

Controlli audio script


tiauz
 Share

Question

Salve a tutti, sto cercando di modificare il seguente script, che mette il gioco in pausa:

 

 

###############################################################################
#Pause Script Version 1.0																																				  
###############################################################################
module Baelgard


 PAUSE_BUTTON = "ALT"
 PAUSE_TEXT = "Pausa"
 #allow/disallow freezing play time during pause
 STOP_TIME = true
 #Set a switch name to allow/disallow pause
 PAUSE_SW_NAME = "Pause"
 PAUSE_BUTTON2 = eval("Input::#{PAUSE_BUTTON}")
 
 def stopping

viewport1 = Viewport.new(0, 0, 640, 480)
viewport1.z = 10000

sprite1 = Sprite.new(viewport1)
sprite1.tone = Tone.new(0, 0, 0, 0)
sprite1.bitmap = Cache.system ("pause")
 
loop do
  Graphics.update
  Input.update
  if Input.trigger?(PAUSE_BUTTON2)
	break
  end
end

sprite1.dispose
sprite1 = nil
  end
 #--------------------------------------------------------------------------

 def can_stop?
if PAUSE_SW_NAME.is_a?(Numeric)
  return ($game_switches[PAUSE_SW_NAME] rescue true)
else
  return ($game_switches[$data_system.switches.index(PAUSE_SW_NAME)] rescue true)
end
  end
 end
#==============================================================================
#  Scene_Map
#==============================================================================

class Scene_Map

 include Baelgard

 alias baelgard_update update
 def update
if Input.trigger?(PAUSE_BUTTON2) and can_stop?
Sound.play_decision
  tmp = Graphics.frame_count
  stopping
  if STOP_TIME
	Graphics.frame_count = tmp
  end
end
baelgard_update
  end
end
#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle
 include Baelgard
 alias baelgard_update update
 def update
if Input.trigger?(PAUSE_BUTTON2) and can_stop?
  tmp = Graphics.frame_count
   stopping
  if STOP_TIME
	Graphics.frame_count = tmp
  end
end
baelgard_update
 end
end

 

 

In pratica vorrei che quando si mettesse in pausa, l'audio generale venisse stoppato, o almeno abbassato di volume; quindi ho provato inserendo queste stringhe (in grassetto):

 

class Scene_Map

 

include Baelgard

 

alias baelgard_update update

def update

if Input.trigger?(PAUSE_BUTTON2) and can_stop?

RPG::BGM.fade(180)

RPG::BGS.fade(180)

RPG::ME.fade(180)

tmp = Graphics.frame_count

stopping

if STOP_TIME

Graphics.frame_count = tmp

end

$game_map.autoplay

end

baelgard_update

end

end

 

In questo modo l'audio viene stoppato, ma quando si riprende il gioco, l'audio riparte dall'inizio, e con una musica in sottofondo è piuttosto brutto....

 

Se non è possibile stoppare l'audio e farlo riprendere da dove si è stoppato, è possibile almeno abbassarlo di volume durante la pausa del gioco?

Edited by tiauz

http://imagestorming.com/media/ob2/1334216688/3.png

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Rpg maker non consente di stoppare l'audio e poi riprendere, quindi devi per forza abbassare il volume, per far ciò ti ho creato una funzione rapida da usare

def play_map_sound(bgmvol, bgsvol)
 map = load_data(sprintf("Data/Map%03d.rvdata", $game_map.map_id))
 RPG::BGM.new(map.bgm.name, bgmvol, map.bgm.pitch).play
 RPG::BGS.new(map.bgs.name, bgsvol, map.bgs.pitch).play
end

mettila a fine script, all'inizio, dove ti pare, poi sostituisci

RPG::BGM.fade(180)
RPG::BGS.fade(180)
RPG::ME.fade(180)

con

play_map_sound(volumeBGM, volumeBGS)

Questo vale solo per la mappa però.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...