Forum Rpg maker

Forum poświęcony programowi do tworzenia gier RPG. To co znajdziesz na stronie jest ciągle aktualizowane i dopuszczane przez was.

  • Nie jesteś zalogowany.
  • Polecamy: Gry

#1 2014-01-19 12:36:26

tonomipl

Administrator

Zarejestrowany: 2014-01-19
Posty: 8
Punktów :   

[VXAce]Basic Climate System v2.1 (Skrypt dodający efekty pogodowe)

Krótki opis:
Skrypt zapewnia podstawowy system pogodowy, który będzie losowo generował deszcz lub burze albo inne zjawiska atmosferyczne.
Oczywiście można go skonfigurować według własnych potrzeb



Autor: Vlue


Skrypt:

#Basic Climate System v2.1.2
#----------#
#Autor :V.M of D.T
#Autor tłumaczenia :TonomiPL
#Opis: Zapewnia podstawowy system pogody,który będzie losowy tworzył zjawiska atmosferyczne
#          Wooot!
#
#Sposób użycia:
#          Skrypt wywołuje:
#           Climate::still(true/false)    #Zatrzymuje zmianę pogody
#           Climate::weather              #Zwraca 0 do czystego nieba , 1 do deszczu
#                                                  2 do burzy, 3 for losowo1
#                                                  4 for losowo2
#       
#Dostosowanie: Ustaw poniżej, w komentarzach.
#
#----------#
#
#--- Do wykorzystania  dowolny projekt.

#Przybliżony czas trwania efektów pogodowych w ramkach.
MAX_DURATION = 18000

#Możliwość zajścia rodzaje pogody, wyższe numery wystąpić maksymalnie ponad niższą #liczbę.
SUN     = 40
RAIN    = 30
STORM   = 15
CUSTOM1 = 0  #Efekty pogodowe zwyczaj szansa, zaawansowany
CUSTOM2 = 0  #Efekty pogodowe zwyczaj szansa, zaawansowany

#Tablica specjalnych map, format [,,] (tzn. [5,6,54,780])
#Mapy, gdzie pogoda nie jest podana:
NOWEATHERMAPS   = [2]
#Mapy, gdzie pogoda nie jest pokazywane i BGS jest grane:
INDOORSOUNDMAPS = []
#Mapy, gdzie pada śnieg zamiast deszczu:
SNOWYMAPS       = []

#BGS efekty dźwiękowe!  I oznacza efektów dźwiękowych w pomieszczeniach.
#Format jest ["Filename", Volume, Pitch]
USE_SOUND = true

RAIN_BGS    = ["Rain",  95, 100]
IRAIN_BGS   = ["Rain",  65, 100]

SNOW_BGS    = ["Rain", 0, 100]
ISNOW_BGS   = ["Rain", 0, 100]

STORM_BGS   = ["Storm", 75, 100] 
ISTORM_BGS  = ["Storm", 55, 100] 

BLIZZ_BGS   = ["Storm", 0, 100] 
IBLIZZ_BGS  = ["Storm", 0, 100]

CUSTOM1_BGS = ["Rain",  95, 100] #Niestandardowe dźwięki, efekty pogodowe
CUSTOM2_BGS = ["Rain",  95, 100] #Niestandardowe dźwięki, efekty pogodowe

#Dostosowywanie zaawansowane#
#Posiada system niestandardowy pogody . Teraz możesz używać tego pogodę!
#Wystarczy zobaczyć te polecenia :
CLEARCOMMAND = "$game_map.screen.change_weather(:none, 0, 0)"
SUNCOMMAND = "$game_map.screen.change_weather(:none, 0, 120)"
RAINCOMMAND = "$game_map.screen.change_weather(:rain, 9, 120)"
SNOWCOMMAND = "$game_map.screen.change_weather(:snow, 5, 120)"
STORMCOMMAND = "$game_map.screen.change_weather(:storm, 9, 120)"
BLIZZCOMMAND = "$game_map.screen.change_weather(:snow, 9, 120)"
CUSTOM1COMMAND = ""
CUSTOM2COMMAND = ""

#Zapisać aktualny stan pogody w zmiennej?
BCL_USE_VARIABLE = false
BCL_CLIMATE_VARIABLE = 1

module Climate
  def self.init
    @current_weather = -1
    @still = false
    @duration = MAX_DURATION / 4
    @need_refresh = false
    update
  end
  def self.update
    return if !SceneManager.scene.is_a?(Scene_Map)
    return if @still
    change_weather if @duration < 0
    @duration -= 1
    update_weather if @need_refresh
  end
  def self.change_weather
    arrayseed = []
    SUN.times { arrayseed.push(0) }
    RAIN.times { arrayseed.push(1) }
    STORM.times { arrayseed.push(2) }
    CUSTOM1.times { arrayseed.push(3) }
    CUSTOM2.times { arrayseed.push(4) }
    new_weather = arrayseed[rand(arrayseed.size-1)]
    sun if new_weather == 0
    rain if new_weather == 1
    storm if new_weather == 2
    custom1 if new_weather == 3
    custom2 if new_weather == 4
    $game_variables[BCL_CLIMATE_VARIABLE] = @current_weather if BCL_USE_VARIABLE
    @duration = MAX_DURATION * ((rand(40)+80)/100)
    @duration = @duration.to_i
    @need_refresh = true
  end
  def self.update_weather
    @need_refresh = false
    clear if no_weather_map
    play_weather_sound if indoor_map
    return if no_weather_map
    sun if @current_weather == 0
    rain if @current_weather == 1
    storm if @current_weather == 2
    custom1 if @current_weather == 3
    custom2 if @current_weather == 4
  end
  def self.clear
    $game_map.map.bgs.play
    eval(CLEARCOMMAND)
  end
  def self.sun
    @current_weather = 0
    play_weather_sound
    eval(SUNCOMMAND)
  end
  def self.rain
    snow = snowy_map
    @current_weather = 1
    play_weather_sound
    eval(RAINCOMMAND) unless snow
    eval(SNOWCOMMAND) if snow
  end
  def self.storm
    @current_weather = 2
    snow = snowy_map
    play_weather_sound
    eval(STORMCOMMAND) unless snow
    eval(BLIZZCOMMAND) if snow
  end
  def self.custom1
    @current_weather = 3
    play_weather_sound
    eval(CUSTOM1COMMAND)
  end
  def self.custom2
    @current_weather = 4
    play_weather_sound
    eval(CUSTOM2COMMAND)
  end
  def self.bgs_sound(name, volume, pitch)
    Audio.bgs_play('Audio/BGS/' + name, volume, pitch, 0)
  end
  def self.play_weather_sound
    return unless USE_SOUND
    indoor = indoor_map
    snowy = snowy_map
    weather = @current_weather
    weather += 10 if snowy and @current_weather == 1
    weather += 20 if snowy and @current_weather == 2
    case weather
    when 0
      Audio.bgs_stop
    when 1
      bgs_sound(RAIN_BGS[0],RAIN_BGS[1],RAIN_BGS[2]) unless indoor
      bgs_sound(IRAIN_BGS[0],IRAIN_BGS[1],IRAIN_BGS[2]) if indoor
    when 2
      bgs_sound(STORM_BGS[0],STORM_BGS[1],STORM_BGS[2]) unless indoor
      bgs_sound(ISTORM_BGS[0],ISTORM_BGS[1],ISTORM_BGS[2]) if indoor
    when 3
      bgs_sound(CUSTOM1_BGS[0],CUSTOM1_BGS[1],CUSTOM1_BGS[2]) unless indoor
      bgs_sound(ICUSTOM1_BGS[0],ICUSTOM1_BGS[1],ICUSTOM1_BGS[2]) if indoor
    when 4
      bgs_sound(CUSTOM2_BGS[0],CUSTOM2_BGS[1],CUSTOM2_BGS[2]) unless indoor
      bgs_sound(ICUSTOM2_BGS[0],ICUSTOM2_BGS[1],ICUSTOM2_BGS[2]) if indoor
    when 11
      bgs_sound(SNOW_BGS[0],SNOW_BGS[1],SNOW_BGS[2]) unless indoor
      bgs_sound(ISNOW_BGS[0],ISNOW_BGS[1],ISNOW_BGS[2]) if indoor
    when 22
      bgs_sound(BLIZZ_BGS[0],BLIZZ_BGS[1],BLIZZ_BGS[2]) unless indoor
      bgs_sound(IBLIZZ_BGS[0],IBLIZZ_BGS[1],IBLIZZ_BGS[2]) if indoor
    end
  end
  def self.no_weather_map
    retvar = false
    NOWEATHERMAPS.each {|id| retvar = true if id == $game_map.map_id }
    INDOORSOUNDMAPS.each {|id| retvar = true if id == $game_map.map_id }
    return retvar
  end
  def self.indoor_map
    retvar = false
    INDOORSOUNDMAPS.each {|id| retvar = true if id == $game_map.map_id }
    return retvar
  end
  def self.snowy_map
    retvar = false
    SNOWYMAPS.each {|id| retvar = true if id == $game_map.map_id }
    return retvar
  end
  def self.need_refresh
    @need_refresh = true
    update
  end
  def self.still(set)
    @still = set
  end
  def self.weather
    return @current_weather
  end
end

class Game_Map
  attr_accessor   :map
end

class Scene_Map
  alias climate_update update
  alias climate_post_transfer post_transfer
  def update
    climate_update
    Climate::update
  end
  def post_start
    Climate::need_refresh
    super
  end
  def post_transfer
    Climate::need_refresh
    climate_post_transfer
  end
end

Climate::init


Screeny:

http://img32.imageshack.us/img32/3640/61470140.jpg



Dodatkowe informacje:
Wklejamy nad main!

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.veterans.pun.pl www.bzevuv.pun.pl www.wacki.pun.pl www.nsaiirok11-13.pun.pl www.makietyibitewniaki.pun.pl