Sujet n°607
Posté par Mortenkein le 14 Avr - 02:37 (2008)
Titre : Script PokéRadio
J'ai trouvé un script permettant d'avoir une radio façon pokémon.

Auteur : GoldenShadow

Je l'ai annoté afin que vous puissiez mieux comprendre son fonctionnement.

1. Créez un nouveau script au-dessus de "main" et appelez-le PokéRadio.
2. Copiez le script ci-dessous dans le script PokéRadio.



Citation:







#=============================================================
#--------------------------------------------------------------------------------------------------------------------------

module SC
RXSC_RADI = "PokéRadio"
end

class Radio

def play(channel) # Joue une chanson s'il y a une chaîne
if channel == "none"
$chan_name = "Aucune chaîne"
else
Audio.bgm_play("Audio/BGM/" + channel, 100, 100)
end
end

def search(hz) # Identifie les chaînes + joue les fichiers BGM associés
if hz == 1
$chan_name = "Radio 1" # Nom de la chaîne
Audio.bgm_stop # Stoppe la chanson active
play("DL_Azalea") # Joue le fichier BGM
elsif hz == 2
$chan_name = "Radio 2"
Audio.bgm_stop
play("Follow_Me_Around")
elsif hz == 3
$chan_name = "Radio 3"
Audio.bgm_stop
play("GSCRival")
elsif hz == 4
$chan_name = "Radio 4"
Audio.bgm_stop
play("Mom")
elsif hz == 5
$chan_name = "Radio 5"
Audio.bgm_stop
play("pkgsc_azalea")
elsif hz == 6
$chan_name = "Radio 6"
Audio.bgm_stop
play("pk_gs_newbarktown")
elsif hz == 7
$chan_name = "Radio 7"
Audio.bgm_stop
play("lost")
elsif hz == 8
$chan_name = "Radio 8"
Audio.bgm_stop
play("pkgroute30")
elsif hz == 9
$chan_name = "Radio 9"
Audio.bgm_stop
play("PkmRS_Battle_5")
# elsif hz == (votre numéro de chaîne)
# $chan_name = "Le nom de votre chaîne"
# Audio.bgm_stop = "Stoppe la chanson active"
# play("Le fichier BGM à jouer")
else
Audio.bgm_stop
play("none")
end
end
end

class Window_RadioScreen < Window_Base

def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end

def refresh
self.contents.clear
rect1 = Rect.new(0, 0, 303, 64)
rect2 = Rect.new(0, 16, 304, 1)
rect3 = Rect.new($x, 8, 1, 16)
self.contents.fill_rect(rect1, Color.new(0, 0, 0)) # Couleur de remplissage du rectangle de gauche
self.contents.fill_rect(rect2, Color.new(255, 0, 0)) # Couleur de la ligne du rectangle de gauche
self.contents.fill_rect(rect3, Color.new(0, 0, 255)) # Couleur du curseur (le " | " )
self.contents.draw_text(0, 0, self.width - 40, 32, $x.to_s + " FM", 1) # L'espace avant le FM est important sinon il est collé sur le numéro de la chaîne
end
end

class Window_RadioName < Window_Base

def initialize
super(320, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end

def refresh
self.contents.clear
if $chan_name != nil
self.contents.draw_text(0, 0, self.width - 40, 32, $chan_name, 1)
else
self.contents.draw_text(0, 0, self.width - 40, 32, "Aucune chaîne", 1)
end
end
end

class Scene_Radio

def main
$x = 0
@sprite = Spriteset_Map.new
@radio_window = Window_RadioScreen.new
@name_window = Window_RadioName.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@radio_window.dispose
@name_window.dispose
@sprite.dispose
end

def update
$game_map.update
$game_system.map_interpreter.update
# Si vous voulez être capable de bouger tout en choisissant une chaîne,
# supprimez le "#" devant $game_player.update (ligne 136)
# Si vous faites cela, modifiez les lignes marquées de ##^
# $game_player.update
$game_system.update
$game_screen.update
if Input.repeat?(Input::RIGHT) ##^ (Assignez une autre touche à la place de RIGHT, R par exemple)
if $x == 287 # Nombre de chaînes potentiellement disponibles.
$x = 0
else
$x += 1
end
$radio.search($x)
end
if Input.repeat?(Input::LEFT) ##^ (Assignez une autre touche à la place de LEFT, L par exemple)
if $x < 1
$x = 287
else
$x -= 1
end
$radio.search($x)
end
if Input.trigger?(Input::B) # Si "B" est enfoncée (en fait c'est la touche "X"), vous quittez la PokéRadio
$scene = Scene_Map.new
$game_system.bgm_restore
end
@radio_window.refresh
@radio_window.update
@name_window.refresh
@name_window.update
end
end

class Scene_Title
alias ra_title_command_new_game command_new_game
def command_new_game
ra_title_command_new_game
$radio = Radio.new
end
end

class Scene_Save

def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($radio, file)
end
end

class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$radio = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end

#============================================================
# FINAL UPDATE: 17:44, May 20th 2005 [Please leave this unchanged and undeleted] (SID:002)








3. Ensuite, modifiez le script Pokemon_Menu de cette façon :


Lignes 24 à 31

Citation:








s1 = "POKéDEX"
s2 = "POKéMON"
s3 = "POKéRADIO"
s4 = "SAC"
s5 = $trainer_name
s6 = "SAUVER"
s7 = "QUITTER"
@command_window = Window_Command.new(160, )









Cherchez ces trois lignes (après le # Enlève accès Pokédex si non possédé) et modifiez-les




Citation:



if $game_system.save_disabled
@command_window.disable_item(5)
end







Enfin, modifiez les lignes 110 à 129 :



Citation:







when 2 # PokéRadio
$game_system.se_play($data_system.decision_se)
$scene = Scene_Radio.new
when 3 # Sac
$game_system.se_play($data_system.decision_se)
$scene = Pokemon_Item_Bag.new
when 4 # Carte dresseur
$game_system.se_play($data_system.decision_se)
$game_temp.common_event_id = 19
$scene = Scene_Map.new
when 5 # Sauvegarde
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Save.new
when 6 # Quitter le menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new









Captures d'écran :






Vous devriez maintenant avoir une PokéRadio Bouche extensiblek: . Cependant, vous pouvez remarquer que le nom des chaînes n'est pas très visible. En effet, je n'ai pas encore trouvé la portion du code qui gère la couleur du texte Yeux motorisés . Si vous pouvez m'aider, ça serait sympa.

Posté par valpokbest le 14 Avr - 08:03 (2008)
Je crois qu'en fait il n'y a pas de couleur définie. C'est celle par défaut et donc il faut que tu la définisses toi-même. Mais je ne sais pas où.

Posté par Pio le 14 Avr - 11:10 (2008)
Trop cool, il va bien servir ce script, mais on choisit ce qu'on écrit ?

Posté par Speed le 14 Avr - 11:40 (2008)
Ben oui, sinon c'est pas super ^^'
Il suffit de changer les textes dans le script. Tu choisis le nom de la radio et la musique.

En tout cas, merci beaucoup ! Il faudrait essayer de l'inclure dans un objet ^^

Posté par Mortenkein le 14 Avr - 12:28 (2008)
Pour l'inclure dans un objet, il suffit de créer un événement commun avec comme condition qu'il doit être appelé (la PokéRadio).

Posté par valpokbest le 15 Avr - 09:29 (2008)
Pour changer la couleur il faut mettre cette ligne:
Code:

self.contents.font.color = Color.new(rouge,vert,bleu) 

.
Rouge, vert, bleu à remplacer par le taux de rouge, de vert et de bleu.
Par exemple pour cette couleur: c'est

Code:

self.contents.font.color = Color.new(33,00,ff) 

.
(tu peux utiliser un logiciel de graphisme pour trouver les couleurs mais sache qu'avec paint tu trouveras les quantités. Sinon il y a le mode hexadécimal que xooit utilise (tu peux regarder) et les couleurs sont de ce type: #3300ff : les 2 premiers caractères sont pour le rouge, les 3 et 4 pour le vert et les 2 derniers pour le bleu. Mais comme tu dois mettre les chiffres en décimaux, le mieux c'est paint.



Je me rend compte que le script pour la couleur bleue est faux car j'ai mis les chiffres en héxadécimal. pour les convertir tu utilises la calculatrice mode scientifique Clin d'œil foireux
33 => 51
00 => 0
FF => 255.

Le code donnera alors:

 
Code:
self.contents.font.color = Color.new(51,0,255) 

PS: le maximum est de 255 (ou ff) et le minimum de 0 (ou 00).

Posté par Mortenkein le 15 Avr - 12:15 (2008)
Je vais tester ça après en après mon cours.

Posté par bibiantonio le 16 Avr - 20:17 (2008)
Oooooh snif ! Pleurnicheur le script ne marche pas, enfin moi je l'ai essayé mais ça n'a pas marché, peut-être que j'ai fai une erreur, ça doit être ça ^^

Posté par Mortenkein le 16 Avr - 23:03 (2008)
Est-ce que tu as un message d'erreur ?

Posté par Krosk le 16 Avr - 23:54 (2008)
note: pour les chiffres hexadécimaux, écrire ff ne marchera pas, mais 0xff ca passe et c'est équivalent à 255.

Posté par bibiantonio le 17 Avr - 09:44 (2008)
oui c'est un message d'erreur qui s'affiche quand je lance mon jeu :s, bon tant pis c'est pas si grave =)

Posté par Jordan le 1 Mai - 16:11 (2008)
JE L'ai corrigé! (pas bien dur ^^)


POKEMON menu
Spoiler
#==============================================================================
# ■ Pokemon_Menu
# Pokemon Script Project - Krosk
# 18/07/07
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Menu principal accessible par échap
#-----------------------------------------------------------------------------
module POKEMON_S
  class Pokemon_Menu
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def initialize(menu_index = 0)
      @menu_index = menu_index
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def main
       s1 = "POKéDEX"
      s2 = "POKéMON"
      s3 = "POKéRADIO"
      s4 = "SAC"
      s5 = $trainer_name
      s6 = "SAUVER"
      s7 = "QUITTER"
      @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
      @command_window.index = @menu_index
      @command_window.x = 480 - 3
      @command_window.y = 3
        
      if $pokemon_party.size == 0
        # Enlève accès Equipe
        @command_window.disable_item(1)
      end
      if not($data_pokedex[0])
        # Enlève accès Pokédex si non possédé
            @command_window.disable_item(0)
      end
      if $game_system.save_disabled
        @command_window.disable_item(5)
      end
      if $radio_system
        @command_window.disable_item(5)
      end
     
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @command_window.dispose
      @spriteset.dispose
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def update
      # ウィンドウを更新
      @command_window.update
      @spriteset.update
      # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
      if @command_window.active
        update_command
        return
      end
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
    #--------------------------------------------------------------------------
    def update_command
      # B ボタンが押された場合
      if Input.trigger?(Input::B)
        # キャンセル SE を演奏
        $game_system.se_play($data_system.cancel_se)
        # マップ画面に切り替え
        $scene = Scene_Map.new
        return
      end
      # C ボタンが押された場合
      if Input.trigger?(Input::C)
        # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
        if $game_party.actors.size == 0 and @command_window.index < 4
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # コマンドウィンドウのカーソル位置で分岐
        case @command_window.index
        when 0 # Pokédex
          if not($data_pokedex[0])
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Pokedex.new
        when 1 # Menu
          if $pokemon_party.size == 0
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Party_Menu.new
        when 2 # PokéRadio
$game_system.se_play($data_system.decision_se)
$scene = Scene_Radio.new
when 3 # Sac
$game_system.se_play($data_system.decision_se)
$scene = Pokemon_Item_Bag.new
when 4 # Carte dresseur
$game_system.se_play($data_system.decision_se)
$game_temp.common_event_id = 19
$scene = Scene_Map.new
when 5 # Sauvegarde
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Save.new
when 6 # Quitter le menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
        end
        return
      end
    end
  end
end




Pokéradio
Spoiler
#=============================================================
#--------------------------------------------------------------------------------------------------------------------------
module SC
RXSC_RADI = "PokéRadio"
end
class Radio
def play(channel) # Joue une chanson s'il y a une chaîne
if channel == "none"
$chan_name = "Aucune chaîne"
else
Audio.bgm_play("Audio/BGM/" + channel, 100, 100)
end
end
def search(hz) # Identifie les chaînes + joue les fichiers BGM associés
if hz == 1
$chan_name = "Radio 1" # Nom de la chaîne
Audio.bgm_stop # Stoppe la chanson active
play("DL_Azalea") # Joue le fichier BGM
elsif hz == 2
$chan_name = "Radio 2"
Audio.bgm_stop
play("Follow_Me_Around")
elsif hz == 3
$chan_name = "Radio 3"
Audio.bgm_stop
play("GSCRival")
elsif hz == 4
$chan_name = "Radio 4"
Audio.bgm_stop
play("Mom")
elsif hz == 5
$chan_name = "Radio 5"
Audio.bgm_stop
play("pkgsc_azalea")
elsif hz == 6
$chan_name = "Radio 6"
Audio.bgm_stop
play("pk_gs_newbarktown")
elsif hz == 7
$chan_name = "Radio 7"
Audio.bgm_stop
play("lost")
elsif hz == 8
$chan_name = "Radio 8"
Audio.bgm_stop
play("pkgroute30")
elsif hz == 9
$chan_name = "Radio 9"
Audio.bgm_stop
play("PkmRS_Battle_5")
# elsif hz == (votre numéro de chaîne)
# $chan_name = "Le nom de votre chaîne"
# Audio.bgm_stop = "Stoppe la chanson active"
# play("Le fichier BGM à jouer")
else
Audio.bgm_stop
play("none")
end
end
end
class Window_RadioScreen < Window_Base
def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
def refresh
self.contents.clear
rect1 = Rect.new(0, 0, 303, 64)
rect2 = Rect.new(0, 16, 304, 1)
rect3 = Rect.new($x, 8, 1, 16)
self.contents.fill_rect(rect1, Color.new(0, 0, 0)) # Couleur de remplissage du rectangle de gauche
self.contents.fill_rect(rect2, Color.new(255, 0, 0)) # Couleur de la ligne du rectangle de gauche
self.contents.fill_rect(rect3, Color.new(0, 0, 255)) # Couleur du curseur (le " | " )
self.contents.draw_text(0, 0, self.width - 40, 32, $x.to_s + " FM", 1) # L'espace avant le FM est important sinon il est collé sur le numéro de la chaîne
end
end
class Window_RadioName < Window_Base
def initialize
super(320, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
def refresh
self.contents.clear
if $chan_name != nil
self.contents.draw_text(0, 0, self.width - 40, 32, $chan_name, 1)
else
self.contents.draw_text(0, 0, self.width - 40, 32, "Aucune chaîne", 1)
end
end
end
class Scene_Radio
def main
$x = 0
@sprite = Spriteset_Map.new
@radio_window = Window_RadioScreen.new
@name_window = Window_RadioName.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@radio_window.dispose
@name_window.dispose
@sprite.dispose
end
def update
$game_map.update
$game_system.map_interpreter.update
# Si vous voulez être capable de bouger tout en choisissant une chaîne,
# supprimez le "#" devant $game_player.update (ligne 136)
# Si vous faites cela, modifiez les lignes marquées de ##^
# $game_player.update
$game_system.update
$game_screen.update
if Input.repeat?(Input::RIGHT) ##^ (Assignez une autre touche à la place de RIGHT, R par exemple)
if $x == 287 # Nombre de chaînes potentiellement disponibles.
$x = 0
else
$x += 1
end
$radio.search($x)
end
if Input.repeat?(Input::LEFT) ##^ (Assignez une autre touche à la place de LEFT, L par exemple)
if $x < 1
$x = 287
else
$x -= 1
end
$radio.search($x)
end
if Input.trigger?(Input::B) # Si "B" est enfoncée (en fait c'est la touche "X"), vous quittez la PokéRadio
$scene = Scene_Map.new
$game_system.bgm_restore
end
@radio_window.refresh
@radio_window.update
@name_window.refresh
@name_window.update
end
end
class Scene_Title
alias ra_title_command_new_game command_new_game
def command_new_game
ra_title_command_new_game
$radio = Radio.new
end
end
class Scene_Save
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($radio, file)
end
end
class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$radio = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end
#============================================================
# FINAL UPDATE: 17:44, May 20th 2005 [Please leave this unchanged and undeleted] (SID:002)


mais parés ça me remet une erreur que je ne comprend pas

Posté par Jordan le 1 Mai - 16:26 (2008)
dsl du double post mais j'ai trouvé!!!!

#==============================================================================
# ■ Pokemon_Menu
# Pokemon Script Project - Krosk
# 18/07/07
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Menu principal accessible par échap
#-----------------------------------------------------------------------------
module POKEMON_S
  class Pokemon_Menu
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def initialize(menu_index = 0)
      @menu_index = menu_index
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def main
       s1 = "POKéDEX"
      s2 = "POKéMON"
      s3 = "POKéRADIO"
      s4 = "SAC"
      s5 = $trainer_name
      s6 = "SAUVER"
      s7 = "QUITTER"
      @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
      @command_window.index = @menu_index
      @command_window.x = 480 - 3
      @command_window.y = 3
        
      if $pokemon_party.size == 0
        # Enlève accès Equipe
        @command_window.disable_item(1)
      end
      if not($data_pokedex[0])
        # Enlève accès Pokédex si non possédé
            @command_window.disable_item(0)
      end
      if $game_system.save_disabled
        @command_window.disable_item(5)
      end
      if $radio_system
        @command_window.disable_item(5)
      end
     
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @command_window.dispose
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def update
      # ウィンドウを更新
      @command_window.update
      # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
      if @command_window.active
        update_command
        return
      end
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
    #--------------------------------------------------------------------------
    def update_command
      # B ボタンが押された場合
      if Input.trigger?(Input::B)
        # キャンセル SE を演奏
        $game_system.se_play($data_system.cancel_se)
        # マップ画面に切り替え
        $scene = Scene_Map.new
        return
      end
      # C ボタンが押された場合
      if Input.trigger?(Input::C)
        # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
        if $game_party.actors.size == 0 and @command_window.index < 4
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # コマンドウィンドウのカーソル位置で分岐
        case @command_window.index
        when 0 # Pokédex
          if not($data_pokedex[0])
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Pokedex.new
        when 1 # Menu
          if $pokemon_party.size == 0
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Party_Menu.new
        when 2 # PokéRadio
$game_system.se_play($data_system.decision_se)
$scene = Scene_Radio.new
when 3 # Sac
$game_system.se_play($data_system.decision_se)
$scene = Pokemon_Item_Bag.new
when 4 # Carte dresseur
$game_system.se_play($data_system.decision_se)
$game_temp.common_event_id = 19
$scene = Scene_Map.new
when 5 # Sauvegarde
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = POKEMON_S::Pokemon_Save.new
when 6 # Quitter le menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
        end
        return
      end
    end
  end
end

remplacer pokemon menu par ça (ci dessus)

Posté par nucknuck le 1 Mai - 23:19 (2008)
j'ai essayé et c'est super mais.....
quand on va dans le menu l'ecran est noir et vois la map que quand tu quitte ou selectionne la radio

Posté par Jordan le 2 Mai - 16:11 (2008)
oui je sais et je comprend pas pourquoi

Posté par Suicune31 le 9 Aoû - 16:08 (2008)
Arf . il faut peut-être que le script prenne un screens avant d'affiché le menu nan ? Je connais pas trop moi :( . mais j'ai pris ce script et c'est gênant l'ecrans noir :(

Posté par Wescoeur le 11 Aoû - 14:42 (2008)
Citation:
Arf . il faut peut-etre que le script prene un sreen-shot avant d'affiché le menu nan ?

Non, sa doit sans doute être une erreur dans le script ou peut-être une incompatibilité, en tout cas je peux pas aider^^ au pire tu fais une radio en event grâce a une variable=> Rentrer un nombre dans la variable "radio"
Condition: si la variable radio est egale a 3, joué le fond musical 3.
Condition: si la variable radio est egale a 7, joué le fond musical 7.
Condition:...
Condition: si la variable radio est egale a X ou +, affiché un message:
"La radio n'as que X de chaines!"
Voila en éspérant que sa aide Bouche extensiblek:

Posté par Suicune31 le 11 Aoû - 14:59 (2008)
Ben c 'est gentil ^^ mais je preferai avoir la radio dans le menu ^^

Posté par Wescoeur le 11 Aoû - 16:18 (2008)
Remplace le sript Pokémon_Menu par celui ci:
Spoiler
Code:
#==============================================================================
# ■ Pokemon_Menu
# Pokemon Script Project - Krosk
# 18/07/07
#-----------------------------------------------------------------------------
# Scène modifiable
#-----------------------------------------------------------------------------
# Menu principal accessible par échap
#-----------------------------------------------------------------------------

module POKEMON_S
  class Pokemon_Menu
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def initialize(menu_index = 0)
      @menu_index = menu_index
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def main
      Graphics.freeze
     @z_level = 10000
     @background = Sprite.new
     @background.bitmap = RPG::Cache.picture("Menu.png")
     @background.x = 460-3
     @background.y = 11
     @background.z = @z_level
      @spriteset = Spriteset_Map.new
      s1 = "     POKéDEX"
      s2 = "     POKéMON"
      s3 = "     SAC "
      s4 = "     "+$trainer_name
      s5 = "     RADIO"
      s6 = "     SAUVER"
      s7 = "     QUITTER "
      @command_window = Window_Command.new(180, [s1, s2, s3, s4, s5, s6,s7])
      @command_window.index = @menu_index
      @command_window.x = 467 - 3
      @command_window.y = 5
      @command_window.z = @z_level + 2
      @command_window.opacity = 0
     
      if $pokemon_party.size == 0
        # Enlève accès Equipe
        @command_window.disable_item(1)
      end
      if not($data_pokedex[0])
        # Enlève accès Pokédex si non possédé
        @command_window.disable_item(0)
      end
      if $game_system.save_disabled
        @command_window.disable_item(4)
      end

      Graphics.transition
      loop do
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @command_window.dispose
      @background.dispose
      @spriteset.dispose
    end
    #--------------------------------------------------------------------------
    #
    #--------------------------------------------------------------------------
    def update
      # ウィンドウを更新
      @command_window.update
      @spriteset.update
      # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
      if @command_window.active
        update_command
        return
      end
    end
    #--------------------------------------------------------------------------
    # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
    #--------------------------------------------------------------------------
    def update_command
      # B ボタンが押された場合
      if Input.trigger?(Input::B)
        # キャンセル SE を演奏
        $game_system.se_play($data_system.cancel_se)
        # マップ画面に切り替え
        $scene = Scene_Map.new
        return
      end
      # C ボタンが押された場合
      if Input.trigger?(Input::C)
        # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
        if $game_party.actors.size == 0 and @command_window.index < 4
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # コマンドウィンドウのカーソル位置で分岐
        case @command_window.index
        when 0 # Pokédex
          if not($data_pokedex[0])
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Pokedex.new
        when 1 # Menu
          if $pokemon_party.size == 0
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Party_Menu.new
        when 2 # Sac
          $game_system.se_play($data_system.decision_se)
          $scene = Pokemon_Item_Bag.new
        when 3 # Carte dresseur
          $game_system.se_play($data_system.decision_se)
          $game_temp.common_event_id = 19
          $scene = Scene_Map.new
        when 4 # RADIO
          $game_system.se_play($data_system.decision_se)
          $game_temp.common_event_id = 32
          $scene = Scene_Map.new
        when 5 # Sauvegarde
          if $game_system.save_disabled
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = POKEMON_S::Pokemon_Save.new
        when 6 # Quitter le menu
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Map.new

        end
        return
      end
    end
  end
end

Ensuite va dans les évènements communs, le numéro 32 et édites a peu près comme sa:
Citation:
Rentrer un nombre dans la variable "radio"
Condition: si la variable radio est egale a 3, joué le fond musical 3.
Condition: si la variable radio est egale a 7, joué le fond musical 7.
Condition:...
Condition: si la variable radio est egale a X ou +, affiché un message:
"La radio n'as que X de chaines!"


Bien sûr il faut que l'évènement commun soit accessible par "appel", en tout cas tu peux faire cet manip, le temps que tu trouves un bon script radio^^

Posté par Suicune31 le 11 Aoû - 16:27 (2008)
C'est mieux sa en attendent xD merci beaucoup  Bouche extensiblek:

Posté par Wescoeur le 11 Aoû - 16:36 (2008)
De rien, comme sa quand t'auras un script de radio qui fonctionne, tu n'auras juste a ajouter le script et d'appeler la scene par l'event commun, voila^^
Ah oui tu paux mettre une condition par variable:
Si la variable"radio"=1 alors appeler la radio
Si la variable"radio"=0 alors afficher:"Vous n'avez pas de radio!"

Posté par Suicune31 le 11 Aoû - 17:15 (2008)
Okéy ^^ c'est bien sa !! hihi . je mets la variable radio egale a 1 des que je ve que le joueur possede la RADIO ? ^^ super sa  Bouche extensiblek:

Posté par Wescoeur le 11 Aoû - 17:21 (2008)
t'as juste a mettre "rendre la variable radio=1" et tu mets "vous avez obtenue la radio!"
Sinon je te conseillerais de t'intérésser aux variables, tu peux faire différentes choses avec comme des mini-jeux^^

Posté par Suicune31 le 11 Aoû - 17:31 (2008)
Des mini jeu ? moi jutilise quelque variable pour la meteo . quand il pleut .. pleut pas . . . orage . . neige . forte pluie .. tempete . enfin bon . . . . on pe faire le casino avec des variable . du genre la machine a sous ? nan . . quand meme pas Petit saligaud mal élevé

Posté par Wescoeur le 11 Aoû - 17:33 (2008)
bien sûr que si! Je l'ai même fait pour une banque avec les intérêts de 3%, le retrait, le dépot, le code d'une carde de crédit tiré au hasard, et la carte elle même utilisable pour payer en magasin, ...
Tu ne t'imagines pas les possibilités des variables^^

Posté par Suicune31 le 11 Aoû - 19:12 (2008)
Alala tant que sa ? XD . . .  :shock:

Posté par Wescoeur le 11 Aoû - 19:20 (2008)
et oui ! J'en utilises beaucoup sa peut même remplacer les interrupteurs dans certains cas.

Posté par Suicune31 le 11 Aoû - 19:35 (2008)
Ah bon ? Yeux motorisés jpensais pas  :mrgreen:

Posté par Wescoeur le 11 Aoû - 19:39 (2008)
si, si et puis sa peut faire des économies d'intérupteurs aussi^^, mais bon il y a des tonnes de possibilités avec rpg maker XP, pas comme le VX...

Posté par Sphinx le 11 Aoû - 20:07 (2008)
^_^ si tu savais ce qu'on peut faire avec un évent, toulouse... Le tout est de ne pas s'y mélanger les pinceaux, et on arrive rapidement à faire tout kesskon voulé fèr Petit saligaud mal élevé

Posté par Suicune31 le 11 Aoû - 21:00 (2008)
^^ C'est Vrai Petit saligaud mal élevé . on comme on arete pas de dire  . on ne cessera jamais de s'amelioré . on en aprend tout les jours xD  Bouche extensiblek:

Posté par Wescoeur le 12 Aoû - 07:40 (2008)
Tu vois même le sphinx arrive à faire des énigmes, c'est tout dire...

Posté par Sphinx le 12 Aoû - 08:57 (2008)
xD Mais euh xD


Petit saligaud mal élevé Et en plus suis pas mauvais en énigmeuuuuuh Petit saligaud mal élevé

Posté par Wescoeur le 12 Aoû - 08:59 (2008)
Pour le flood, non plus :mdr:

Posté par Sphinx le 12 Aoû - 09:31 (2008)
xD

N'empêche, j'ai réussi à la faire marcher, MOI, la radio :D

le code que j'utilise
Code:
#=============================================================
#  <> Radio Program *Deluxe* EDIT BY NENO
#  ==> You can delete all the comments except the copyright and creator info. Thanks.
#  ==> Do not rip, repost or any other way of reproducing without proper credit. Thanks.
#  ==> What? Those names of radio networks? They're just testings.
#  ShadowClan Technologies © 2003-2005 - All rights reserved. X-RPG/Asylum rules :-)
#--------------------------------------------------------------------------------------------------------------------------
#
# * BEFORE YOU THINK OF USING THIS SCRIPT ==> READ THIS FIRST!!!!!!!!!
# This is NO internet radio like Window Media Player's radio. That would beat all :-P
#  No, this is, just like you are making a FAKE story, a FAKE radio program.
# You cannot hear the channels LIVE or even search REAL channels.
# !! THIS IS JUST A SCRIPT !!
# Why do I tell this? There are smart-asses around here that just don't get it.
# ONE MORE THING:
# When using this, in the scene before the Radio, you MUST use
# $game_system.bgm_memorize before calling the Scene_Radio.new
# OR ELSE YOU WON'T HEAR YOUR BGM OF THE PREVIOUS SCENE!!!
# So when you exit radio, your bgm of the previous scene will be restored.
# Thanks for readin'. Ciao~
#
# * Can I make my own channels?
# Yes. Scroll down to the 'def search' and
# put in another 'elsif hz == (your hertz nr)' and
# define your channel like in the examples.
# That should play it when searching.
#
# * How to search channels on my radio?
# Hold your LEFT or RIGHT button pressed and the little pointer
# goes from one end to another. While you search, just
# see if the channel name appears in the window next to it.
#
# * It looks so empty! Just two windows?
# Well, you're allowed to fill it up, there is nothing against that you know.
# You may even change the colors used by the radio display.
# As long as people know I made it. Don't be ripping my stuff okay?
#
# * Something added:
# - You can see the map instead of a black screen. It also updates the events
#   like when using events that walk, that they also keep walking.
#   Screen update is also needed when used with tinting or flashing.
#
# That would end the little explaining for now. I -really- hope you like this script.
#--------------------------------------------------------------------------------------------------------------------------
# * Suggestions? ==> Post a message on the RPGXP catagory in the Radio Program topic
# * Created by: GoldenShadow a.k.a ????
# * Credits: Use of names :-P => X-RPG, RMXP.net, Dubealex, Ryughen, Torama, Vash and Deke
# * Bugs: Actually none... try and find one huh, I double dare ya!
#=============================================================


module SC
 RXSC_RADI = "Radio Program: Version 1 DX"
end

class Radio
 
 def play(channel) # Plays a song as if its a channel
   if channel == "none"
     $chan_name = "Nemhum Canal De Radio"
   else
     Audio.bgm_play("Audio/BGM/" + channel, 100, 100)
   end
 end

 def search(hz) # identifies the channels + plays assigned songs
   if hz == 1
     $chan_name = "Radio Games" # Name of channel
     Audio.bgm_stop # Stops any active music
     play("023-Town01")# Plays channel file
   elsif hz == 5
     $chan_name = "RMXP.net Radio Network"
     Audio.bgm_stop
     play("020-Field03")
   elsif hz == 10
     $chan_name = "Dubealex Radio Network"
     Audio.bgm_stop
     play("003-Battle03")
   elsif hz == 15
     $chan_name = "Ryughen Radio Network"
     Audio.bgm_stop
     play("004-Battle04")
   elsif hz == 20
     $chan_name = "Deke's Radio Network"
     Audio.bgm_stop
     play("005-Boss01")
   elsif hz == 25
     $chan_name = "Torama's Radio Network"
     Audio.bgm_stop
     play("006-Boss02")
   elsif hz == 30
     $chan_name = "Vash's Radio Network"
     Audio.bgm_stop
     play("007-Boss03")
   elsif hz == 101
     $chan_name = "Radio Neno FM"
     Audio.bgm_stop
     play("034-Heaven01")
   # elsif hz == (your Hertz number)
   #   $chan_name = "Your channel name"
   #   Audio.bgm_stop
   #   play("Your file in the BGM directory to play")
   else
     Audio.bgm_stop
     play("none")
   end
 end
end
 
class Window_RadioScreen < Window_Base
 
   def initialize
   super(0, 0, 320, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   refresh
 end

 def refresh
   self.contents.clear
   rect1 = Rect.new(0, 0, 304, 64)
   rect2 = Rect.new(0, 16, 304, 1)
   rect3 = Rect.new($x, 8, 1, 16)
   self.contents.fill_rect(rect1, Color.new(0, 0, 0))
   self.contents.fill_rect(rect2, Color.new(255, 0, 0))
   self.contents.fill_rect(rect3, Color.new(0, 0, 255))
   self.contents.draw_text(0, 0, self.width - 40, 32, $x.to_s + " FM", 1)
 end
end

class Window_RadioName < Window_Base
 
 def initialize
   super(320, 0, 320, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   refresh
 end

 def refresh
   self.contents.clear
   if $chan_name != nil
     self.contents.draw_text(0, 0, self.width - 40, 32, $chan_name, 1)
   else
     self.contents.draw_text(0, 0, self.width - 40, 32, "Nemhum Canal De Radio", 1)
   end
 end
end

class Scene_Radio
 
 def main
   $x = 0
   @sprite = Spriteset_Map.new
   @radio_window = Window_RadioScreen.new
   @name_window = Window_RadioName.new
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @radio_window.dispose
   @name_window.dispose
   @sprite.dispose
 end
 
 def update
   $game_map.update
   $game_system.map_interpreter.update
   # if you want to be able to move while you search,
   # remove the '#' sign before $game_player.update
   # When doing that, change stuff marked with ##^
   #$game_player.update
   $game_system.update
   $game_screen.update
   if Input.repeat?(Input::RIGHT) ##^ (This would be changed to R instead of RIGHT)
     if $x == 287
       $x = 0
     else
       $x += 1
     end
     $radio.search($x)
   end
   if Input.repeat?(Input::LEFT) ##^ (This would be changed to L instead of Left)
     if $x < 1
       $x = 287
     else
       $x -= 1
     end
     $radio.search($x)
   end
    if Input.trigger?(Input::B) #Esc Para Fechar a janela De Radio.
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
   end
   @radio_window.refresh
   @radio_window.update
   @name_window.refresh
   @name_window.update
 end
end
   
class Scene_Title
  alias ra_title_command_new_game command_new_game
  def command_new_game
   ra_title_command_new_game
   $radio = Radio.new
 end
end

class Scene_Save

 def write_save_data(file)
     characters = []
     for i in 0...$game_party.actors.size
       actor = $game_party.actors[i]
       characters.push([actor.character_name, actor.character_hue])
     end
     Marshal.dump(characters, file)
     Marshal.dump(Graphics.frame_count, file)
     $game_system.save_count += 1
     $game_system.magic_number = $data_system.magic_number
     Marshal.dump($game_system, file)
     Marshal.dump($game_switches, file)
     Marshal.dump($game_variables, file)
     Marshal.dump($game_self_switches, file)
     Marshal.dump($game_screen, file)
     Marshal.dump($game_actors, file)
     Marshal.dump($game_party, file)
     Marshal.dump($game_troop, file)
     Marshal.dump($game_map, file)
     Marshal.dump($game_player, file)
     Marshal.dump($radio, file)
 end
end
class Scene_Load
 def read_save_data(file)
   characters = Marshal.load(file)
   Graphics.frame_count = Marshal.load(file)
   $game_system           = Marshal.load(file)
   $game_switches         = Marshal.load(file)
   $game_variables        = Marshal.load(file)
   $game_self_switches  = Marshal.load(file)
   $game_screen           = Marshal.load(file)
   $game_actors            = Marshal.load(file)
   $game_party             = Marshal.load(file)
   $game_troop             = Marshal.load(file)
   $game_map              = Marshal.load(file)
   $game_player            = Marshal.load(file)
   $radio                       = Marshal.load(file)
   if $game_system.magic_number != $data_system.magic_number
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
   $game_party.refresh
      end
  end

#============================================================
# FINAL UPDATE: 17:44, May 20th 2005 [Please leave this unchanged and undeleted] (SID:002).



Et dans mon évent, j'appelle via la commande Insérer un script : "$scene = Scene_Radio.new"

^_^ Chez moi, ca marche =)

Posté par Suicune31 le 12 Aoû - 14:07 (2008)
C'est bien ^^ . mais pour moi sa revien au meme ^^ . quand je vais dans mon menu on vois que le menu . le reste c'est tout noir  :(


EDIT : C'est réglé ^^  Imbécile heureux . Et tout seul en plus xD Petit saligaud mal élevé

Posté par Wescoeur le 12 Aoû - 18:19 (2008)
Bizarre, Zarbi, moi j'avais pas éssayer le script, j'en utilises un autre pour mon jeu Mario qui est mieux mais pas compatible avec PSP :cry:

Posté par alpha39 le 4 Nov - 18:42 (2008)
Mortenkein c'est un script très bien seulement, maintenant, quand je veut aller le menu, sa fait qu'il y a une erreur dans le script "Window_Command" ligne 55

Merci de m'aider,
Alpha39

PS : je sait pas si c'est a cause de sa ou pas mais avant sa bugait pas...

Posté par Polokus le 15 Déc - 19:17 (2008)
moi j'ai un messages d'erreur quand je veux changer la chaine sa me met un truc qui dit """for nil class" aidez moi ce script est super mais si chez moi il archais !

Posté par Polokus le 15 Déc - 19:26 (2008)
:(  aidez moi silvous plait ! ! ! ! !

Posté par Wescoeur le 15 Déc - 19:31 (2008)
Arrêtes les doubles posts et on verra =)

Posté par Polokus le 17 Déc - 19:43 (2008)
quel qu'un pourrait maider a faire des maps ? pokemon bien sur!

Posté par Solfay1 le 17 Déc - 19:53 (2008)
Tu croit être dans le bon topic pour demander ca ?
Enfin je t'aide mais ne repost plus ici pour ces genres de chose :
>> ./2206.html

Posté par Hanamichi93 le 25 Déc - 18:59 (2008)
Moi sa marche mais que je mais la fleche a droite pour changer de chaine sa me fait erreur ligne 132 dans le scripte Pokeradio