Jump to content
Rpg²S Forum

Caios

Utenti
  • Posts

    95
  • Joined

  • Last visited

Posts posted by Caios

  1. Scusa Pro, ma l'altro tipo di CODE cosi' e' incopiabile! XD (anzi, l'altro CODe non c'e', boh)

     

    Cosi' allora senza nessun code, questo e' solo un esempio, non copiatelo perche' non va!

     

    class Scene_Map def main $danni = nil if $battle == false #antibug che evita casini quando si esce dal menu @ind = 0 #azzera il contatore di nemici @item = Item.new #finestra oggetti @enemies_id = Enemies_Id.new if $start != true $battle = false $game_system.windowskin_name = $data_system.windowskin_name for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) character.through = true $game_map.events.transparent = true @enemies_id[@ind] = $game_map.events.list[1].parameters[0].to_i @ind += 1 end end end $danni = Calculator.new(@enemies_id) if @ind > 0 and $danni == nil and $start @wait = 0 if @ind > 0 @morti = [] @timer = [] @chara = [] for i in 1..@ind @timer[i - 1] = 0 @chara[i - 1] = "" end end @s1 = "Attacca" s2 = "Magia" s3 = "Oggetti" s4 = "..." @command_window = Window_Command2.new(140, [@s1, s2, s3, s4]) @command_window.index = 0 @command_window.opacity = 160 @command_window.y = 480 - @command_window.height @command_window.index = 0 @magic_window = Window_Command2.new(140, ["Fire", "Blizzard", "Thunder", "Heal"]) @magic_window.visible = false @magic_window.active = false @magic_window.opacity = 160 @fire_magic = Sprite.new @fire_magic.bitmap = RPG::Cache.character("Fire", 0) @fire_magic.visible = false @fire_magic.z = 1 @bliz_magic = Sprite.new @bliz_magic.bitmap = RPG::Cache.character("Blizzard", 0) @bliz_magic.visible = false @bliz_magic.z = 1 @spriteset = Spriteset_Map.new @barre = Barre.new @message_window = Window_Message.new Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end # Prepare for transition Graphics.freeze @barre.dispose @item.dispose @command_window.dispose @magic_window.dispose # Dispose of sprite set @spriteset.dispose # Dispose of message window @message_window.dispose @fire_magic.dispose # If switching to title screen if $scene.is_a?(Scene_Title) # Fade out screen Graphics.transition Graphics.freeze end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update update_AI if $start if $start for k in 1..@ind if $danni != nil and $danni.enemies_hp[k - 1] < 1 $game_actors[1].exp += $data_enemies[@enemies_id[k - 1]].exp unless @morti[k - 1] @morti[k - 1] = true end end numero_morti = 0 if @morti != nil and @morti.size > 1 for l in 1..@morti.size if @morti[l - 1] numero_morti += 1 end end elsif @morti != nil and @morti.size == 1 if @morti[0] numero_morti = 1 end end if numero_morti == @ind $danni = nil $start = false $battle = false $game_map.autoplay $game_system.windowskin_name = $data_system.windowskin_name end ind = 0 for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) if @morti[ind] character.through = true unless character.transparent character.transparent = true unless character.transparent character.animation_id = 48 unless character.transparent $game_map.need_refresh = true unless character.transparent end ind += 1 end end end $danni = Calculator.new(@enemies_id) if $battle == true and $danni == nil @item.update @magic_window.update if @SoraAnimMagia == true character = $game_player @wait +=1 case @wait when 1 character.pattern = 1 when 5 character.pattern = 2 when 10 character.pattern = 3 when 15 character.pattern = 4 when 20 character.pattern = 5 @wait = 0 @SoraAnimMagia = false @movimento_magia = true actor = $game_actors[1] actor.set_graphic($game_actors[1].name, 0, "", 0) $game_player.refresh end end #muove la magia Fire if @movimento_magia == true if @fire == true for i in 1..15 if i <=15 if @dir == 2 @fire_magic.y += 1 elsif @dir == 4 @fire_magic.x -= 1 elsif @dir == 6 @fire_magic.x += 1 elsif @dir == 8 @fire_magic.y -= 1 end controlla_magia end end elsif @bliz == true for i in 1..15 if i <=15 if @dir == 2 @bliz_magic.y += 1 elsif @dir == 4 @bliz_magic.x -= 1 elsif @dir == 6 @bliz_magic.x += 1 elsif @dir == 8 @bliz_magic.y -= 1 end controlla_magia end end elsif @thunder == true controlla_magia elsif @heal == true controlla_magia end end #aggiorna l'img della magia Fire @fire_magic.update @bliz_magic.update #fa in modo che vicinpo alle persone, il comando "Attacca" diventi "Parla" for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["parla"]) if $parla != true if character.x == $game_player.x if character.y == $game_player.y $parla = true @i = i @command_window.dispose @command_window = nil command_window_actions end end else if character.x != $game_player.x $parla = false @i = i @command_window.dispose @command_window = nil command_window_actions end if character.y != $game_player.y $parla = false @i = i @command_window.dispose @command_window = nil command_window_actions end end end end @command_window.update #imposta l'attacco di Sora if $sora_attacca == true @wait += 1 if @wait == 20 actor = $game_actors[1] actor.set_graphic($game_actors[1].name, 0, "", 0) $game_player.refresh $sora_attacca = false @combo = false @wait = 0 end end if Input.trigger?(Input::B) if @magic_window.active == true if $start == true if @movimento_magia != true $game_system.se_play($data_system.cancel_se) @magic_window.active = false @magic_window.visible = false @command_window.active = true end end end end #Imposta le funzioni del menù laterale if Input.trigger?(Input::C) if @magic_window.active == true case @magic_window.index when 0 if $game_actors[1].sp > 20 $game_actors[1].sp -= 20 if @movimento_magia != true Audio.se_play("Audio/SE/Fire", 100, 100) actor = $game_actors[1] actor.set_graphic($game_actors[1].name + "Magia", 0, "", 0) $game_player.refresh @fire_magic.visible = true character = $game_player if character.direction == 2 @dir = 2 @fire_magic.x = $game_player.screen_x-16 @fire_magic.y = $game_player.screen_y-16 end if character.direction == 4 @dir = 4 @fire_magic.x = $game_player.screen_x-40 @fire_magic.y = $game_player.screen_y-32 end if character.direction == 6 @dir = 6 @fire_magic.x = $game_player.screen_x+32 @fire_magic.y = $game_player.screen_y-32 end if character.direction == 8 @dir = 8 @fire_magic.x = $game_player.screen_x-16 @fire_magic.y = $game_player.screen_y-90 end @SoraAnimMagia = true @fire = true end end when 1 if $game_actors[1].sp > 40 $game_actors[1].sp -= 40 @magic_window.visible = false @magic_window.active = false @command_window.active = true if @movimento_magia != true Audio.se_play("Audio/SE/Bliz", 100, 100) actor = $game_actors[1] actor.set_graphic($game_actors[1].name + "Magia", 0, "", 0) $game_player.refresh @bliz_magic.visible = true character = $game_player if character.direction == 2 @dir = 2 @bliz_magic.x = $game_player.screen_x-16 @bliz_magic.y = $game_player.screen_y-16 end if character.direction == 4 @dir = 4 @bliz_magic.x = $game_player.screen_x-40 @bliz_magic.y = $game_player.screen_y-32 end if character.direction == 6 @dir = 6 @bliz_magic.x = $game_player.screen_x+32 @bliz_magic.y = $game_player.screen_y-32 end if character.direction == 8 @dir = 8 @bliz_magic.x = $game_player.screen_x-16 @bliz_magic.y = $game_player.screen_y-90 end @SoraAnimMagia = true @bliz = true end end when 2 if $game_actors[1].sp > 60 $game_actors[1].sp -= 60 @magic_window.visible = false @magic_window.active = false @command_window.active = true if @movimento_magia != true Audio.se_play("Audio/SE/Thunder", 100, 100) actor = $game_actors[1] actor.set_graphic($game_actors[1].name + "Oggetti", 0, "", 0) $game_player.refresh @SoraAnimMagia = true @thunder = true end end when 3 if $game_actors[1].sp > 40 $game_actors[1].sp -= 40 @magic_window.visible = false @magic_window.active = false @command_window.active = true if @movimento_magia != true Audio.se_play("Audio/SE/Heal", 100, 100) actor = $game_actors[1] actor.set_graphic($game_actors[1].name + "Oggetti", 0, "", 0) $game_player.refresh @SoraAnimMagia = true @heal = true end end end end # Branch by command window cursor position if @command_window.active == true case @command_window.index when 0 #Attacca if @s1 == "Attacca" actor = $game_actors[1] actor.set_graphic($game_actors[1].name + "Attacco", 0, "", 0) $game_player.refresh character = $game_player character.move_forward character.move_forward if character.pattern < 4 or @combo == false @combo = true $sora_attacca = true @wait = 0 end when 1#Magie @magic_window.visible = true @magic_window.active = true @command_window.active = false when 2#oggetti @command_window.active = false @item.active = true when 3#extra end end end if $start == true if $game_system.windowskin_name != "Red" $battle = true start $game_system.windowskin_name = "Red" end else for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) character.through = true character.transparent = true end end end # Loop loop do # Update map, interpreter, and player order # (this update order is important for when conditions are fulfilled # to run any event, and the player isn't provided the opportunity to # move in an instant) $game_map.update $game_system.map_interpreter.update $game_player.update if @SoraAnimMagia != true # Update system (timer), screen $game_system.update $game_screen.update # Abort loop if player isn't place moving unless $game_temp.player_transferring break end # Run place move transfer_player # Abort loop if transition processing if $game_temp.transition_processing break end end # Update sprite set @spriteset.update @barre.update unless $start and $battle $danni = nil end # Update message window @message_window.update # If game over if $game_temp.gameover # Switch to game over screen $scene = Scene_Gameover.new return end # If returning to title screen if $game_temp.to_title # Change to title screen $scene = Scene_Title.new return end # If transition processing if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition if $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # If showing message window if $game_temp.message_window_showing return end # If encounter list isn't empty, and encounter count is 0 if $game_player.encounter_count == 0 and $game_map.encounter_list != [] # If event is running or encounter is not forbidden unless $game_system.map_interpreter.running? or $game_system.encounter_disabled # Confirm troop n = rand($game_map.encounter_list.size) troop_id = $game_map.encounter_list[n] # If troop is valid if $data_troops[troop_id] != nil # Set battle calling flag $game_temp.battle_calling = true $game_temp.battle_troop_id = troop_id $game_temp.battle_can_escape = true $game_temp.battle_can_lose = false $game_temp.battle_proc = nil end end end # If B button was pressed if Input.trigger?(Input::B) # If event is running, or menu is not forbidden unless $game_system.map_interpreter.running? or $game_system.menu_disabled # Set menu calling flag or beep flag $game_temp.menu_calling = true $game_temp.menu_beep = true end end # If debug mode is ON and F9 key was pressed if $DEBUG and Input.press?(Input::F9) # Set debug calling flag $game_temp.debug_calling = true end # If player is not moving unless $game_player.moving? # Run calling of each screen if $game_temp.battle_calling call_battle elsif $game_temp.shop_calling call_shop elsif $game_temp.name_calling call_name elsif $game_temp.menu_calling call_menu elsif $game_temp.save_calling call_save elsif $game_temp.debug_calling call_debug end end end def call_battle # Clear battle calling flag $game_temp.battle_calling = false # Clear menu calling flag $game_temp.menu_calling = false $game_temp.menu_beep = false # Make encounter count $game_player.make_encounter_count # Memorize map BGM and stop BGM $game_temp.map_bgm = $game_system.playing_bgm $game_system.bgm_stop # Play battle start SE $game_system.se_play($data_system.battle_start_se) # Play battle BGM $game_system.bgm_play($game_system.battle_bgm) # Straighten player position $game_player.straighten # Switch to battle screen $scene = Scene_Battle.new end def call_shop $game_temp.shop_calling = false $game_player.straighten $scene = Scene_Shop.new end def call_name # Clear name input call flag $game_temp.name_calling = false # Straighten player position $game_player.straighten # Switch to name input screen $scene = Scene_Name.new end def call_menu if $battle != true # Clear menu call flag $game_temp.menu_calling = false # If menu beep flag is set if $game_temp.menu_beep # Play decision SE $game_system.se_play($data_system.decision_se) # Clear menu beep flag $game_temp.menu_beep = false end # Straighten player position $game_player.straighten # Switch to menu screen $scene = Scene_Menu.new end end def call_save # Straighten player position $game_player.straighten # Switch to save screen $scene = Scene_Save.new end def call_debug # Clear debug call flag $game_temp.debug_calling = false # Play decision SE $game_system.se_play($data_system.decision_se) # Straighten player position $game_player.straighten # Switch to debug screen $scene = Scene_Debug.new end def transfer_player $danni = nil # Clear player place move call flag $game_temp.player_transferring = false # If move destination is different than current map if $game_map.map_id != $game_temp.player_new_map_id # Set up a new map $game_map.setup($game_temp.player_new_map_id) end # Set up player position $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) # Set player direction case $game_temp.player_new_direction when 2 # down $game_player.turn_down when 4 # left $game_player.turn_left when 6 # right $game_player.turn_right when 8 # up $game_player.turn_up end # Straighten player position $game_player.straighten # Update map (run parallel process event) $game_map.update # Remake sprite set @spriteset.dispose @spriteset = Spriteset_Map.new @barre.dispose @barre = Barre.new @morti = [] @ind = 0 refresh_item @enemies_id = nil @enemies_id = Enemies_Id.new if $start != true $battle = false $game_system.windowskin_name = $data_system.windowskin_name for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) character.through = true $game_map.events.transparent = true @enemies_id[@ind] = $game_map.events.list[1].parameters[0].to_i @ind += 1 end end end if @ind > 0 @morti = [] @timer = [] @chara = [] for i in 1..@ind @timer[i - 1] = 0 @chara[i - 1] = "" end end $danni = Calculator.new(@enemies_id) if @ind > 0 and $danni == nil @spriteset.update # If processing transition if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition Graphics.transition(20) end # Run automatic change for BGM and BGS set on the map $game_map.autoplay # Frame reset Graphics.frame_reset # Update input information Input.update end def start for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) character.through = false $game_map.events.transparent = false $game_map.events.animation_id = 48 $game_map.need_refresh = true $game_system.bgm_play($game_system.battle_bgm) end end end def command_window_actions if $parla[@i] == true @s1 = "Parla" else @s1 = "Attacca" end s2 = "Magia" s3 = "Oggetti" s4 = "..." @command_window = Window_Command2.new(140, [@s1, s2, s3, s4]) @command_window.index = 0 @command_window.opacity = 160 @command_window.y = 480 - @command_window.height @command_window.index = 0 if $parla[@i] == true @command_window.active = false else @command_window.active = true end @i = nil end def controlla_magia ind = 0 for i in $game_map.events.keys.sort character = $game_map.events if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["nemico"]) if @fire_magic.y == character.screen_y-32 and @fire_magic.x == character.screen_x-16 $game_map.events.animation_id = 27 $danni.hero_magic(150, ind) end if @bliz_magic.y == character.screen_y-32 and @bliz_magic.x == character.screen_x-16 $game_map.events.animation_id = 27 $danni.hero_magic(200, ind) end ind = ind + 1 end end if @fire == true if @fire_magic.y < -40 or @fire_magic.y > 640 @movimento_magia = false @fire = false elsif @fire_magic.x < -40 or @fire_magic.x > 640 @movimento_magia = false @fire = false end end if @bliz == true if @bliz_magic.y < -40 or @bliz_magic.y > 640 @movimento_magia = false @bliz = false elsif @bliz_magic.x < -40 or @bliz_magic.x > 640 @movimento_magia = false @bliz = false end end if @thunder == true $game_player.animation_id = 35 @movimento_magia = false @thunder = false if ind > 1 for i in 1..ind $danni.hero_magic(50, i - 1) if $start == true end else $danni.hero_magic(50, 0) if $start == true end end if @heal == true $game_player.animation_id = 15 $game_actors[1].hp += 200 @movimento_magia = false @heal = false end @magic_window.visible = false @magic_window.active = false @command_window.active = true end def refresh_item @item.dispose @item = nil @item = Item.new @command_window.dispose @s1 = "Attacca" s2 = "Magia" s3 = "Oggetti" s4 = "..." @command_window = Window_Command2.new(140, [@s1, s2, s3, s4]) @command_window.index = 0 @command_window.opacity = 160 @command_window.y = 480 - @command_window.height @command_window.index = 0 endend

×
×
  • Create New...