|
| Realisation volontaire de script !! | |
| |
Auteur | Message |
---|
shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Realisation volontaire de script !! Mer 13 Nov 2013 - 0:05 | |
| Bonjours. J'ouvre ce sujet dans le but d'aider les personnes qui ne trouvent pas leurs bonheurs dans les scripts déjà existant. Le principe est très simple, vous me décrivez plus ou moins précisément ce que vous voulez que le script fasse et je le fais, puis le partage. Réalisation de script de toutes les versions du RGSS. Ps: Je refuse de faire un CBS (custom battle system) car j'en ai déjà un en cour de codage. Ps2: Si des personnes souhaitent aussi participer et réaliser un script proposé il en a le droit à condition de le signaler. (c'est cool d'être plusieurs mais si on est 6 a faire le même script bah ... ça sert à rien ^^) Ps3: Pas sûr d'être dans la bonne section
Dernière édition par shin le Jeu 13 Mar 2014 - 13:24, édité 1 fois |
| | | Magicalichigo Ancienne staffeuse
Messages postés : 4252 Date d'inscription : 02/08/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Mer 13 Nov 2013 - 0:07 | |
| Oh c'est vraiment une super initiative ! J'espère que tu auras des propositions ! Je penserai à toi si j'ai besoin de quelque chose ! |
| | | Dhamma Metta Chevalier Dragon (niveau 5)
Messages postés : 1897 Date d'inscription : 22/06/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Mer 13 Nov 2013 - 0:16 | |
| Même si je ne me sers pas de script, merci pour les autres :p. Parcontre, si tu fais des cookies, je suis preneur! |
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Mer 13 Nov 2013 - 1:56 | |
| Super cool ça ! Si j'ai besoin je te demanderai surement tes services |
| | | Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Mer 13 Nov 2013 - 6:55 | |
| Hey, je déplace dans volontariat t'inquiètes. |
| | | Chaos17 Chevalier (niveau 2)
Messages postés : 90 Date d'inscription : 09/02/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Ven 15 Nov 2013 - 10:59 | |
| Salut,
Je souhaite un script qui me permettrai
1. d'afficher des raccourcis clavier en icones pour appeler des "menus" / systèmes sur l'écran. 2. ces icones ne doivent pas apparaitre pendant les dialogues (switch serait le bienvenu) 3. de me pemettre d'en ajouter ou retirer quand je veux de n'importe quel menu 4. de me permettre de choisir les touches du clavier à attribuer. 5. (optionel) de me laisser positioner les icones au cas où je créer un HUD perso. 6. Les icones se désactive automatiquement en combat
J'utiliser principalement les scripts de Yanfly. Ces scripts pourrait peut-être t'inspirer (ou t'en servir) : http://dekitarpg.wordpress.com/2013/03/28/d13x-key-menu/ http://dekitarpg.wordpress.com/2013/04/02/d13x-key-menu-hud/
Je n'utilise pas les scripts ci-dessus parce que je ne peux pas attacher les menus de mon choix pire ils bug même dans un nouveau projet. Bien entendu, tu seras libre le script distribuer publiquement.
Tu peux créer un nouveau script ou fixer les bugs des scripts ci-dessus. A toi de choisir. Bonne chance. |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Ven 15 Nov 2013 - 16:24 | |
| Ok je commence ça ce soir.
juste quelques petites questions:
-pour la présentation, tu veux comme c'est fais dans ton deuxième lien ou est ce que tu as autre chose en tête ??
-quand tu dis que tu veux pouvoir en ajouter ou enlever a ta guise tu veux dire à partir du script ou directement en jeux ??
-dans ton n°2 quand tu dis "switch serait le bienvenu" tu veux dire que dans certain dialogue tu voudrais l'afficher ?? |
| | | City Hunter Administrateur
Messages postés : 6524 Date d'inscription : 25/05/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Ven 15 Nov 2013 - 18:40 | |
| Ah bah tu te propose en volontariat ^^ Je pensais justement te démarcher par MP pour ^^"" Mais je n'ai pas eu le temps ahah Du coup, dans le WE... J'oublie pas XD Jviens vers toi ^^ Sinon c'est super cette petite idée Et pis tu es très compétent ^^ D'ailleurs, tu voudrais pas faire quelques initiations au script ? :p |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Ven 15 Nov 2013 - 18:50 | |
| - City Hunter a écrit:
- D'ailleurs, tu voudrais pas faire quelques initiations au script ? :p
C'est déjà prévue mais je sais pas vraiment par où commencer ni comment présenter ^^ |
| | | City Hunter Administrateur
Messages postés : 6524 Date d'inscription : 25/05/2011 Jauge LPC :
| | | | Chaos17 Chevalier (niveau 2)
Messages postés : 90 Date d'inscription : 09/02/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Sam 16 Nov 2013 - 10:07 | |
| - shin a écrit:
- -pour la présentation, tu veux comme c'est fais dans ton deuxième lien ou est ce que tu as autre chose en tête ??
Actuellement, non. Peut-être donner la possibilité aux gens de positionner l'HUD où ils veulent ? On a tous des gouts différents. - shin a écrit:
- -quand tu dis que tu veux pouvoir en ajouter ou enlever a ta guise tu veux dire à partir du script ou directement en jeux ??
Dans le script ^^ Une dernière chose (pas taper!) : avoir un switch pour désactiver pendant les dialogues. |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Sam 16 Nov 2013 - 20:15 | |
| Ok.
Je devrais l'avoir fini en milieux d'aprem.
édit: Et voila fini(plus tard que prévue), il seras poster dans quelque minutes. |
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 0:57 | |
| Hey Besoin d'un petit coup de main. Ça concerne le système de combat, pour lequel j'ai déjà mixer les scripts de Claimh pour l'interface et les damage pop, et ceux de MOG pour les damage chain et le système de combat en temps réel. Et je voudrai rajouter à tout ça le combat de côté avec le Yanfly core + Galv's animated battlers. Le problème est que Yanfly core gère l'UI et que j'aimerai seulement qu'il gère les combattant de côté, l'UI étant gérer par les script de Claimh avec lequel il rentre en conflit. Possible que le Yanfly core soit modifier ? |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 1:15 | |
| Ouaip c'est possible poste le script de yanfly et je te fais ça. |
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 1:36 | |
| Cool ! Voilà : http://yanflychannel.wordpress.com/rmvxa/core-scripts/ace-core-engine/ Merci merci !! |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 2:42 | |
| je l'ai fais un peu à la bourrin ^^ Dis moi si ça marche et si ce n'est pas le cas envoie le script de claimh aussi. - Code:
-
#============================================================================== # # ▼ Yanfly Engine Ace - Ace Core Engine v1.09 # -- Last Updated: 2012.02.19 # -- Level: Easy, Normal # -- Requires: n/a # #==============================================================================
$imported = {} if $imported.nil? $imported["YEA-CoreEngine"] = true
#============================================================================== # ▼ Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2012.02.19 - Bug Fixed: Parallax updating works properly with looping maps. # 2012.02.10 - Bug Fixed: Forced actions no longer cancel out other actions # that have been queued up for later. # 2012.01.08 - Font resets no longer reset bold and italic to off, but instead # to whatever default you've set. # 2011.12.26 - New Bugfix: When using substitute, allies will no longer take # place of low HP allies for friendly skills. # 2011.12.20 - New Bugfix: Force Action no longer cancels out an actor's queue. # Credits to Yami for finding and making the fix for! # Switch added for those who want removed forced action battlers. # 2011.12.15 - Updated for better menu gauge appearance. # 2011.12.10 - Bug Fixed: Right and bottom sides of the map would show # the left and top sides of the map. # - Bug Fixed: Viewport sizes didn't refresh from smaller maps. # 2011.12.07 - New Bugfix: Dual weapon normal attacks will now play both # animations without one animation interrupting the other. # 2011.12.04 - Updated certain GUI extensions for increased screen size. # - More efficient digit grouping method credits to TDS. # 2011.12.01 - Started Script and Finished. # #============================================================================== # ▼ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This is the core engine for Yanfly Engine Ace, made for RPG Maker VX Ace. # This script provides various changes made to the main engine including bug # fixes and GUI upgrades. # # ----------------------------------------------------------------------------- # Bug Fix: Animation Overlay # ----------------------------------------------------------------------------- # - It's the same bug from VX. When an all-screen animation is played against a # group of enemies, the animation bitmap is actually made multiple times, thus # causing a pretty extreme overlay when there are a lot of enemies on screen. # This fix will cause the animation to play only once. # # ----------------------------------------------------------------------------- # Bug Fix: Animation Interruption # ----------------------------------------------------------------------------- # - A new bug. When a character dual wields and attacks a single target, if an # animation lasts too long, it will interrupt and/or halt the next animation # from occurring. This script will cause the first animation to finish playing # and then continue forth. # # ----------------------------------------------------------------------------- # Bug Fix: Battle Turn Order Fix # ----------------------------------------------------------------------------- # - Same bug from VX. For those who use the default battle system, once a # turn's started, the action order for the turn becomes set and unchanged for # the remainder of that turn. Any changes to a battler's AGI will not be # altered at all even if the battler were to receive an AGI buff or debuff. # This fix will cause the speed to be updated properly upon each action. # # ----------------------------------------------------------------------------- # Bug Fix: Forced Action Fix # ----------------------------------------------------------------------------- # - A new bug. When a battler is forced to perform an action, the battler's # queued action is removed and the battler loses its place in battle. This # fix will resume queue after a forced action. # # ----------------------------------------------------------------------------- # Bug Fix: Gauge Overlap Fix # ----------------------------------------------------------------------------- # - Same bug from VX. When some values exceed certain amounts, gauges can # overextend past the width they were originally designed to fit in. This fix # will prevent any overextending from gauges. # # ----------------------------------------------------------------------------- # Bug Fix: Held L and R Menu Scrolling # ----------------------------------------------------------------------------- # - Before in VX, you can scroll through menus by holding down L and R buttons # (Q and W on the keyboard) to scroll through menus quickly. This fix will # re-enable the ability to scroll through menus in such a fashion. Disable it # in the module if you wish to. # # ----------------------------------------------------------------------------- # Bug Fix: Substitute Healing # ----------------------------------------------------------------------------- # If an actor has the substitute (cover) flag on them, they will attempt to # take the place of low HP allies when they're the target of attack. However, # this is also the case for friendly skills such as heal. This script will fix # it where if a battler targets an ally, no substitutes will take place. # # ----------------------------------------------------------------------------- # New Feature: Screen Resolution Size # ----------------------------------------------------------------------------- # - The screen can now be resized from 544x416 with ease and still support maps # that are smaller than 544x416. Maps smaller than 544x416 will be centered on # the screen without having sprites jumping all over the place. # # ----------------------------------------------------------------------------- # New Feature: Adjust Animation Speed # ----------------------------------------------------------------------------- # - RPG Maker VX Ace plays animations at a rate of 15 FPS by default. Speed up # the animations by changing a simple constant in the module. # # ----------------------------------------------------------------------------- # New Feature: GUI Modifications # ----------------------------------------------------------------------------- # - There are quite a lot of different modifications you can do to the GUI. # This includes placing outlines around your gauges, changing the colours of # each individual font aspect, and more. Also, you can change the default font # setting for your games here. # # ----------------------------------------------------------------------------- # New Feature: Numeric Digit Grouping # ----------------------------------------------------------------------------- # This will change various scenes to display numbers in groups where they are # separated by a comma every three digits. Thus, a number like 1234567 will # show up as 1,234,567. This allows for players to read numbers quicker. # # And that's all for the bug fixes and features! # #============================================================================== # ▼ Instructions # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # To install this script, open up your script editor and copy/paste this script # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save. # #============================================================================== # ▼ Compatibility # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that # it will run with RPG Maker VX without adjusting. # #==============================================================================
module YEA module CORE #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Screen Resolution Size - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # RPG Maker VX Ace has the option of having larger width and height for # your games. Resizing the width and height will have these changes: # # Default Resized Min Tiles Default Min Tiles New # Width 544 640 17 20 # Height 416 480 13 15 # # * Note: Maximum width is 640 while maximum height is 480. # Minimum width is 110 while maximum height is 10. # These are limitations set by RPG Maker VX Ace's engine. # # By selecting resize, all of the default menus will have their windows # adjusted, but scripts provided by non-Yanfly Engine sources may or may # not adjust themselves properly. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- RESIZE_WIDTH = 640 RESIZE_HEIGHT = 416 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Adjust Animation Speed - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # By default, the animation speed played in battles operates at 15 FPS # (frames per second). For those who would like to speed it up, change this # constant to one of these values: # RATE Speed # 4 15 fps # 3 20 fps # 2 30 fps # 1 60 fps #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ANIMATION_RATE = 3 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Digit Grouping - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Setting this to true will cause numbers to be grouped together when they # are larger than a thousand. For example, 12345 will appear as 12,345. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- GROUP_DIGITS = true #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Font Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Adjust the default font settings for your game here. The various settings # will be explained below. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- FONT_NAME = ["VL Gothic", "Verdana", "Arial", "Courier"] # This adjusts the fonts used for your game. If the font at the start of # the array doesn't exist on the player's computer, it'll use the next one. FONT_SIZE = 24 # Adjusts font size. Default: 24 FONT_BOLD = false # Makes font bold. Default: false FONT_ITALIC = false # Makes font italic. Default: false FONT_SHADOW = false # Gives font a shadow. Default: false FONT_OUTLINE = true # Gives font an outline. Default: true FONT_COLOUR = Color.new(255, 255, 255, 255) # Default: 255, 255, 255, 255 FONT_OUTLINE_COLOUR = Color.new(0, 0, 0, 128) # Default: 0, 0, 0, 128 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Forced Action Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # For those who would like to allow the game to remove a forced action # battler from the queue list, use the switch below. If you don't want to # use this option, set the switch ID to 0. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- FORCED_ACTION_REMOVE_SWITCH = 0 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Gauge Appearance Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # You can modify the way your gauges appear in the game. If you wish for # them to have an outline, it's possible. You can also adjust the height # of the gauges, too. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- GAUGE_OUTLINE = true GAUGE_HEIGHT = 12 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Held L and R Menu Scrolling - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # VX gave the ability to scroll through menus quickly through holding the # L and R buttons (Q and W on the keyboard). VX Ace disabled it. Now, you # can re-enable the ability to scroll faster by setting this constant to # true. To disable it, set this constant to false. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- QUICK_SCROLLING = true #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - System Text Colours - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Sometimes the system text colours are boring as just orange for HP, blue # for MP, and green for TP. Change the values here. Each number corresponds # to the colour index of the Window.png skin found in Graphics\System. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- COLOURS ={ # :text => ID :normal => 0, # Default: 0 :system => 16, # Default: 16 :crisis => 17, # Default: 17 :knockout => 18, # Default: 18 :gauge_back => 19, # Default: 19 :hp_gauge1 => 28, # Default: 20 :hp_gauge2 => 29, # Default: 21 :mp_gauge1 => 22, # Default: 22 :mp_gauge2 => 23, # Default: 23 :mp_cost => 23, # Default: 23 :power_up => 24, # Default: 24 :power_down => 25, # Default: 25 :tp_gauge1 => 10, # Default: 28 :tp_gauge2 => 2, # Default: 29 :tp_cost => 2, # Default: 29 } # Do not remove this. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - System Text Options - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Here, you can adjust the transparency used for disabled items, the % # needed for HP and MP to enter "crisis" mode. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TRANSPARENCY = 160 # Adjusts transparency of disabled items. Default: 160 HP_CRISIS = 0.25 # When HP is considered critical. Default: 0.25 MP_CRISIS = 0.25 # When MP is considered critical. Default: 0.25 ITEM_AMOUNT = "×%s" # The prefix used for item amounts. end # CORE end # YEA
#============================================================================== # ▼ Editting anything past this point may potentially result in causing # computer damage, incontinence, explosion of user's head, coma, death, and/or # halitosis so edit at your own risk. #==============================================================================
Graphics.resize_screen(YEA::CORE::RESIZE_WIDTH, YEA::CORE::RESIZE_HEIGHT) Font.default_name = YEA::CORE::FONT_NAME Font.default_size = YEA::CORE::FONT_SIZE Font.default_bold = YEA::CORE::FONT_BOLD Font.default_italic = YEA::CORE::FONT_ITALIC Font.default_shadow = YEA::CORE::FONT_SHADOW Font.default_outline = YEA::CORE::FONT_OUTLINE Font.default_color = YEA::CORE::FONT_COLOUR Font.default_out_color = YEA::CORE::FONT_OUTLINE_COLOUR
#============================================================================== # ■ Numeric #==============================================================================
class Numeric #-------------------------------------------------------------------------- # new method: group_digits #-------------------------------------------------------------------------- def group return self.to_s unless YEA::CORE::GROUP_DIGITS self.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2') end end # Numeric
#============================================================================== # ■ Switch #==============================================================================
module Switch #-------------------------------------------------------------------------- # self.forced_action_remove #-------------------------------------------------------------------------- def self.forced_action_remove return false if YEA::CORE::FORCED_ACTION_REMOVE_SWITCH <= 0 return $game_switches[YEA::CORE::FORCED_ACTION_REMOVE_SWITCH] end end # Switch
#============================================================================== # ■ BattleManager #==============================================================================
module BattleManager #-------------------------------------------------------------------------- # overwrite method: turn_start #-------------------------------------------------------------------------- def self.turn_start @phase = :turn clear_actor $game_troop.increase_turn @performed_battlers = [] make_action_orders end #-------------------------------------------------------------------------- # overwrite method: next_subject #-------------------------------------------------------------------------- def self.next_subject @performed_battlers = [] if @performed_battlers.nil? loop do @action_battlers -= @performed_battlers battler = @action_battlers.shift return nil unless battler next unless battler.index && battler.alive? @performed_battlers.push(battler) return battler end end #-------------------------------------------------------------------------- # overwrite method: force_action #-------------------------------------------------------------------------- def self.force_action(battler) @action_forced = [] if @action_forced == nil @action_forced.push(battler) return unless Switch.forced_action_remove @action_battlers.delete(battler) end #-------------------------------------------------------------------------- # overwrite method: action_forced? #-------------------------------------------------------------------------- def self.action_forced? @action_forced != nil end #-------------------------------------------------------------------------- # overwrite method: action_forced_battler #-------------------------------------------------------------------------- def self.action_forced_battler @action_forced.shift end #-------------------------------------------------------------------------- # overwrite method: clear_action_force #-------------------------------------------------------------------------- def self.clear_action_force @action_forced = nil if @action_forced.empty? end end # BattleManager
#============================================================================== # ■ Game_Battler #==============================================================================
class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :pseudo_ani_id #-------------------------------------------------------------------------- # alias method: clear_sprite_effects #-------------------------------------------------------------------------- alias game_battler_clear_sprite_effects_ace clear_sprite_effects def clear_sprite_effects game_battler_clear_sprite_effects_ace @pseudo_ani_id = 0 end #-------------------------------------------------------------------------- # alias method: force_action #-------------------------------------------------------------------------- alias game_battler_force_action_ace force_action def force_action(skill_id, target_index) clone_current_actions game_battler_force_action_ace(skill_id, target_index) end #-------------------------------------------------------------------------- # new method: clone_current_actions #-------------------------------------------------------------------------- def clone_current_actions @cloned_actions = @actions.dup end #-------------------------------------------------------------------------- # new method: restore_cloned_actions #-------------------------------------------------------------------------- def restore_cloned_actions return if @cloned_actions.nil? @actions = @cloned_actions.dup @cloned_actions = nil end #-------------------------------------------------------------------------- # alias method: on_action_end #-------------------------------------------------------------------------- alias game_battler_on_action_end_ace on_action_end def on_action_end game_battler_on_action_end_ace restore_cloned_actions end #-------------------------------------------------------------------------- # alias method: on_battle_end #-------------------------------------------------------------------------- alias game_battler_on_battle_end_ace on_battle_end def on_battle_end game_battler_on_battle_end_ace @cloned_actions = nil end end # Game_Battler
#============================================================================== # ■ Game_Troop #==============================================================================
class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # overwrite method: setup #-------------------------------------------------------------------------- def setup(troop_id) clear @troop_id = troop_id @enemies = [] troop.members.each do |member| next unless $data_enemies[member.enemy_id] enemy = Game_Enemy.new(@enemies.size, member.enemy_id) enemy.hide if member.hidden enemy.screen_x = member.x + (Graphics.width - 544)/2 enemy.screen_y = member.y + (Graphics.height - 416) @enemies.push(enemy) end init_screen_tone make_unique_names end end # Game_Troop
#============================================================================== # ■ Game_Map #==============================================================================
class Game_Map #-------------------------------------------------------------------------- # overwrite method: scroll_down #-------------------------------------------------------------------------- def scroll_down(distance) if loop_vertical? @display_y += distance @display_y %= @map.height * 256 @parallax_y += distance if @parallax_loop_y else last_y = @display_y dh = Graphics.height > height * 32 ? height : screen_tile_y @display_y = [@display_y + distance, height - dh].min @parallax_y += @display_y - last_y end end #-------------------------------------------------------------------------- # overwrite method: scroll_right #-------------------------------------------------------------------------- def scroll_right(distance) if loop_horizontal? @display_x += distance @display_x %= @map.width * 256 @parallax_x += distance if @parallax_loop_x else last_x = @display_x dw = Graphics.width > width * 32 ? width : screen_tile_x @display_x = [@display_x + distance, width - dw].min @parallax_x += @display_x - last_x end end end # Game_Map
#============================================================================== # ■ Game_Event #==============================================================================
class Game_Event < Game_Character #-------------------------------------------------------------------------- # overwrite method: near_the_screen? #-------------------------------------------------------------------------- def near_the_screen?(dx = nil, dy = nil) dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil? dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil? ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32 ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32 ax >= -dx && ax <= dx && ay >= -dy && ay <= dy end end # Game_Event
#============================================================================== # ■ Sprite_Base #==============================================================================
class Sprite_Base < Sprite #-------------------------------------------------------------------------- # overwrite method: set_animation_rate #-------------------------------------------------------------------------- def set_animation_rate @ani_rate = YEA::CORE::ANIMATION_RATE end #-------------------------------------------------------------------------- # new method: start_pseudo_animation #-------------------------------------------------------------------------- def start_pseudo_animation(animation, mirror = false) dispose_animation @animation = animation return if @animation.nil? @ani_mirror = mirror set_animation_rate @ani_duration = @animation.frame_max * @ani_rate + 1 @ani_sprites = [] end end # Sprite_Base
#============================================================================== # ■ Sprite_Battler #==============================================================================
class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # alias method: setup_new_animation #-------------------------------------------------------------------------- alias sprite_battler_setup_new_animation_ace setup_new_animation def setup_new_animation sprite_battler_setup_new_animation_ace return if @battler.nil? return if @battler.pseudo_ani_id.nil? return if @battler.pseudo_ani_id <= 0 animation = $data_animations[@battler.pseudo_ani_id] mirror = @battler.animation_mirror start_pseudo_animation(animation, mirror) @battler.pseudo_ani_id = 0 end end # Sprite_Battler
#============================================================================== # ■ Spriteset_Map #==============================================================================
class Spriteset_Map #-------------------------------------------------------------------------- # overwrite method: create_viewports #-------------------------------------------------------------------------- def create_viewports if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal? dx = (Graphics.width - $game_map.width * 32) / 2 else dx = 0 end dw = [Graphics.width, $game_map.width * 32].min dw = Graphics.width if $game_map.loop_horizontal? if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical? dy = (Graphics.height - $game_map.height * 32) / 2 else dy = 0 end dh = [Graphics.height, $game_map.height * 32].min dh = Graphics.height if $game_map.loop_vertical? @viewport1 = Viewport.new(dx, dy, dw, dh) @viewport2 = Viewport.new(dx, dy, dw, dh) @viewport3 = Viewport.new(dx, dy, dw, dh) @viewport2.z = 50 @viewport3.z = 100 end #-------------------------------------------------------------------------- # new method: update_viewport_sizes #-------------------------------------------------------------------------- def update_viewport_sizes if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal? dx = (Graphics.width - $game_map.width * 32) / 2 else dx = 0 end dw = [Graphics.width, $game_map.width * 32].min dw = Graphics.width if $game_map.loop_horizontal? if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical? dy = (Graphics.height - $game_map.height * 32) / 2 else dy = 0 end dh = [Graphics.height, $game_map.height * 32].min dh = Graphics.height if $game_map.loop_vertical? rect = Rect.new(dx, dy, dw, dh) for viewport in [@viewport1, @viewport2, @viewport3] viewport.rect = rect end end end # Spriteset_Map
#============================================================================== # ■ Window_Selectable #==============================================================================
class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # overwrite method: process_cursor_move #-------------------------------------------------------------------------- if YEA::CORE::QUICK_SCROLLING def process_cursor_move return unless cursor_movable? last_index = @index cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) cursor_pagedown if !handle?(:pagedown) && Input.repeat?(:R) cursor_pageup if !handle?(:pageup) && Input.repeat?(:L) Sound.play_cursor if @index != last_index end end # YEA::CORE::QUICK_SCROLLING end # Window_Selectable
#============================================================================== # ■ Window_ItemList #==============================================================================
class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] return if item.nil? rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24) draw_item_number(rect, item) end #-------------------------------------------------------------------------- # overwrite method: draw_item_number #-------------------------------------------------------------------------- def draw_item_number(rect, item) text = sprintf(YEA::CORE::ITEM_AMOUNT, $game_party.item_number(item).group) draw_text(rect, text, 2) end end # Window_ItemList
#============================================================================== # ■ Window_SkillList #==============================================================================
class Window_SkillList < Window_Selectable #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] return if skill.nil? rect = item_rect(index) rect.width -= 4 draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24) draw_skill_cost(rect, skill) end end # Window_SkillList
#============================================================================== # ■ Window_Status #==============================================================================
class Window_Status < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_exp_info #-------------------------------------------------------------------------- def draw_exp_info(x, y) s1 = @actor.max_level? ? "-------" : @actor.exp s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp s_next = sprintf(Vocab::ExpNext, Vocab::level) change_color(system_color) draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal) draw_text(x, y + line_height * 2, 180, line_height, s_next) change_color(normal_color) s1 = s1.group if s1.is_a?(Integer) s2 = s2.group if s2.is_a?(Integer) draw_text(x, y + line_height * 1, 180, line_height, s1, 2) draw_text(x, y + line_height * 3, 180, line_height, s2, 2) end end # Window_Status
#============================================================================== # ■ Window_ShopBuy #==============================================================================
class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] rect = item_rect(index) draw_item_name(item, rect.x, rect.y, enable?(item)) rect.width -= 4 draw_text(rect, price(item).group, 2) end end # Window_ShopBuy
#============================================================================== # ■ Scene_Map #==============================================================================
class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # alias method: post_transfer #-------------------------------------------------------------------------- alias scene_map_post_transfer_ace post_transfer def post_transfer @spriteset.update_viewport_sizes scene_map_post_transfer_ace end end # Scene_Map
#============================================================================== # ■ Scene_Battle #==============================================================================
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # alias method: check_substitute #-------------------------------------------------------------------------- alias scene_battle_check_substitute_ace check_substitute def check_substitute(target, item) return false if @subject.actor? == target.actor? return scene_battle_check_substitute_ace(target, item) end #-------------------------------------------------------------------------- # overwrite method: process_forced_action #-------------------------------------------------------------------------- def process_forced_action while BattleManager.action_forced? last_subject = @subject @subject = BattleManager.action_forced_battler process_action @subject = last_subject BattleManager.clear_action_force end end #-------------------------------------------------------------------------- # overwrite method: show_attack_animation #-------------------------------------------------------------------------- def show_attack_animation(targets) if @subject.actor? show_normal_animation(targets, @subject.atk_animation_id1, false) wait_for_animation show_normal_animation(targets, @subject.atk_animation_id2, true) else Sound.play_enemy_attack abs_wait_short end end #-------------------------------------------------------------------------- # overwrite method: show_normal_animation #-------------------------------------------------------------------------- def show_normal_animation(targets, animation_id, mirror = false) animation = $data_animations[animation_id] return if animation.nil? ani_check = false targets.each do |target| if ani_check && target.animation_id <= 0 target.pseudo_ani_id = animation_id else target.animation_id = animation_id end target.animation_mirror = mirror abs_wait_short unless animation.to_screen? ani_check = true if animation.to_screen? end abs_wait_short if animation.to_screen? end end # Scene_Battle
#============================================================================== # # ▼ End of File # #============================================================================== |
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 11:13 | |
| Alors les personnages animés sont bien apparus sur le côté c'est parfait, en revanche les images des personnages dans l'UI ont disparut. J'ai essayé de changer de nom dans l'appel des personnages de l'UI mais rien y fait. Voici le code de Claimh, du moins une partie : - Code Claimh:
#============================================================================== # ■ VXAce-RGSS3-21 フロントビュー改2 [Ver.1.1.1] by Claimh #------------------------------------------------------------------------------ # ・バトラーを使った戦闘画面に改変します。 #------------------------------------------------------------------------------ #【デフォルトからの変更箇所】 # <バトルステータス> # + バトラー表示に変更 # + ウィンドウは撤廃 # + HP/MP/TPの表示を画像表示した # + ステート表示をルーレット化 # + アクションIconの表示追加 # <コマンドウィドウ> # + パーティーコマンドウィンドウを画面上部に変更 # + アクターコマンドウィンドウ表示位置をバトラー上に変更 # (アクターコマンドは3パターンの表示形式を用意) # <アニメーション> # + 敵キャラの攻撃アニメーションを追加(メモ欄) # + 全体アニメーション時の表示位置を敵味方で区別 # <ダメージ表示> # + ダメージポップを追加 # (HP/MP/TPの非ダメージ・回復時に表示。ターン回復系では表示しない) # + 敵キャラ側の非ダメージ・回復時にゲージ表示を追加 #------------------------------------------------------------------------------ #【メモ欄 仕様】 # ・エネミーの攻撃アニメーション # [ 場所 ] 敵キャラのメモ欄 # [ 表記 ] # @atk_a1[アニメーションID] : 攻撃アニメーション1 # @atk_a2[アニメーションID] : 攻撃アニメーション2(反転) #------------------------------------------------------------------------------ #【画像素材規格】 # ・バトラー画像 # [Import] Graphics/Battlers # [File名] ActorN (N…アクターIDの数字) # [サイズ] 任意(推奨 : 160×169ぐらい) # ・HP/MP/TP/Actの画像 # [Import] Graphics/System # [File名] bt_text # [サイズ] 24×52 (1行の高さ : 13) # [ 内容 ] 上から HP, MP, TP, Act の順で配置 # ・数字ピクチャ # [Import] Graphics/System # [File名] number # [サイズ] 任意 (140×72など) # [ 内容 ] 上から 通常, ピンチ, 瀕死, 回復 の順で配置 # 0..9の数字を均等に並べる # ・ダメージMiss表示用ピクチャ # [Import] Graphics/System # [File名] Miss # [サイズ] 任意(42×17など) # ・ダメージEvade表示用ピクチャ # [Import] Graphics/System # [File名] Evade # [サイズ] 任意(42×17など) # ・HP/MP/TP用ゲージ # [Import] Graphics/System # [File名] guage # [サイズ] 24×52 (1行の高さ : 13) # [ 内容 ] 上から ゲージ背景, HP用ゲージ, MP用ゲージ, TP用ゲージ の順で配置 # ・ターゲット表示用Arrow # [Import] Graphics/System # [File名] Arrow # [サイズ] 128×32 (32×32を4つ) # [ 内容 ] 左→右方向へアニメーションするアロー画像を4つ配置 #==============================================================================
module BtlrFv #============================================================================== # ■ 表示設定 #============================================================================== # ステート描画にルーレット表示を使う USE_ROULET_ST = true
# Actionアイコン表示あり USE_ACTION_ICN = true
# LevelUp時のSE LVUP_SE = RPG::SE.new("Flash2")
# Actionアイコン/ルーレットステート 背景塗りつぶし色 BACK_COLOR = Color.new(0,0,0,128)
#============================================================================== # ■ 戦闘コマンド設定 #============================================================================== #-------------------------------------------------------------------------- # ● 戦闘コマンドタイプ # 0 : デフォルトウィンドウ # 1 : ワイドアイコンコマンド # 2 : リッチアクターコマンド #-- ------------------------------------------------------------------------ CMD_WIN = 2
#============================================================================== # ■ ダメージポップ設定 #============================================================================== # ポップ位置 # 0 : ランダム # 1 : 頭上 DMGPOP_POS = 0 # HP/MP/TP表記を追加する ADD_DMG_TYPE = true end
module BtlrFv #-------------------------------------------------------------------------- # ● バトル画面 X 座標の取得 #-------------------------------------------------------------------------- def self.screen_x(index) w = Graphics.width / $game_party.battle_members.size index * w + w / 2 end #-------------------------------------------------------------------------- # ● HP/MP/TP/Act文字ピクチャ #-------------------------------------------------------------------------- def self.bt_txt Cache.system("bt_text") end #-------------------------------------------------------------------------- # ● 数字ピクチャ #-------------------------------------------------------------------------- def self.number Cache.system("number") end #-------------------------------------------------------------------------- # ● ゲージピクチャ #-------------------------------------------------------------------------- def self.guage Cache.system("guage") end end
#============================================================================== # ■ RPG::Enemy #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーションあり #-------------------------------------------------------------------------- def use_atk_animation? (atk_animation_id1 != 0 or atk_animation_id2 != 0) end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得 #-------------------------------------------------------------------------- def atk_animation_id1 result = @note.scan(/@atk_a1\[(\d+)\]/)[0] return (result.nil? ? 0 : result[0].to_i) end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2) #-------------------------------------------------------------------------- def atk_animation_id2 result = @note.scan(/@atk_a2\[(\d+)\]/)[0] return (result.nil? ? 0 : result[0].to_i) end end
#============================================================================== # ■ Game_Battler #============================================================================== class Game_BattlerBase attr_accessor :fv_prm # 戦闘時のパラメータ更新クラス attr_accessor :dmgpop # 戦闘時のダメージポップ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias init_xpbtfvb initialize def initialize init_xpbtfvb @fv_prm = FveiwObjHpMpTp.new(self) @dmgpop = FvDmgPop.new end end
#============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler < Game_BattlerBase attr_accessor :r_st # 戦闘時のステートルーレット #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias init_xpbtfvc initialize def initialize init_xpbtfvc @r_st = FvRouletStates.new(self) end end
#============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 戦闘アイコン取得 #-------------------------------------------------------------------------- def act_icon return 0 if current_action.nil? or current_action.item.nil? if current_action.attack? ws = weapons return ws[0].icon_index unless ws.empty? end current_action.item.icon_index end #-------------------------------------------------------------------------- # ● スプライトを使うか? [再定義] #-------------------------------------------------------------------------- def use_sprite? true end #-------------------------------------------------------------------------- # ● 経験値の獲得(経験獲得率を考慮) [再定義] #-------------------------------------------------------------------------- def gain_exp(exp, show=true) change_exp(self.exp + (exp * final_exp_rate).to_i, show) end #-------------------------------------------------------------------------- # ● バトル画面 X 座標の取得 #-------------------------------------------------------------------------- def screen_x BtlrFv.screen_x(index) end #-------------------------------------------------------------------------- # ● バトル画面 Y 座標の取得 #-------------------------------------------------------------------------- def screen_y Graphics.height end #-------------------------------------------------------------------------- # ● バトル画面 Z 座標の取得 #-------------------------------------------------------------------------- def screen_z return 100 end #-------------------------------------------------------------------------- # ● 戦闘グラフィック ファイル名 #-------------------------------------------------------------------------- def battler_name return "actor#{@actor_id}" end #-------------------------------------------------------------------------- # ● 戦闘グラフィック 色相 #-------------------------------------------------------------------------- def battler_hue return 0 end end
#============================================================================== # ■ Game_Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● 攻撃アニメーションあり #-------------------------------------------------------------------------- def use_atk_animation? enemy.use_atk_animation? end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得 #-------------------------------------------------------------------------- def atk_animation_id1 enemy.atk_animation_id1 end #-------------------------------------------------------------------------- # ● 通常攻撃 アニメーション ID の取得(二刀流:武器2) #-------------------------------------------------------------------------- def atk_animation_id2 enemy.atk_animation_id2 end end
#============================================================================== # ■ Game_Unit #============================================================================== class Game_Unit #-------------------------------------------------------------------------- # ● 戦闘開始処理 #-------------------------------------------------------------------------- alias on_battle_start_fv on_battle_start def on_battle_start on_battle_start_fv members.each {|member| member.fv_prm.battle_start } end #-------------------------------------------------------------------------- # ● 戦闘終了処理 #-------------------------------------------------------------------------- alias on_battle_end_fv on_battle_end def on_battle_end on_battle_end_fv members.each {|member| member.fv_prm.battle_end } end end
#============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● アクターを加える #-------------------------------------------------------------------------- alias add_actor_fv add_actor def add_actor(actor_id) add_actor_fv(actor_id) $game_actors[actor_id].fv_prm.battle_start if in_battle end #-------------------------------------------------------------------------- # ● アクターを外す #-------------------------------------------------------------------------- alias remove_actor_fv remove_actor def remove_actor(actor_id) $game_actors[actor_id].fv_prm.battle_end if in_battle remove_actor_fv(actor_id) end end
#============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● アクタースプライトの更新 #-------------------------------------------------------------------------- alias update_actors_fvdmg update_actors def update_actors @actor_sprites.each_with_index do |sprite, i| sprite.dmg.battler = $game_party.members[i] end update_actors_fvdmg end end
#============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ● アニメーションの原点設定 [override] #-------------------------------------------------------------------------- def set_animation_origin if @animation.position == 3 # アニメーション[画面] のときの座標変更 @ani_ox = viewport.rect.width / 2 yy = viewport.rect.height / 5 @ani_oy = @battler.actor? ? (yy * 4) : (yy * 2) else @ani_ox = x - ox + width / 2 @ani_oy = y - oy + height / 2 if @animation.position == 0 @ani_oy -= height / 2 elsif @animation.position == 2 @ani_oy += height / 2 end end end end
EDIT : Genre passer les personnage de l'UI en médaillon 1,2 et 3 dans système pour les intégrer un maximum dans l'interface. |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 14:22 | |
| T'as vérifier que dans ton que tes battler s’appel bien actor1, actor2... ?? Et mets les battlers dans le dossier picture et battler. Normalement il ne devrais pas avoir de problème.
|
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 14:37 | |
| Alors oui les "actor" étaient au bon endroit puisque je les utilisais avant de vouloir mettre les combattant latéral. J'ai doublé le coup dans "picture" comme tu m'a dit. Rien ne change, par contre la fenêtre d'action en mode roulette a suivis les battlers latéraux, alors que j'aimerai qu'elle reste sur les image de l'UI. Compliqué >.< |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 14:45 | |
| Envoi moi tous ce qui touche au combats à mon avis y'a pas que le yanfly et le claimh qui font tout beuguer ^^ |
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 14:57 | |
| Les 5 premiers, sur les 20 (mais tu en a déjà deux) - zoom battle back:
#============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● ズーム倍率計算 #-------------------------------------------------------------------------- def calc_zoom(bitmap) x_zoom = Graphics.width * 1.0 / bitmap.width y_zoom = Graphics.height * 1.0 / bitmap.height x_zoom > y_zoom ? x_zoom : y_zoom end #-------------------------------------------------------------------------- # ● スプライトを画面中央に移動 [再定義] #-------------------------------------------------------------------------- alias center_sprite_zoombk center_sprite def center_sprite(sprite) center_sprite_zoombk(sprite) sprite.zoom_x = sprite.zoom_y = calc_zoom(sprite.bitmap) end end
- windows_BtArrowHelp:
#============================================================================== # ■ Window_BtArrowHelp #============================================================================== class Window_BtArrowHelp < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, Graphics.width, fitting_height(1)) self.openness = 0 end #-------------------------------------------------------------------------- # ● バトラー設定 #-------------------------------------------------------------------------- def set_battler(battler, height) if battler != @battler @battler = battler w = contents.text_size(@battler.name).width self.width = w + standard_padding * 2 create_contents refresh update_position(height) self.openness = 0 open end end #-------------------------------------------------------------------------- # ● 表示位置 #-------------------------------------------------------------------------- def update_position(height) xx = [0, @battler.screen_x - self.width / 2].max yy = [0, @battler.screen_y - height - self.height ].max self.x = [xx, Graphics.width - self.width ].min self.y = [yy, Graphics.height - self.height].min end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear contents.clear @battler = nil self end #-------------------------------------------------------------------------- # ● リフレッシュ(バトラーステータス) #-------------------------------------------------------------------------- def refresh contents.clear draw_text(0, 0, contents.width, line_height, @battler.name, 1) # draw_battler_states end #-------------------------------------------------------------------------- # ● ステート描画 #-------------------------------------------------------------------------- def draw_battler_states w = contents.text_size(@battler.name).width + 4 draw_actor_icons(@battler, w, 0) end end
- Windows_PartyCommand:
#============================================================================== # ■ Window_PartyCommand #------------------------------------------------------------------------------ # バトル画面で、戦うか逃げるかを選択するウィンドウです。 #==============================================================================
class Window_PartyHorzCommand < Window_HorzCommand #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0) self.openness = 10 deactivate end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max item_max end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::fight, :fight) add_command(Vocab::escape, :escape, BattleManager.can_escape?) end #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- def setup clear_command_list make_command_list refresh select(0) activate open end end
- Windows_FvBtResult:
#============================================================================== # ■ FvBtResult #============================================================================== class FvBtResult attr_reader :exp attr_reader :gold attr_reader :items attr_reader :actors #-------------------------------------------------------------------------- # ● オブジェクト初期化 # items : 獲得アイテム #-------------------------------------------------------------------------- def initialize(items) @exp = FveiwNumUpdate.new(60) @gold = FveiwNumUpdate.new(60) @exp.target($game_troop.exp_total) @gold.target($game_troop.gold_total) @items = FvBtRsltItems.new(items) @actors = $game_party.battle_members.collect {|a| FvBtRsltActor.new(a) } end #-------------------------------------------------------------------------- # ● EXP設定 #-------------------------------------------------------------------------- def set_exp @actors.each {|a| a.set_exp } end #-------------------------------------------------------------------------- # ● 終了判定 #-------------------------------------------------------------------------- def exit? @exp.exit? and @gold.exit? and @actors.all? {|a| a.exp.exit? } end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update @exp.count @gold.count @actors.each {|a| a.exp.count } end #-------------------------------------------------------------------------- # ● 終端へ #-------------------------------------------------------------------------- def finish @exp.finish @gold.finish @actors.each {|a| a.exp.finish } end end #============================================================================== # ■ FvBtRsltItems #============================================================================== class FvBtRsltItems #-------------------------------------------------------------------------- # ● オブジェクト初期化 # items : アイテム #-------------------------------------------------------------------------- def initialize(items) @items = [] items.each do |itm| same_item = false @items.each do |i| if i.item == itm i.add same_item = true break end end @items.push(FvBtRsltItem.new(itm)) unless same_item end end #-------------------------------------------------------------------------- # ● イテレータ #-------------------------------------------------------------------------- def each_index @items.each_index {|item| yield item } if block_given? end #-------------------------------------------------------------------------- # ● オブジェクト参照 #-------------------------------------------------------------------------- def [](n) @items[n] end #============================================================================ # ■ FvBtRsltItem #============================================================================ class FvBtRsltItem attr_reader :item # アイテム attr_reader :num # 個数 #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ def initialize(item) @item = item @num = 1 end #------------------------------------------------------------------------ # ● 加算 #------------------------------------------------------------------------ def add @num += 1 end end end #============================================================================== # ■ FvBtRsltActor #============================================================================== class FvBtRsltActor attr_reader :actor attr_reader :exp attr_reader :old_level #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター # exp : 獲得Exp #-------------------------------------------------------------------------- def initialize(actor) @actor = actor @old_level = actor.level @exp = FveiwNumUpdate.new(60) @exp.reset(actor.exp) end #-------------------------------------------------------------------------- # ● EXP設定 #-------------------------------------------------------------------------- def set_exp @exp.target(@actor.exp) @new_level = @actor.level end #-------------------------------------------------------------------------- # ● レベルアップ判定 #-------------------------------------------------------------------------- def levelup? @old_level < @new_level end end
#============================================================================== # ■ Window_FvBtResult #============================================================================== class Window_FvBtResult < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, Graphics.width, fitting_height(5 * 2)) @result = nil deactivate.hide end #-------------------------------------------------------------------------- # ● リザルト設定 #-------------------------------------------------------------------------- def set_result(result) @result = result activate.show.refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_area_basic draw_line(0, line_height * 2 + 11, 230) draw_area_items draw_area_actors end #-------------------------------------------------------------------------- # ● リフレッシュ [数値のみ] #-------------------------------------------------------------------------- def refresh_num redraw_area_basic_num if !@result.exp.exit? or !@result.gold.exit? redraw_area_actors_num if !@result.actors.all? {|a| a.exp.exit?} end #-------------------------------------------------------------------------- # ● ライン色を取得 #-------------------------------------------------------------------------- def line_color color = normal_color color.alpha = 48 color end #-------------------------------------------------------------------------- # ● ライン描画 #-------------------------------------------------------------------------- def draw_line(x, y, width, height=2) contents.fill_rect(x, y, width, height, line_color) end #-------------------------------------------------------------------------- # ● EXP/Goldエリア #-------------------------------------------------------------------------- def rect_basic Rect.new(0, 0, 100, line_height * 2) end #-------------------------------------------------------------------------- # ● EXP/Goldエリア [数値] #-------------------------------------------------------------------------- def rect_basic_num r = rect_basic r.x = r.width r.width = 130 r end #-------------------------------------------------------------------------- # ● EXP/Goldエリア描画 #-------------------------------------------------------------------------- def draw_area_basic r = rect_basic change_color(system_color) draw_text(r.x, r.y , r.width, line_height, "獲得Exp") draw_text(r.x, r.y + line_height, r.width, line_height, "獲得Gold") draw_area_basic_num(rect_basic_num) end #-------------------------------------------------------------------------- # ● EXP/Goldエリア描画 [数値のみ] #-------------------------------------------------------------------------- def draw_area_basic_num(r) if 1 draw_text(r.x, r.y , r.width, line_height, @result.exp.current, 2) draw_text(r.x, r.y + line_height, r.width, line_height, @result.gold.current, 2) else draw_nums_picture(r.x, r.y , r.width, @result.exp.current) draw_nums_picture(r.x, r.y + line_height, r.width, @result.gold.current) end end #-------------------------------------------------------------------------- # ● EXP/Goldエリア再描画 [数値のみ] #-------------------------------------------------------------------------- def redraw_area_basic_num r = rect_basic_num contents.clear_rect(r) draw_area_basic_num(r) end #-------------------------------------------------------------------------- # ● Itemエリア #-------------------------------------------------------------------------- def rect_item r = rect_basic r.y = r.height + line_height r.height = contents_height - r.height r.width += rect_basic_num.width r end #-------------------------------------------------------------------------- # ● Itemエリア描画 #-------------------------------------------------------------------------- def draw_area_items r = rect_item change_color(system_color) draw_text(r.x, r.y, r.width, line_height, "獲得アイテム") change_color(normal_color) @result.items.each_index do |i| r.y += line_height draw_item_name(@result.items[i].item, r.x, r.y) draw_text(r.x + 170, r.y, 18, line_height, "×", 2) draw_text(r.x + 188, r.y, 36, line_height, @result.items[i].num, 2) end end #-------------------------------------------------------------------------- # ● Actorsエリア #-------------------------------------------------------------------------- def rect_actor(i) r = rect_basic_num r.x += r.width + 50 r.width = contents_width - r.x r.height = line_height r.y = (line_height * 2) * i r end #-------------------------------------------------------------------------- # ● Actorsエリア [数値のみ] #-------------------------------------------------------------------------- def rect_actor_exp(i) r = rect_actor(i) r.x += 30 r.y += line_height r.width = 100 r.height = line_height r end def rect_actor_num(i) r = rect_actor_exp(i) r.x += r.width r.width = contents_width - r.x r end #-------------------------------------------------------------------------- # ● Actorsエリア描画 #-------------------------------------------------------------------------- def draw_area_actors @result.actors.each_index {|i| draw_area_actor(i)} end #-------------------------------------------------------------------------- # ● Actorsエリア再描画 [数値のみ] #-------------------------------------------------------------------------- def redraw_area_actors_num @result.actors.each_index {|i| redraw_area_actor_num(i)} end #-------------------------------------------------------------------------- # ● Actorエリア描画 #-------------------------------------------------------------------------- def draw_area_actor(i) draw_area_actor_base(rect_actor(i), i) draw_text(rect_actor_exp(i), "経験値") draw_area_actor_num(rect_actor_num(i), i) end #-------------------------------------------------------------------------- # ● Actorエリア描画 [base] #-------------------------------------------------------------------------- def draw_area_actor_base(r, i, old=true) actor = @result.actors[i].actor draw_actor_name(actor, r.x, r.y) level = old ? @result.actors[i].old_level : actor.level draw_actor_level2(level, r.x + 120, r.y) end def redraw_area_actor_base(i) r = rect_actor(i) contents.clear_rect(r) draw_area_actor_base(r, i, false) end #-------------------------------------------------------------------------- # ● レベルの描画 #-------------------------------------------------------------------------- def draw_actor_level2(level, x, y) change_color(system_color) draw_text(x, y, 32, line_height, Vocab::level_a) change_color(normal_color) draw_text(x + 32, y, 24, line_height, level, 2) end #-------------------------------------------------------------------------- # ● Actorエリア描画 [数値のみ] #-------------------------------------------------------------------------- def draw_area_actor_num(r, i) if 1 draw_text(r, @result.actors[i].exp.current, 2) else draw_nums_picture(r.x, r.y, r.width, @result.actors[i].exp.current) end end #-------------------------------------------------------------------------- # ● Actorエリア描画 [数値のみ] #-------------------------------------------------------------------------- def redraw_area_actor_num(i) r = rect_actor_num(i) contents.clear_rect(r) draw_area_actor_num(r, i) end #-------------------------------------------------------------------------- # ● レベルアップ表示 #-------------------------------------------------------------------------- def draw_actors_levelup @result.actors.each_index {|i| draw_actor_levelup(i)} end def draw_actor_levelup(i) return unless @result.actors[i].levelup? change_color(normal_color) redraw_area_actor_base(i) r = rect_actor_exp(i) contents.clear_rect(r) change_color(levelup_color) draw_text(r, "LEVEL UP!") end #-------------------------------------------------------------------------- # ● レベルアップ表示色 #-------------------------------------------------------------------------- def levelup_color text_color(6) end #-------------------------------------------------------------------------- # ● レベルアップSE #-------------------------------------------------------------------------- def play_levelup_se BtlrFv::LVUP_SE.play end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update return unless self.visible return if finish? super @result.update if @result refresh_num if finish? draw_actors_levelup play_levelup_se if @result.actors.any? {|a| a.levelup?} self.pause = true end end #-------------------------------------------------------------------------- # ● 終端へ #-------------------------------------------------------------------------- def finish @result.finish end #-------------------------------------------------------------------------- # ● 終端? #-------------------------------------------------------------------------- def finish? @result.exit? end end
- Arrow:
#============================================================================== # ■ BtArrow_Base #============================================================================== class BtArrow_Base < Sprite #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :active attr_reader :index #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport=nil) @count = 0 @index = -1 @handler = {} @cursor_fix = false @cursor_all = false super(viewport) self.bitmap = Cache.system(arrow_file) self.ox = arrow_width / 2 self.src_rect = Rect.new(0, 0, arrow_width, bitmap.height) deactivate.hide end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max return 0 end #-------------------------------------------------------------------------- # ● アロー画像分割数 #-------------------------------------------------------------------------- def arrow_col return 4 end #-------------------------------------------------------------------------- # ● アロー画像幅 #-------------------------------------------------------------------------- def arrow_width bitmap.width / arrow_col end #-------------------------------------------------------------------------- # ● アロー画像 #-------------------------------------------------------------------------- def arrow_file return "Arrow" end #-------------------------------------------------------------------------- # ● アローの表示 #-------------------------------------------------------------------------- def show self.visible = true self end #-------------------------------------------------------------------------- # ● アローの非表示 #-------------------------------------------------------------------------- def hide self.visible = false self end #-------------------------------------------------------------------------- # ● ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate self.active = true self end #-------------------------------------------------------------------------- # ● ウィンドウの非アクティブ化 #-------------------------------------------------------------------------- def deactivate self.active = false self end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update return unless self.visible super update_cursor process_cursor_move process_handling end #-------------------------------------------------------------------------- # ● フレーム更新 : アロー更新 #-------------------------------------------------------------------------- def update_cursor @count = (@count + 1) % arrow_round if (@count % arrow_mtn) == 0 x = (@count / arrow_mtn) * arrow_width self.src_rect = Rect.new(x, 0, arrow_width, bitmap.height) end end #-------------------------------------------------------------------------- # ● アローアニメーションの更新間隔 #-------------------------------------------------------------------------- def arrow_mtn return 4 end #-------------------------------------------------------------------------- # ● アローアニメーション #-------------------------------------------------------------------------- def arrow_round arrow_col * arrow_mtn end #-------------------------------------------------------------------------- # ● アクティブ状態の変更 #-------------------------------------------------------------------------- def active=(active) @active = active update_cursor call_update_help end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help end #-------------------------------------------------------------------------- # ● 項目の選択 #-------------------------------------------------------------------------- def select(index) self.index = index if index end #-------------------------------------------------------------------------- # ● 項目の選択解除 #-------------------------------------------------------------------------- def unselect self.index = -1 end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの設定 #-------------------------------------------------------------------------- def help_window=(help_window) @help_window = help_window call_update_help end #-------------------------------------------------------------------------- # ● ヘルプウィンドウ更新メソッドの呼び出し #-------------------------------------------------------------------------- def call_update_help update_help if active && @help_window end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの更新 #-------------------------------------------------------------------------- def update_help @help_window.clear end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? return true end #-------------------------------------------------------------------------- # ● 動作に対応するハンドラの設定 # method : ハンドラとして設定するメソッド (Method オブジェクト) #-------------------------------------------------------------------------- def set_handler(symbol, method) @handler[symbol] = method end #-------------------------------------------------------------------------- # ● ハンドラの存在確認 #-------------------------------------------------------------------------- def handle?(symbol) @handler.include?(symbol) end #-------------------------------------------------------------------------- # ● ハンドラの呼び出し #-------------------------------------------------------------------------- def call_handler(symbol) @handler[symbol].call if handle?(symbol) end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false) if index < item_max - col_max || (wrap && col_max == 1) select((index + col_max) % item_max) end end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false) if index >= col_max || (wrap && col_max == 1) select((index - col_max + item_max) % item_max) end end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- def cursor_right(wrap = false) if col_max >= 2 && (index < item_max - 1 || wrap) select((index + 1) % item_max) end end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- def cursor_left(wrap = false) if col_max >= 2 && (index > 0 || wrap) select((index - 1 + item_max) % item_max) end end #-------------------------------------------------------------------------- # ● カーソルの移動処理 #-------------------------------------------------------------------------- def process_cursor_move last_index = @index cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) Sound.play_cursor if @index != last_index end #-------------------------------------------------------------------------- # ● 決定やキャンセルなどのハンドリング処理 #-------------------------------------------------------------------------- def process_handling return unless active return process_ok if ok_enabled? && Input.trigger?(:C) return process_cancel if cancel_enabled? && Input.trigger?(:B) return process_pagedown if handle?(:pagedown) && Input.trigger?(:R) return process_pageup if handle?(:pageup) && Input.trigger?(:L) end #-------------------------------------------------------------------------- # ● 決定処理の有効状態を取得 #-------------------------------------------------------------------------- def ok_enabled? handle?(:ok) end #-------------------------------------------------------------------------- # ● キャンセル処理の有効状態を取得 #-------------------------------------------------------------------------- def cancel_enabled? handle?(:cancel) end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_ok if current_item_enabled? Sound.play_ok Input.update deactivate call_ok_handler else Sound.play_buzzer end end #-------------------------------------------------------------------------- # ● 決定ハンドラの呼び出し #-------------------------------------------------------------------------- def call_ok_handler call_handler(:ok) end #-------------------------------------------------------------------------- # ● キャンセルボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_cancel Sound.play_cancel Input.update deactivate call_cancel_handler end #-------------------------------------------------------------------------- # ● キャンセルハンドラの呼び出し #-------------------------------------------------------------------------- def call_cancel_handler call_handler(:cancel) end end
#============================================================================== # ■ BtArrow_Actor #============================================================================== class BtArrow_Actor < BtArrow_Base #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max item_max end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max $game_party.battle_members.size end #-------------------------------------------------------------------------- # ● アクターオブジェクト取得 #-------------------------------------------------------------------------- def actor $game_party.battle_members[@index] end #-------------------------------------------------------------------------- # ● バトラー #-------------------------------------------------------------------------- def battler Cache.battler(actor.battler_name, actor.battler_hue) end #-------------------------------------------------------------------------- # ● フレーム更新 : アロー更新 #-------------------------------------------------------------------------- def update_cursor super self.x = actor.screen_x self.y = actor.screen_y - battler.height end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの更新 #-------------------------------------------------------------------------- def update_help @help_window.set_battler(actor, battler.height) end end
#============================================================================== # ■ BtArrow_Enemy #============================================================================== class BtArrow_Enemy < BtArrow_Base #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max item_max end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max $game_troop.alive_members.size end #-------------------------------------------------------------------------- # ● エネミーオブジェクト取得 #-------------------------------------------------------------------------- def enemy $game_troop.alive_members[@index] end #-------------------------------------------------------------------------- # ● バトラーの高さ #-------------------------------------------------------------------------- def battler Cache.battler(enemy.battler_name, enemy.battler_hue) end #-------------------------------------------------------------------------- # ● フレーム更新 : アロー更新 #-------------------------------------------------------------------------- def update_cursor super self.x = enemy.screen_x self.y = enemy.screen_y - battler.height end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの更新 #-------------------------------------------------------------------------- def update_help @help_window.set_battler(enemy, battler.height) end end
|
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 15:02 | |
| - FveiwObjHpMpTp:
#============================================================================== # ■ FveiwNumUpdate : 数値フレーム更新用のクラス #============================================================================== class FveiwNumUpdate TIME = 20 # 基準時間(frame) STEP = 1 # 増加ステップ attr_reader :current #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ def initialize(limit=TIME) @current = @target = @step = 0 @limit = limit end #------------------------------------------------------------------------ # ● リセット #------------------------------------------------------------------------ def reset(t) @current = @target = t @step = 0 end #------------------------------------------------------------------------ # ● ターゲット設定 #------------------------------------------------------------------------ def target(t, step=0) @target = t @step = step==0 ? calc_step(@current, @target) : step end #------------------------------------------------------------------------ # ● ターゲットまで変更 #------------------------------------------------------------------------ def finish reset(@target) end #------------------------------------------------------------------------ # ● ステップ計算 #------------------------------------------------------------------------ def calc_step(a, b) return 0 if b == a diff = b - a pm = diff / diff.abs t = [(diff.abs / STEP).round, @limit].min t = diff.abs if t == 0 step = [1, (diff.abs / t).truncate].max return step * pm end #------------------------------------------------------------------------ # ● カウントUP #------------------------------------------------------------------------ def count ret = exit? if (@target - @current).abs < @step.abs @current = @target else @current += @step end ret end #------------------------------------------------------------------------ # ● 終了判定 #------------------------------------------------------------------------ def exit? return @current == @target end end
#============================================================================== # ■ FveiwObjHpMpTp : 数値フレーム更新用のまとめクラス #============================================================================== class FveiwObjHpMpTp #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ def initialize(battler) @battler = battler @prms = [] 3.times { |i| @prms.push(FveiwNumUpdate.new) } end def hp; @prms[0]; end def mp; @prms[1]; end def tp; @prms[2]; end #-------------------------------------------------------------------------- # ● 戦闘開始処理 #-------------------------------------------------------------------------- def battle_start @battler.dead? ? reset : target end #-------------------------------------------------------------------------- # ● 戦闘終了処理 #-------------------------------------------------------------------------- def battle_end @prms.each {|s| s.reset(0)} end #------------------------------------------------------------------------ # ● リセット #------------------------------------------------------------------------ def reset hp.reset(@battler.hp) mp.reset(@battler.mp) tp.reset(@battler.tp) end #------------------------------------------------------------------------ # ● 非ダメージ・回復 #------------------------------------------------------------------------ def target hp.target(@battler.hp) mp.target(@battler.mp) tp.target(@battler.tp) end #------------------------------------------------------------------------ # ● フレーム更新 #------------------------------------------------------------------------ def update_hp; hp.count; end def update_mp; mp.count; end def update_tp; tp.count; end #-------------------------------------------------------------------------- # ● HP の割合を取得 #-------------------------------------------------------------------------- def hp_rate hp.current.to_f / @battler.mhp end #-------------------------------------------------------------------------- # ● MP の割合を取得 #-------------------------------------------------------------------------- def mp_rate @battler.mmp > 0 ? mp.current.to_f / @battler.mmp : 0 end #-------------------------------------------------------------------------- # ● TP の割合を取得 #-------------------------------------------------------------------------- def tp_rate tp.current.to_f / @battler.max_tp end end
- Frontview HpMpTp:
#============================================================================== # ■ DrawFvPictures : 専用ピクチャ描画モジュール #============================================================================== module DrawFvPictures #-------------------------------------------------------------------------- # ● HP/MP/TP/Act文字 の描画 #-------------------------------------------------------------------------- def self.draw_bt_text(bitmap, index, x, y) b = BtlrFv.bt_txt hh = b.height / 4 bitmap.blt(x, y, b, Rect.new(0, index * hh, b.width, hh)) end #-------------------------------------------------------------------------- # ● 数字ピクチャ(1文字) の矩形 [src] #-------------------------------------------------------------------------- def self.num_rect(index=0, type=0) b = BtlrFv.number ww = b.width / 10 hh = b.height / 4 Rect.new(index*ww, type*hh, ww, hh) end #-------------------------------------------------------------------------- # ● 数字ピクチャ の矩形 [width, height] #-------------------------------------------------------------------------- def self.text_size(num) if damage_type(num) == 4 b = Cache.system(num) Rect.new(0, 0, b.width, b.height) else b = BtlrFv.number Rect.new(0, 0, num.to_s.split("").size * (b.width / 10), b.height / 4) end end #-------------------------------------------------------------------------- # ● 数字ピクチャ(1文字) の描画 #-------------------------------------------------------------------------- def self.draw_num_picture(bitmap, x, y, height, num, type=0) r = num_rect(num, type) yy = (height - r.height) / 2 bitmap.blt(x, y+yy, BtlrFv.number, r) r.width end #-------------------------------------------------------------------------- # ● 数値ピクチャ の描画 #-------------------------------------------------------------------------- def self.draw_nums_picture(bitmap, x, y, width, height, num, type=0, align=2) nums = num.to_s.split("").collect { |i| i.to_i } case align when 1; x += (width - num_rect(0, type).width * nums.size) / 2 when 2; x += width - num_rect(0, type).width * nums.size end nums.each { |n| x += draw_num_picture(bitmap, x, y, height, n, type) } end #-------------------------------------------------------------------------- # ● ダメージ用文字ピクチャ の矩形 #-------------------------------------------------------------------------- def self.draw_dmg_text(bitmap, x, y, file) b = Cache.system(file) bitmap.blt(x, y, b, Rect.new(0,0,b.width,b.height)) end #-------------------------------------------------------------------------- # ● HP の文字色を取得 #-------------------------------------------------------------------------- def self.hp_color_type(actor) return 2 if actor.fv_prm.hp.current == 0 return 1 if actor.fv_prm.hp.current < actor.mhp / 4 return 0 end #-------------------------------------------------------------------------- # ● MP の文字色を取得 #-------------------------------------------------------------------------- def self.mp_color_type(actor) return 2 if actor.fv_prm.mp.current == 0 return 1 if actor.fv_prm.mp.current < actor.mmp / 4 return 0 end #-------------------------------------------------------------------------- # ● TP の文字色を取得 #-------------------------------------------------------------------------- def self.tp_color_type(actor) return 2 if actor.fv_prm.tp.current == actor.max_tp return 0 end #-------------------------------------------------------------------------- # ● ダメージ種別を取得 #-------------------------------------------------------------------------- def self.damage_type(damage, critical=false) if damage.is_a?(Numeric) return 3 if damage < 0 return 2 if critical return 0 else return 4 # 文字 end end #-------------------------------------------------------------------------- # ● ゲージピクチャ の矩形 #-------------------------------------------------------------------------- def self.guage_rect(type=0, rate=1.0, w=0, h=0) bitmap = BtlrFv.guage ww = (bitmap.width - w) * rate hh = bitmap.height / 5 Rect.new(w/2, type*hh, ww, hh) end #-------------------------------------------------------------------------- # ● ゲージピクチャ の描画 #-------------------------------------------------------------------------- def self.draw_guage_picture(bitmap, x, y, type, rate) bitmap.blt(x, y, BtlrFv.guage, guage_rect(0)) bitmap.blt(x, y, BtlrFv.guage, guage_rect(type, rate, 2, 2)) bitmap.blt(x, y, BtlrFv.guage, guage_rect(4)) end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● HP/MP/TP/Act文字 の描画 #-------------------------------------------------------------------------- def draw_bt_text(index, x, y) DrawFvPictures.draw_bt_text(contents, index, x, y) end #-------------------------------------------------------------------------- # ● 数値ピクチャ の描画 #-------------------------------------------------------------------------- def draw_nums_picture(x, y, width, num, type=0, align=2) DrawFvPictures.draw_nums_picture(contents, x, y, width, line_height, num, type, align) end #-------------------------------------------------------------------------- # ● ゲージピクチャ の矩形 #-------------------------------------------------------------------------- def guage_rect(type=0, rate=1.0, w=0, h=0) DrawFvPictures.guage_rect(contents, type, rate, w, h) end #-------------------------------------------------------------------------- # ● ゲージピクチャ の描画 #-------------------------------------------------------------------------- def draw_guage_picture(x, y, type, rate) DrawFvPictures.draw_guage_picture(contents, x, y, type, rate) end end #============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ● HP の描画 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 124) #~ draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) #~ change_color(system_color) #~ draw_text(x, y, 30, line_height, Vocab::hp_a) #~ draw_current_and_max_values(x, y, width, actor.hp, actor.mhp, #~ hp_color(actor), normal_color) draw_guage_picture(x, y, 1, actor.fv_prm.hp_rate) draw_bt_text(0, x, y+ draw_nums_picture(x, y, width, actor.fv_prm.hp.current, DrawFvPictures.hp_color_type(actor)) end #-------------------------------------------------------------------------- # ● MP の描画 #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width = 124) #~ draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) #~ change_color(system_color) #~ draw_text(x, y, 30, line_height, Vocab::mp_a) #~ draw_current_and_max_values(x, y, width, actor.mp, actor.mmp, #~ mp_color(actor), normal_color) draw_guage_picture(x, y, 2, actor.fv_prm.mp_rate) draw_bt_text(1, x, y+ draw_nums_picture(x, y, width, actor.fv_prm.mp.current, DrawFvPictures.mp_color_type(actor)) end #-------------------------------------------------------------------------- # ● TP の描画 #-------------------------------------------------------------------------- def draw_actor_tp(actor, x, y, width = 124) #~ draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2) #~ change_color(system_color) #~ draw_text(x, y, 30, line_height, Vocab::tp_a) #~ change_color(tp_color(actor)) #~ draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2) draw_guage_picture(x, y, 3, actor.fv_prm.tp_rate) draw_bt_text(2, x, y+ draw_nums_picture(x, y, width, actor.fv_prm.tp.current.to_i, DrawFvPictures.tp_color_type(actor)) end #-------------------------------------------------------------------------- # ● HP の再描画 #-------------------------------------------------------------------------- def redraw_actor_hp(index) r = gauge_area_rect(index) r.y += gauge_line_height * 0 r.height = gauge_line_height contents.clear_rect(r) draw_actor_hp(i_actor(index), r.x, r.y, r.width) end #-------------------------------------------------------------------------- # ● MP の再描画 #-------------------------------------------------------------------------- def redraw_actor_mp(index) r = gauge_area_rect(index) r.y += gauge_line_height * 1 r.height = gauge_line_height contents.clear_rect(r) draw_actor_mp(i_actor(index), r.x, r.y, r.width) end #-------------------------------------------------------------------------- # ● TP の再描画 #-------------------------------------------------------------------------- def redraw_actor_tp(index) return unless $data_system.opt_display_tp r = gauge_area_rect(index) r.y += gauge_line_height * 2 r.height = gauge_line_height contents.clear_rect(r) draw_actor_tp(i_actor(index), r.x, r.y, r.width) end #-------------------------------------------------------------------------- # ● アクション文字描画 #-------------------------------------------------------------------------- def draw_action_text(x, y) change_color(system_color) contents.font.size = 15 draw_bt_text(3, x, y+ contents.font.size = Font.default_size change_color(normal_color) end #-------------------------------------------------------------------------- # ● 戦闘コマンドアイコンの描画 #-------------------------------------------------------------------------- def draw_bt_cmd_icon(index, enable=true) rect = action_area_rect(index) contents.fill_rect(Rect.new(rect.x, rect.y+12, 24, 28), BtlrFv::BACK_COLOR) draw_action_text(rect.x, rect.y-4) draw_icon(i_actor(index).act_icon, rect.x, rect.y+16) if enable end #-------------------------------------------------------------------------- # ● 戦闘コマンドアイコンの再描画 #-------------------------------------------------------------------------- def redraw_bt_cmd_icon(index, redraw=true) contents.clear_rect(action_area_rect(index)) draw_bt_cmd_icon(index, redraw) end end
- Frontview Status:
#============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @prms = [] super(0, 0, window_width, window_height) refresh self.openness = 0 self.opacity = 0 end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width Graphics.width + 12 * 2 end #-------------------------------------------------------------------------- # ● 項目の幅を取得 #-------------------------------------------------------------------------- def item_width width / $game_party.max_battle_members end #-------------------------------------------------------------------------- # ● HP/MP/TPの行の高さ取得 #-------------------------------------------------------------------------- def gauge_line_height line_height - 2 end #-------------------------------------------------------------------------- # ● 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing return 8 end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 5 end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return item_max end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width rect.height = contents_height rect.x = index % col_max * (item_width + spacing) rect.x = BtlrFv.screen_x(index % col_max) - item_width / 2 rect.y = index / col_max * contents_height rect end #-------------------------------------------------------------------------- # ● 基本エリアの矩形を取得 #-------------------------------------------------------------------------- def basic_area_rect(index) rect = item_rect_for_text(index) rect.y = contents_height - gauge_area_height - line_height - 8 rect.height = line_height rect end #-------------------------------------------------------------------------- # ● ゲージエリアの矩形を取得 #-------------------------------------------------------------------------- def gauge_area_rect(index) rect = item_rect_for_text(index) rect.x += 32 rect.x -= 16 if !BtlrFv::USE_ROULET_ST and !BtlrFv::USE_ACTION_ICN rect.y += contents_height - gauge_area_height - 8 rect.width = gauge_area_width rect.height = gauge_area_height rect end #-------------------------------------------------------------------------- # ● Actionエリアの矩形を取得 #-------------------------------------------------------------------------- def action_area_rect(index) rect = item_rect_for_text(index) rect.y += contents_height - gauge_area_height - 8 rect.height = gauge_area_height - 24 rect.width = 24 + 4 rect end #-------------------------------------------------------------------------- # ● ゲージエリアの高さを取得 #-------------------------------------------------------------------------- def gauge_area_height return (gauge_line_height * ($data_system.opt_display_tp ? 3 : 2)) end #-------------------------------------------------------------------------- # ● ゲージエリアの幅を取得 #-------------------------------------------------------------------------- def gauge_area_width BtlrFv.guage.width end #-------------------------------------------------------------------------- # ● アクター取得 #-------------------------------------------------------------------------- def i_actor(index) return nil if index < 0 return $game_party.battle_members[index] end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) actor = i_actor(index) draw_basic_area(basic_area_rect(index), actor) draw_bt_cmd_icon(index) if BtlrFv::USE_ACTION_ICN draw_gauge_area(gauge_area_rect(index), actor) actor.fv_prm.target end #-------------------------------------------------------------------------- # ● 基本エリアの描画 #-------------------------------------------------------------------------- def draw_basic_area(rect, actor) if BtlrFv::USE_ROULET_ST s = contents.font.size contents.font.size = 16 draw_actor_name(actor, rect.x, rect.y + 6, 100) contents.font.size = s draw_roulet_st(actor.index) else draw_actor_icons(actor, rect.x, rect.y, rect.width+ end end #-------------------------------------------------------------------------- # ● ゲージエリアの描画(TP あり) #-------------------------------------------------------------------------- def draw_gauge_area_with_tp(rect, actor) draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 0, rect.width) draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width) draw_actor_tp(actor, rect.x, rect.y + gauge_line_height * 2, rect.width) end #-------------------------------------------------------------------------- # ● ゲージエリアの描画(TP なし) #-------------------------------------------------------------------------- def draw_gauge_area_without_tp(rect, actor) draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 0, rect.width) draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_status_all if self.visible and self.openness == 255 end #-------------------------------------------------------------------------- # ● フレーム更新 : アクターステータス #-------------------------------------------------------------------------- def update_status_all item_max.times {|i| update_status(i) } end #-------------------------------------------------------------------------- # ● フレーム更新 : アクターステータス #-------------------------------------------------------------------------- def update_status(index) redraw_actor_hp(index) unless i_actor(index).fv_prm.update_hp redraw_actor_mp(index) unless i_actor(index).fv_prm.update_mp redraw_actor_tp(index) unless i_actor(index).fv_prm.update_tp update_states if BtlrFv::USE_ROULET_ST end end
- Frontview RouletteST:
#============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ● ルーレットステートの描画矩形 #-------------------------------------------------------------------------- def rst_area_rect(index) if $data_system.opt_display_tp or !BtlrFv::USE_ACTION_ICN rect = action_area_rect(index) rect.height = 24 rect.y = contents_height - rect.height - 8 else rect = basic_area_rect(index) rect.x += rect.width - 48 rect.width = 24 end rect end #-------------------------------------------------------------------------- # ● ルーレットステート描画 #-------------------------------------------------------------------------- def draw_roulet_st(index) rect = rst_area_rect(index) contents.fill_rect(Rect.new(rect.x, rect.y, 24, 24), BtlrFv::BACK_COLOR) return if i_actor(index).r_st.icon_index == 0 draw_icon(i_actor(index).r_st.icon_index, rect.x, rect.y) end #-------------------------------------------------------------------------- # ● ルーレットステート再描画 #-------------------------------------------------------------------------- def redraw_roulet_st(index) contents.clear_rect(rst_area_rect(index)) draw_roulet_st(index) end #-------------------------------------------------------------------------- # ● フレーム更新 : ステート #-------------------------------------------------------------------------- def update_states members = $game_party.battle_members members.each_index do |i| actor = members[i] redraw_roulet_st(i) if actor.r_st.update(actor) end end end
#============================================================================== # ■ FvRouletStates #============================================================================== class FvRouletStates WAIT = 60 # 切り替えタイミング(frame) #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor) reset_states(actor) end #-------------------------------------------------------------------------- # ● ルーレット対象のアイコン取得 #-------------------------------------------------------------------------- def icons(actor) actor.state_icons + actor.buff_icons end #-------------------------------------------------------------------------- # ● ステート情報リセット #-------------------------------------------------------------------------- def reset_states(actor) icons = icons(actor) return false if @icons == icons @icons = icons @index = 0 @wait = WAIT true end #-------------------------------------------------------------------------- # ● ステート情報切り替え #-------------------------------------------------------------------------- def next_state @index = (@index + 1 ) % @icons.size @wait = WAIT true end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update(actor) return true if reset_states(actor) return false if @icons.size < 2 @wait -= 1 return next_state if @wait == 0 false end #-------------------------------------------------------------------------- # ● アイコンIndex #-------------------------------------------------------------------------- def icon_index @icons.empty? ? 0 : @icons[@index] end end
- EnemyStatusGauge:
#============================================================================== # ■ Window_BattleEnemyGauge #============================================================================== class Window_BattleEnemyGauge < Window_Base WAIT = 60 # 表示時間(frame) #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport, battler) super(0, 0, 140, fitting_height(1)) self.opacity = 0 self.visible = false self.viewport = viewport @battler = battler @wait = WAIT @battler.fv_prm.reset end #-------------------------------------------------------------------------- # ● バトラー設定 #-------------------------------------------------------------------------- def set_battler(battler) return if @battler == battler @battler = battler return if @battler.nil? @battler.fv_prm.reset refresh end #-------------------------------------------------------------------------- # ● ターゲット設定 #-------------------------------------------------------------------------- def target @battler.fv_prm.target return if @battler.fv_prm.hp.exit? @wait = WAIT show.update_pos end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_gauge(0, 0, contents_width, @battler.fv_prm.hp_rate, hp_gauge_color1, hp_gauge_color2) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update return unless self.visible return if @battler.nil? super update_pos @battler.fv_prm.hp_rate unless @battler.fv_prm.hp.exit? refresh unless @battler.fv_prm.update_hp else @wait -= 1 hide if @wait <= 0 end end #-------------------------------------------------------------------------- # ● ポジション更新 #-------------------------------------------------------------------------- def update_pos self.x = @battler.screen_x - width / 2 self.y = @battler.screen_y - height self.z = @battler.screen_z + 100 end end
- DamagePop:
#============================================================================== # ■ ダメージ情報クラス(ONE) #============================================================================== class FvDmg attr_reader :type attr_reader :damage attr_reader :critical #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(type, result) @type = type case type when :hp_damage, :hp_recover; @damage = result.hp_damage when :mp_damage, :mp_recover; @damage = result.mp_damage when :tp_damage, :tp_recover; @damage = result.tp_damage when :hp_drain; @damage = result.hp_drain when :mp_drain; @damage = result.mp_drain when :miss; @damage = "Miss" when :evaded; @damage = "Evade" end @critical = result.critical end #-------------------------------------------------------------------------- # ● ダメージ種別 #-------------------------------------------------------------------------- def d_type return 2 if @critical case @type when :hp_damage, :mp_damage, :tp_damage return 0 when :hp_recover, :mp_recover, :tp_recover return 3 when :hp_drain, :mp_drain return 3 end return 0 end #-------------------------------------------------------------------------- # ● ダメージ種別 : 数字 #-------------------------------------------------------------------------- def damage_num? (damage_hp? or damage_mp? or damage_tp?) end #-------------------------------------------------------------------------- # ● ダメージ種別 : HP #-------------------------------------------------------------------------- def damage_hp? (@type == :hp_damage or @type == :hp_recover or @type == :hp_drain) end #-------------------------------------------------------------------------- # ● ダメージ種別 : MP #-------------------------------------------------------------------------- def damage_mp? (@type == :mp_damage or @type == :mp_recover or @type == :mp_drain) end #-------------------------------------------------------------------------- # ● ダメージ種別 : TP #-------------------------------------------------------------------------- def damage_tp? (@type == :tp_damage or @type == :tp_recover) end end
#============================================================================== # ■ ダメージ情報クラス(ALL) #============================================================================== class FvDmgPop #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @enable = false @dmgs = [] end #-------------------------------------------------------------------------- # ● ダメージ処理の有無 #-------------------------------------------------------------------------- def exist? @enable and !@dmgs.empty? end #-------------------------------------------------------------------------- # ● enable #-------------------------------------------------------------------------- def enable @enable = true end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear @enable = false @dmgs.clear end #-------------------------------------------------------------------------- # ● ダメージ情報 追加 #-------------------------------------------------------------------------- def dmg_push(d) @dmgs.push(d) end #-------------------------------------------------------------------------- # ● ダメージ情報 取り出し #-------------------------------------------------------------------------- def dmg_pop @dmgs.delete_at(0) end #-------------------------------------------------------------------------- # ● イテレータ #-------------------------------------------------------------------------- def each @dmgs.each {|dmg| yield dmg } if block_given? end end
#============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ● スキル/アイテムの効果適用 #-------------------------------------------------------------------------- alias item_apply_fvdmg item_apply def item_apply(user, item) item_apply_fvdmg(user, item) make_damage_pop(user) if @result.used and $game_party.in_battle end #-------------------------------------------------------------------------- # ● ダメージポップの処理 #-------------------------------------------------------------------------- def make_damage_pop(user) if @result.hit? a = [] a.push(FvDmg.new(:hp_damage, @result)) if @result.hp_damage > 0 a.push(FvDmg.new(:hp_recover, @result)) if @result.hp_damage < 0 a.push(FvDmg.new(:mp_damage, @result)) if @result.mp_damage > 0 a.push(FvDmg.new(:mp_recover, @result)) if @result.mp_damage < 0 a.push(FvDmg.new(:tp_damage, @result)) if @result.tp_damage > 0 a.push(FvDmg.new(:tp_recover, @result)) if @result.tp_damage < 0 @dmgpop.dmg_push(a) unless a.empty? b = [] b.push(FvDmg.new(:hp_drain, @result)) if @result.hp_drain > 0 b.push(FvDmg.new(:mp_drain, @result)) if @result.mp_drain > 0 user.dmgpop.dmg_push(b) unless b.empty? else a = [] a.push(FvDmg.new(:miss, @result)) if @result.missed a.push(FvDmg.new(:evaded, @result)) if @result.evaded @dmgpop.dmg_push(a) unless a.empty? end end end
#============================================================================== # ■ Sprite_FvDamage : ダメージ表示クラス #============================================================================== class Sprite_FvDamage < Sprite DMG_FRM = 15 # ダメージ表示フレーム数 WAIT = 15 # ダメージ表示ウェイトフレーム数 FWAIT = 10 # ダメージ表示ウェイトフレーム数 SLIDE = 1 # ダメージフェード移動数 #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ def initialize(viewport, rect, dmgpop) super(viewport) self.x = rect.x self.y = rect.y self.ox = rect.width / 2 self.oy = rect.height / 2 @damage = dmgpop @prm = FveiwNumUpdate.new(DMG_FRM) @prm.target(dmgpop.damage.is_a?(Numeric) ? dmgpop.damage.abs : WAIT) @wait = WAIT @fade = false init_x_start self.bitmap = Bitmap.new(rect.width, rect.height) refresh if @prm.exit? end #------------------------------------------------------------------------ # ● オブジェクト破棄 #------------------------------------------------------------------------ def dispose bitmap.dispose super end #------------------------------------------------------------------------ # ● 描画開始位置 #------------------------------------------------------------------------ def init_x_start if BtlrFv::ADD_DMG_TYPE @x_start = @damage.damage_num? ? (BtlrFv.bt_txt.width + 4) : 0 else @x_start = 0 end end #------------------------------------------------------------------------ # ● フレーム更新 #------------------------------------------------------------------------ def update return if disposed? if !@prm.exit? @prm.count refresh elsif !@fade @wait -= 1 if @wait == 0 @wait = FWAIT @fade = true end else # @fade == true @wait -= 1 update_fade dispose if @wait == 0 end end #------------------------------------------------------------------------ # ● リフレッシュ #------------------------------------------------------------------------ def update_fade self.opacity = @wait * 255 / WAIT self.y -= SLIDE end #------------------------------------------------------------------------ # ● リフレッシュ #------------------------------------------------------------------------ def refresh bitmap.clear if @damage.damage_num? draw_hpmptp_text else DrawFvPictures.draw_dmg_text(bitmap, @x_start, 0, @damage.damage) end end #------------------------------------------------------------------------ # ● HP/MP/TP描画 #------------------------------------------------------------------------ def draw_hpmptp_text type = 0 if @damage.damage_hp? type = 1 if @damage.damage_mp? type = 2 if @damage.damage_tp? if BtlrFv::ADD_DMG_TYPE DrawFvPictures.draw_bt_text( bitmap, type, 0, bitmap.height - (BtlrFv.bt_txt.height / 4) ) end DrawFvPictures.draw_nums_picture( bitmap, @x_start, 0, bitmap.width - @x_start, bitmap.height, @prm.current, @damage.d_type, 2 ) end end
#============================================================================== # ■ FvDamagePops : ダメージポップクラス #============================================================================== class FvDamagePops attr_accessor :battler #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ def initialize(viewport, battler) @viewport = viewport @battler = battler @damages = [] end #------------------------------------------------------------------------ # ● オブジェクト破棄 #------------------------------------------------------------------------ def dispose @damages.each {|s| s.dispose} end #------------------------------------------------------------------------ # ● ビットマップ幅 / 4 #------------------------------------------------------------------------ def bitmap_width(bt) bt.width / 4 end #------------------------------------------------------------------------ # ● ダメージポップ座標 #------------------------------------------------------------------------ def damage_rect(damage) num = damage[0].damage_num? ? damage[0].damage.abs : damage[0].damage r = DrawFvPictures.text_size(num) if BtlrFv::ADD_DMG_TYPE r.width += BtlrFv.bt_txt.width + 4 if damage[0].damage_num? end bt = Cache.battler(@battler.battler_name, @battler.battler_hue) bt_width = bitmap_width(bt) x_start = @battler.screen_x - bt_width x_end = @battler.screen_x + bt_width
y_start = @battler.screen_y - bt.height y_end = @battler.screen_y - bt.height / 4 y_end -= bt.height / 4 if @battler.actor? # Actor:ゲージに被らない範囲 y_start = [80, y_start].max if @battler.enemy? # Enemy:Logに被らない程度 y_end -= damage.size * r.height case BtlrFv::DMGPOP_POS when 0 # ランダム r.x = x_start + rand(x_end - x_start) r.y = y_start + rand(y_end - y_start) when 1 # 頭上 r.x = x_start + (x_end - x_start) / 2 r.y = y_start end
r.x = [[0, r.x].max, Graphics.width - r.width].min r.y = [[0, r.y].max, Graphics.height - r.height].min r end #------------------------------------------------------------------------ # ● ダメージポップ開始 #------------------------------------------------------------------------ def damage(dmgpop) rect = damage_rect(dmgpop) dmgpop.size.times do |i| s = Sprite_FvDamage.new(@viewport, rect, dmgpop[i]) s.z = @battler.screen_z + 10 @damages.push(s) rect.y += rect.height end end #------------------------------------------------------------------------ # ● フレーム更新 #------------------------------------------------------------------------ def update @damages.each {|d| update_damage(d) } @damages.compact! end #------------------------------------------------------------------------ # ● フレーム更新 #------------------------------------------------------------------------ def update_damage(d) d = nil if d.update end end
#============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler < Sprite_Base attr_reader :dmg #------------------------------------------------------------------------ # ● オブジェクト初期化 #------------------------------------------------------------------------ alias initialize_fvdmg initialize def initialize(viewport, battler = nil) initialize_fvdmg(viewport, battler) @dmg = FvDamagePops.new(viewport, battler) @guage = Window_BattleEnemyGauge.new(viewport, battler) if !battler.nil? and battler.enemy? end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- alias dispose_fvdmg dispose def dispose dispose_fvdmg @dmg.dispose @guage.dispose unless @guage.nil? end #-------------------------------------------------------------------------- # ● 新しいエフェクトの設定 #-------------------------------------------------------------------------- alias setup_new_effect_fvdmg setup_new_effect def setup_new_effect setup_new_effect_fvdmg start_dmg_effect if @battler_visible && @battler.dmgpop.exist? end #-------------------------------------------------------------------------- # ● ダメージエフェクトの開始 #-------------------------------------------------------------------------- def start_dmg_effect @battler.dmgpop.each {|d| @dmg.damage(d)} @battler.dmgpop.clear @guage.target if @battler.enemy? end #-------------------------------------------------------------------------- # ● ダメージエフェクトの更新 #-------------------------------------------------------------------------- alias update_effect_fvdmg update_effect def update_effect update_effect_fvdmg @dmg.update @guage.update unless @guage.nil? end end
#============================================================================== # ■ Window_BattleLog #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ● ダメージの表示 #-------------------------------------------------------------------------- alias display_damage_fvdmg display_damage def display_damage(target, item) target.dmgpop.enable display_damage_fvdmg(target, item) end end
- Scene_BattleFV:
#============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 全ウィンドウの作成 #-------------------------------------------------------------------------- alias create_all_windows_fv create_all_windows def create_all_windows create_all_windows_fv create_result_window end #-------------------------------------------------------------------------- # ● 全ウィンドウの更新 #-------------------------------------------------------------------------- def update_all_windows super @actor_arrow.update @enemy_arrow.update end #-------------------------------------------------------------------------- # ● 全ウィンドウの解放 #-------------------------------------------------------------------------- def dispose_all_windows super @actor_arrow.dispose @enemy_arrow.dispose end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new @help_window.visible = false @arrow_help_window = Window_BtArrowHelp.new end #-------------------------------------------------------------------------- # ● 情報表示ビューポートの作成 #-------------------------------------------------------------------------- def create_info_viewport @info_viewport = Viewport.new @info_viewport.rect.y = Graphics.height - @status_window.height @info_viewport.rect.height = @status_window.height @info_viewport.z = 100 @info_viewport.ox = 64 end #-------------------------------------------------------------------------- # ● パーティコマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_party_command_window @party_command_window = Window_PartyHorzCommand.new @party_command_window.set_handler(:fight, method(:command_fight)) @party_command_window.set_handler(:escape, method(:command_escape)) @party_command_window.unselect end #-------------------------------------------------------------------------- # ● アクターコマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_actor_command_window case BtlrFv::CMD_WIN when 1; @actor_command_window = Window_ActorIconCmd.new when 2; @actor_command_window = WindowBattleActorCmd.new else; @actor_command_window = Window_ActorCommand.new end @actor_command_window.set_handler(:attack, method(:command_attack)) @actor_command_window.set_handler(:skill, method(:command_skill)) @actor_command_window.set_handler(:guard, method(:command_guard)) @actor_command_window.set_handler(:item, method(:command_item)) @actor_command_window.set_handler(:cancel, method(:prior_command)) end #-------------------------------------------------------------------------- # ● ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_status_window @status_window = Window_BattleStatus.new @status_window.y = Graphics.height - @status_window.height + 12 end #-------------------------------------------------------------------------- # ● アクターウィンドウの作成 #-------------------------------------------------------------------------- def create_actor_window @actor_arrow = BtArrow_Actor.new @actor_arrow.set_handler(:ok, method(:on_actor_ok)) @actor_arrow.set_handler(:cancel, method(:on_actor_cancel)) end #-------------------------------------------------------------------------- # ● 敵キャラウィンドウの作成 #-------------------------------------------------------------------------- def create_enemy_window @enemy_arrow = BtArrow_Enemy.new @enemy_arrow.set_handler(:ok, method(:on_enemy_ok)) @enemy_arrow.set_handler(:cancel, method(:on_enemy_cancel)) end #-------------------------------------------------------------------------- # ● リザルトウィンドウの作成 #-------------------------------------------------------------------------- def create_result_window @result_window = Window_FvBtResult.new @result_window.set_handler(:ok, method(:on_result_ok)) BattleManager.set_result_method(method(:set_result), method(:wait_result)) end #-------------------------------------------------------------------------- # ● リザルトウィンドウの設定 #-------------------------------------------------------------------------- def set_result(result) @result_window.set_result(result) end #-------------------------------------------------------------------------- # ● リザルトウィンドウの設定 #-------------------------------------------------------------------------- def wait_result loop do update_basic break if @result_window.finish? and Input.trigger?(:C) end end #-------------------------------------------------------------------------- # ● リザルト表示OK #-------------------------------------------------------------------------- def on_result_ok @result_window.finish unless @result_window.finish? end
if BtlrFv::USE_ACTION_ICN #-------------------------------------------------------------------------- # ● 次のコマンド入力へ #-------------------------------------------------------------------------- alias next_command_xpbtfv next_command def next_command @status_window.redraw_bt_cmd_icon(BattleManager.actor.index) unless BattleManager.actor.nil? next_command_xpbtfv end #-------------------------------------------------------------------------- # ● 前のコマンド入力へ #-------------------------------------------------------------------------- alias prior_command_xpbtv prior_command def prior_command @status_window.redraw_bt_cmd_icon(BattleManager.actor.index, false) prior_command_xpbtv end end
#-------------------------------------------------------------------------- # ● アクターコマンド選択の開始 #-------------------------------------------------------------------------- def start_actor_command_selection @status_window.redraw_bt_cmd_icon(BattleManager.actor.index) if BtlrFv::USE_ACTION_ICN # @status_window.select(BattleManager.actor.index) @party_command_window.close @actor_command_window.setup(BattleManager.actor) end #-------------------------------------------------------------------------- # ● アクター選択の開始 #-------------------------------------------------------------------------- def select_actor_selection @actor_arrow.index = BattleManager.actor.index # 使用者 @actor_arrow.help_window = @arrow_help_window @actor_arrow.show.activate end #-------------------------------------------------------------------------- # ● アクター[決定] #-------------------------------------------------------------------------- def on_actor_ok BattleManager.actor.input.target_index = @actor_arrow.index @actor_arrow.hide @arrow_help_window.clear.close @skill_window.hide @item_window.hide next_command end #-------------------------------------------------------------------------- # ● アクター[キャンセル] #-------------------------------------------------------------------------- def on_actor_cancel @actor_arrow.hide @arrow_help_window.clear.close case @actor_command_window.current_symbol when :attack @actor_command_window.open.activate when :skill @skill_window.show.activate when :item @item_window.show.activate end end #-------------------------------------------------------------------------- # ● 敵キャラ選択の開始 #-------------------------------------------------------------------------- def select_enemy_selection @enemy_arrow.index = 0 @enemy_arrow.help_window = @arrow_help_window @enemy_arrow.show.activate end #-------------------------------------------------------------------------- # ● 敵キャラ[決定] #-------------------------------------------------------------------------- def on_enemy_ok BattleManager.actor.input.target_index = @enemy_arrow.enemy.index @enemy_arrow.hide @arrow_help_window.clear.close @skill_window.hide @item_window.hide next_command end #-------------------------------------------------------------------------- # ● 敵キャラ[キャンセル] #-------------------------------------------------------------------------- def on_enemy_cancel @enemy_arrow.hide @arrow_help_window.clear.close case @actor_command_window.current_symbol when :attack @actor_command_window.open.activate when :skill @skill_window.show.activate when :item @item_window.show.activate end end #-------------------------------------------------------------------------- # ● スキル[決定] #-------------------------------------------------------------------------- def on_skill_ok @skill_window.hide @skill = @skill_window.item BattleManager.actor.input.set_skill(@skill.id) BattleManager.actor.last_skill.object = @skill if !@skill.need_selection? @skill_window.hide next_command elsif @skill.for_opponent? select_enemy_selection else select_actor_selection end end #-------------------------------------------------------------------------- # ● スキル[キャンセル] #-------------------------------------------------------------------------- def on_skill_cancel @skill_window.hide @actor_command_window.open.activate end #-------------------------------------------------------------------------- # ● アイテム[決定] #-------------------------------------------------------------------------- def on_item_ok @item_window.hide @item = @item_window.item BattleManager.actor.input.set_item(@item.id) if !@item.need_selection? @item_window.hide next_command elsif @item.for_opponent? select_enemy_selection else select_actor_selection end $game_party.last_item.object = @item end #-------------------------------------------------------------------------- # ● アイテム[キャンセル] #-------------------------------------------------------------------------- def on_item_cancel @item_window.hide @actor_command_window.open.activate end #-------------------------------------------------------------------------- # ● 攻撃アニメーションの表示 [再定義] # targets : 対象者の配列 # アクターの場合は二刀流を考慮(左手武器は反転して表示)。 # 敵キャラの場合は [敵の通常攻撃] 効果音を演奏して一瞬待つ。
|
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 15:08 | |
| - BattleManager:
#============================================================================== # ■ BattleManager #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● リザルト処理メソッドを設定 #-------------------------------------------------------------------------- def self.set_result_method(set_result_method, wait_result_method) @set_result_method = set_result_method @wait_result_method = wait_result_method end #-------------------------------------------------------------------------- # ● リザルト結果を反映 #-------------------------------------------------------------------------- def self.set_result(result) @set_result_method.call(result) if @set_result_method end #-------------------------------------------------------------------------- # ● リザルト表示が終わるまでウェイト #-------------------------------------------------------------------------- def self.wait_for_result @wait_result_method.call if @wait_result_method end #-------------------------------------------------------------------------- # ● 勝利の処理 [再定義] #-------------------------------------------------------------------------- def self.process_victory play_battle_end_me replay_bgm_and_bgs display_result # リザルト生成 #~ $game_message.add(sprintf(Vocab::Victory, $game_party.name)) #~ display_exp #~ gain_gold #~ gain_drop_items #~ gain_exp SceneManager.return battle_end(0) return true end #-------------------------------------------------------------------------- # ● 獲得した経験値の表示 [再定義] #-------------------------------------------------------------------------- def self.display_result # gold $game_party.gain_gold($game_troop.gold_total) if $game_troop.gold_total > 0 # item items = [] $game_troop.make_drop_items.each do |item| $game_party.gain_item(item, 1) items.push(item) end result = FvBtResult.new(items) # exp $game_party.all_members.each do |actor| actor.gain_exp($game_troop.exp_total, !actor.battle_member?) end result.set_exp set_result(result) wait_for_result wait_for_message end end
- Galv's Animated Battlers:
#------------------------------------------------------------------------------# # Galv's Animated Battlers #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.1 #------------------------------------------------------------------------------# # 2013-05-06 - Version 1.1 - added move speed for melee attacks # 2013-05-04 - Version 1.0 - release #------------------------------------------------------------------------------# # Holder's animated battler spritesheets can be found here: # http://animatedbattlers.wordpress.com/ #------------------------------------------------------------------------------# # This is just another animated battler script that uses holder-style animated # battler sheets. There are better ones out there, this one is just my basic # implementation in an attempt to continue improving my scripting. # # This script works in the default battle system but is optimised for use with # Yanfly's battle script. Not tested with other battle scripts. Put this script # below any battle scripts you try it with. #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Note tag for ENEMIES and ACTORS #------------------------------------------------------------------------------# # # # filename is the animated spritesheet located in # # /Graphics/Battlers/ # # Required for actors, optional for enemies. # # # will not re-position themselves in front of an ally # # they are covering/substituting for. # #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------# # Note tags for SKILLS, ITEMS and STATES #------------------------------------------------------------------------------# # # # The skill, item or state will use x pose row. # # If a skill does not have this tag, it will use row 6. # # If an item does not have this tag, it will use row 5. # # If a state does not have this tag, it will use row 2. If a # # battler has multiple states, it uses the highest priority. # #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------# # Note tag for SKILLS, ITEMS and ACTORS #------------------------------------------------------------------------------# # # # Normal attacks for Actors, items being used or skills being # # used that have this tag will make the actor dash into close # # range before doing the action. x is the dash speed. # # 0 = instant. 1 is slow, higher numbers is faster # #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------# # SCRIPT CALLS #------------------------------------------------------------------------------# # # change_battler(id,"filename") # Changes actor's animated battler sheet. # #------------------------------------------------------------------------------#
($imported ||= {})["Galv_Animated_Battlers"] = true module GALV_BAT #------------------------------------------------------------------------------- # # * SETTINGS # #------------------------------------------------------------------------------- COLS = 4 # How many columns your animated spritesheet uses ROWS = 14 # How many rows your animated spritesheet uses ENEMY_FLIP = true # true = flip enemy battler image horizontally ACTOR_FLIP = false # true = flip actor battler image horizonatally HP_CRISIS = 0.25 # Remaining hp before poor status pose (0.25 = 25%) ONE_ANIM = [3,4,5,6,7,11] # Poses that will NOT keep repeating their frames
XOFFSET = 80 # horizonatal distance from opponent when using YOFFSET = 0 # vertical distance from opponent when using SXOFFSET = 40 # horizontal distance from ally when substituting SYOFFSET = 0 # vertical distance from ally when substituting #------------------------------------------------------------------------------# ACTOR_POSITIONS = [ # don't touch #------------------------------------------------------------------------------# # Set x,y locations of your actors on the battle screen #------------------------------------------------------------------------------#
[440,150], # Party member 1 [x,y] [460,180], # Party member 2 [x,y] [480,210], # Party member 3 [x,y] [500,260], # Party member 4 [x,y]
#------------------------------------------------------------------------------# ] #don't touch #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------- # POSES USED FOR SPECIAL ACTIONS: #-------------------------------------------------------------------------------
COUNTER_ATTACK = 4 # Pose when counter attacking MAGIC_REFLECT = 7 # Pose when reflecting magic EVASION = [9,8] # Move back then move forward poses to evade.
#------------------------------------------------------------------------------- # POSE INFORMATION: #------------------------------------------------------------------------------# # DEFAULT SPRITESHEET POSES (HOLDER SETUP) #------------------------------------------------------------------------------# # ROW POSE # # 0 Idle # 1 Guard # 2 Poor Status # 3 Get hit # 4 Normal Attack # 5 Use Item # 6 Use Skill # 7 Use Magic # 8 Move toward # 9 Move back # 10 Victory # 11 Battle Start # 12 Dead # 13 Spritesheet Info #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------- # # * END SETTINGS # #-------------------------------------------------------------------------------
end
#------------------------------------------------------------------------------# # OVERWRITTEN METHODS #------------------------------------------------------------------------------# # class Spriteset_Battle # - create_enemies # - create_actors # - update_actors #------------------------------------------------------------------------------#
#----------------------# #---| GAME_INTERPRETER |---------------------------------------------------- #----------------------#
class Game_Interpreter def change_battler(id,name) $game_actors[id].animated_battler = name end end # Game_Interpreter
#-------------------# #---| RPG::BASEITEM |------------------------------------------------------- #-------------------#
class RPG::BaseItem def pose if @pose.nil? if @note =~ //i @pose = $1.to_i else @pose = nil end end @pose end end # RPG::BaseItem
#----------------------# #---| GAME_BATTLERBASE |---------------------------------------------------- #----------------------#
class Game_BattlerBase alias galv_animb_gbb_appear appear def appear return if SceneManager.scene_is?(Scene_Map) galv_animb_gbb_appear end end # Game_BattlerBase
#------------------# #---| GAME_BATTLER |-------------------------------------------------------- #------------------#
class Game_Battler < Game_BattlerBase attr_accessor :animated_battler attr_accessor :pose attr_accessor :freeze_pose attr_accessor :bactivated attr_accessor :move_target attr_accessor :orx attr_accessor :ory attr_accessor :reset_pose attr_accessor :move_speed def setup_animated_battler @pose = 0 @move_speed = 0 char = actor? ? actor : enemy @animated_battler = $1 if char.note =~ //i end def do_pose(col) @reset_pose = true @pose = col @freeze_pose = true if GALV_BAT::ONE_ANIM.include?(@pose) end alias galv_animb_gbgbb_on_turn_end on_turn_end def on_turn_end galv_animb_gbgbb_on_turn_end set_idle_pose end alias galv_animb_gbgbb_on_action_end on_action_end def on_action_end galv_animb_gbgbb_on_action_end set_idle_pose end def set_idle_pose return if !@bactivated if death_state? do_pose(12) elsif guard? do_pose(1) elsif !@states.empty? do_pose(state_pose) elsif low_life? do_pose(2) else do_pose(0) end @freeze_pose = false unless GALV_BAT::ONE_ANIM.include?(@pose) end def low_life? @hp < (mhp * GALV_BAT::HP_CRISIS) end def state_pose prio = 0 prio_state = 0 @states.each { |sid| if $data_states[sid].priority > prio prio_state = sid prio = $data_states[sid].priority end } if prio_state <= 0 || !$data_states[prio_state].pose return 2 else $data_states[prio_state].pose end end
alias galv_animb_gbgbb_add_state add_state def add_state(state_id) galv_animb_gbgbb_add_state(state_id) set_idle_pose end alias galv_animb_gbgbb_remove_state remove_state def remove_state(state_id) dead = dead? galv_animb_gbgbb_remove_state(state_id) set_idle_pose if state_id != 1 && !dead? || dead end alias galv_animb_gbgbb_execute_damage execute_damage def execute_damage(user) perform_get_hit if @result.hp_damage > 0 galv_animb_gbgbb_execute_damage(user) if !$imported["YEA-BattleEngine"] SceneManager.scene.wait(15) set_idle_pose end end def perform_get_hit if !dead? && !guard? && $game_party.in_battle && @animated_battler do_pose(3) @sprite_effect_type = :get_hit end end def perform_counter_attack if !dead? && $game_party.in_battle && @animated_battler do_pose(GALV_BAT::COUNTER_ATTACK) @sprite_effect_type = :counter_attack end end def perform_magic_reflect if !dead? && $game_party.in_battle && @animated_battler do_pose(GALV_BAT::MAGIC_REFLECT) @sprite_effect_type = :counter_attack end end
def perform_victory if !dead? && @animated_battler do_pose(10) end end
def perform_enter_battle @bactivated = true if !dead? && @animated_battler @pose = 11 @sprite_effect_type = :enter_battle end end def perform_dash(dash_type,target) if !dead? && @animated_battler @move_target = target pose = dash_type == :dash_forward ? 8 : 9 do_pose(pose) @sprite_effect_type = dash_type end end def perform_travel(dash_type,target,speed) @move_target = target @move_speed = speed do_pose( @sprite_effect_type = dash_type end def moving? @move_speed > 0 end def perform_dodge if !dead? && @animated_battler do_pose(GALV_BAT::EVASION[0]) @sprite_effect_type = :dodge end end
alias galv_animb_gbgbb_on_battle_start on_battle_start def on_battle_start perform_enter_battle galv_animb_gbgbb_on_battle_start end
def init_animated_battler(i) @sprite_effect_type = :appear @bactivated = false @pose = alive? ? 11 : 12 if actor? @screen_x = GALV_BAT::ACTOR_POSITIONS[i][0] @orx = GALV_BAT::ACTOR_POSITIONS[i][0] @screen_y = GALV_BAT::ACTOR_POSITIONS[i][1] @ory = GALV_BAT::ACTOR_POSITIONS[i][1] else @orx = @screen_x @ory = @screen_y end end def reinit_battler(i) if actor? @screen_x = GALV_BAT::ACTOR_POSITIONS[i][0] @orx = GALV_BAT::ACTOR_POSITIONS[i][0] @screen_y = GALV_BAT::ACTOR_POSITIONS[i][1] @ory = GALV_BAT::ACTOR_POSITIONS[i][1] else @orx = @screen_x @ory = @screen_y end @bactivated = true end alias galv_animb_gbgbb_item_apply item_apply def item_apply(user, item) galv_animb_gbgbb_item_apply(user, item) if @result.evaded perform_dodge end end end # Game_Battler < Game_BattlerBase
#----------------# #---| GAME_ACTOR |---------------------------------------------------------- #----------------#
class Game_Actor < Game_Battler attr_accessor :screen_x attr_accessor :screen_y def screen_x; screen_x = @screen_x; end def screen_y; screen_y = @screen_y; end def screen_z; 100; end alias galv_animb_gagb_initialize initialize def initialize(actor_id) galv_animb_gagb_initialize(actor_id) setup_animated_battler @screen_x = 0 @screen_y = 0 end def sub_pose(target) if !dead? && @animated_battler return if $data_actors[@actor_id].note =~ //i @screen_x = target.screen_x - GALV_BAT::SXOFFSET @screen_y = target.screen_y - GALV_BAT::SYOFFSET @sprite_effect_type = :substitute end end def return_to_position if !dead? && @animated_battler @screen_x = @orx @screen_y = @ory end end end # Game_Actor < Game_Battler
#----------------# #---| GAME_ENEMY |---------------------------------------------------------- #----------------#
class Game_Enemy < Game_Battler alias galv_animb_gegb_initialize initialize def initialize(index, enemy_id) galv_animb_gegb_initialize(index, enemy_id) setup_animated_battler end def sub_pose(target) if !dead? && @animated_battler return if $data_enemies[@enemy_id].note =~ //i @screen_x = target.screen_x + GALV_BAT::SXOFFSET @screen_y = target.screen_y + GALV_BAT::SYOFFSET @sprite_effect_type = :substitute end end def return_to_position if !dead? && @animated_battler @screen_x = @orx @screen_y = @ory end end end # Game_Enemy < Game_Battler
#-------------------# #---| BATTLEMANAGER |------------------------------------------------------- #-------------------#
module BattleManager class << self alias galv_animb_bm_process_victory process_victory end def self.process_victory $game_party.battle_members.each { |actor| actor.perform_victory } galv_animb_bm_process_victory end end # BattleManager
#------------------# #---| SCENE_BATTLE |-------------------------------------------------------- #------------------#
class Scene_Battle < Scene_Base alias galv_animb_sbsb_start start def start position_battlers galv_animb_sbsb_start end
def position_actors $game_party.battle_members.each_with_index { |battler,i| battler.reinit_battler(i) } @spriteset.refresh_actors end def position_battlers galv_all_battle_members.each_with_index { |battler,i| battler.init_animated_battler(i) } end def galv_all_battle_members $game_party.battle_members + $game_troop.members end alias galv_animb_sbsb_show_animation show_animation def show_animation(targets, animation_id) @move_target = targets[0] check_dash set_pose galv_animb_sbsb_show_animation(targets, animation_id) end def check_dash move = move_to_target if move > 0 @subject.perform_travel(:move_forward,@move_target,move) update_for_wait while @subject.moving? elsif move == 0 @subject.perform_dash(:dash_forward,@move_target) wait(30) end end def move_to_target return -1 if no_action && !@moveitem @moveitem ||= @subject.current_action.item return $1.to_i if @moveitem.note =~ //i if @moveitem.is_a?(RPG::Skill) && @moveitem.id == 1 char = @subject.actor? ? $data_actors[@subject.id] : $data_enemies[@subject.enemy_id] return $1.to_i if char.note =~ //i end return -1 end def no_action !@subject || !@subject.current_action || !@subject.current_action.item end alias galv_animb_sbsb_process_action_end process_action_end def process_action_end if @subject.screen_x != @subject.orx @subject.perform_dash(:dash_back,@subject) wait(25) end galv_animb_sbsb_process_action_end @moveitem = nil end alias galv_animb_sbsb_invoke_counter_attack invoke_counter_attack def invoke_counter_attack(target,item) target.perform_counter_attack galv_animb_sbsb_invoke_counter_attack(target,item) end alias galv_animb_sbsb_invoke_magic_reflection invoke_magic_reflection def invoke_magic_reflection(target, item) target.perform_magic_reflect galv_animb_sbsb_invoke_magic_reflection(target, item) end def set_pose return if no_action item = @subject.current_action.item if item.is_a?(RPG::Skill) case item.id when 2 # guard @subject.do_pose(1) when 1 # attack @subject.do_pose(4) wait(20) if $imported["YEA-BattleEngine"] else unique = item.pose ? item.pose : 6 @subject.do_pose(unique) end elsif item.is_a?(RPG::Item) unique = item.pose ? item.pose : 5 @subject.do_pose(unique) wait(30) if $imported["YEA-BattleEngine"] end end end # Scene_Battle < Scene_Base
#----------------------# #---| WINDOW_BATTLELOG |---------------------------------------------------- #----------------------#
class Window_BattleLog < Window_Selectable alias galv_animb_wblws_display_substitute display_substitute def display_substitute(substitute, target) substitute.sub_pose(target) galv_animb_wblws_display_substitute(substitute, target) end end
#----------------------# #---| SPRITESET_BATTLE |---------------------------------------------------- #----------------------#
class Spriteset_Battle #OVERWRITE def create_enemies @enemy_sprites = $game_troop.members.reverse.collect do |enemy| if enemy.animated_battler Sprite_AnimBattler.new(@viewport1, enemy) else Sprite_Battler.new(@viewport1, enemy) end end end # OVERWRITE def create_actors @actor_sprites = $game_party.battle_members.reverse.collect do |actor| Sprite_ActorBattler.new(@viewport1, actor) end end # OVERWRITE def update_actors need_update = false @actor_sprites.each_with_index do |sprite, i| sprite.battler = $game_party.battle_members[i] if sprite.battler sprite.update else need_update = true end end need_update = true if @actor_sprites.count < $game_party.battle_members.count if need_update SceneManager.scene.position_actors end end def refresh_actors dispose_actors create_actors end end # Spriteset_Battle
#--------------------# #---| SPRITE_BATTLER |------------------------------------------------------ #--------------------#
class Sprite_Battler < Sprite_Base alias galv_animb_spritebsb_update update def update if @battler && @battler.animated_battler super else galv_animb_spritebsb_update end end end # Sprite_Battler < Sprite_Base
#------------------------# #---| SPRITE_ANIMBATTLER |-------------------------------------------------- #------------------------#
class Sprite_AnimBattler < Sprite_Battler def initialize(viewport, battler = nil) init_variables super(viewport,battler) end
def init_variables @pattern = 0 @speed_timer = 0 @pose = 0 end
def update if @battler && @battler.animated_battler update_bitmap update_pose update_src_rect update_anim update_position setup_new_effect setup_new_animation update_effect end super end
def update_bitmap new_bitmap = Cache.battler(@battler.animated_battler, @battler.battler_hue) if bitmap != new_bitmap self.bitmap = new_bitmap spritesheet_normal init_visibility end end
def spritesheet_normal @cw = bitmap.width / GALV_BAT::COLS @ch = bitmap.height / GALV_BAT::ROWS self.ox = @cw / 2 self.oy = @ch set_mirror end
def set_mirror self.mirror = GALV_BAT::ENEMY_FLIP end
def update_pose if @pose != @battler.pose @pattern = 0 @pose = @battler.pose end if @battler.reset_pose @pose = 0 @battler.reset_pose = false end end
def update_src_rect if @pattern >= GALV_BAT::COLS @pattern = 0 unless freeze_pose? end sx = @pattern * @cw sy = @battler.pose * @ch self.src_rect.set(sx, sy, @cw, @ch) end
def freeze_pose? @battler.freeze_pose && @pattern == GALV_BAT::COLS - 1 end
def update_anim return if !@battler.bactivated @speed_timer += 1 if @speed_timer > 8 @pattern += 1 unless freeze_pose? @speed_timer = 0 end end
def update_position self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end
def start_effect(effect_type) @effect_type = effect_type case @effect_type when :counter_attack,:magic_reflect,:get_hit @effect_duration = 40 @battler_visible = true when :enter_battle @effect_duration = 35 @battler_visible = true when :dash_forward,:dash_back @effect_duration = 15 @battler_visible = true when :move_forward @effect_duration = 500 @move_duration = @effect_duration @battler_visible = true when :dodge @effect_duration = 20 @battler_visible = true when :substitute @effect_duration = 20 @battler_visible = true end super end
def update_effect if @effect_duration > 0 case @effect_type when :get_hit, :substitute update_generic_pose when :counter_attack,:magic_reflect update_counter when :enter_battle update_enter_battle when :dash_forward update_dash_forward when :move_forward update_move_forward when :dash_back update_dash_back when :dodge update_dodge end end super end
def revert_to_normal return if do_revert? super spritesheet_normal end def do_revert? @effect_type == :whiten || @battler.dead? end
def update_generic_pose if @effect_duration == 1 @battler.return_to_position @battler.set_idle_pose end end def xoff; @battler.actor? ? GALV_BAT::XOFFSET : -GALV_BAT::XOFFSET; end def yoff; @battler.actor? ? GALV_BAT::YOFFSET : -GALV_BAT::YOFFSET; end
def update_dash_forward if @battler.actor? && @battler.screen_x > Graphics.width / 2 @battler.screen_x -= 3 elsif @battler.enemy? && @battler.screen_x < Graphics.width / 2 @battler.screen_x += 3 end update_disappear if @effect_duration == 1 @battler.screen_x = @battler.move_target.screen_x + xoff @battler.screen_y = @battler.move_target.screen_y + yoff start_effect(:appear) end end def update_dash_back if @battler.actor? && @battler.screen_x < Graphics.width / 2 @battler.screen_x += 3 elsif @battler.enemy? && @battler.screen_x > Graphics.width / 2 @battler.screen_x -= 3 end update_disappear if @effect_duration == 1 @battler.screen_x = @battler.move_target.orx @battler.screen_y = @battler.move_target.ory start_effect(:appear) end end def update_move_forward if @battler.actor? @battler.screen_x -= x_difference(@battler,@battler.move_target) elsif @battler.enemy? @battler.screen_x += x_difference(@battler,@battler.move_target) end @battler.screen_y += y_difference(@battler,@battler.move_target) end
def y_difference(bat,tar) yof = bat.actor? ? yoff : -yoff y_diff = bat.ory - (tar.screen_y + yof) x_diff = bat.orx - (tar.screen_x + xoff) y_move = y_diff.to_f / (x_diff.to_f / [@battler.move_speed,1].max).to_f return bat.actor? ? -y_move : y_move end def x_difference(bat,tar) if bat.actor? && bat.screen_x <= (tar.screen_x + xoff) || bat.enemy? && bat.screen_x >= (tar.screen_x + xoff) @battler.move_speed = 0 @effect_duration = 1 return 0 end return @battler.move_speed end def update_dodge if @effect_duration == 1 @battler.screen_x = @battler.orx @battler.screen_y = @battler.ory @battler.set_idle_pose elsif @effect_duration >= 10 @battler.actor? ? @battler.screen_x += 3 : @battler.screen_x -= 3 else @battler.pose = GALV_BAT::EVASION[1] @battler.actor? ? @battler.screen_x -= 3 : @battler.screen_x += 3 end end
def update_enter_battle if @effect_duration == 1 @battler.bactivated = true @battler.set_idle_pose end end
def update_counter self.color.set(255, 255, 255, 0) self.color.alpha = 128 - (26 - @effect_duration) * 10 @battler.set_idle_pose if @effect_duration == 1 end
def update_collapse; end end # Sprite_AnimBattler < Sprite_Base
#-------------------------# #---| SPRITE_ACTORBATTLER |------------------------------------------------- #-------------------------#
class Sprite_ActorBattler < Sprite_AnimBattler def initialize(viewport, battler = nil) super(viewport,battler) end def dispose; super; end def update; super; end
def set_mirror self.mirror = GALV_BAT::ACTOR_FLIP end
def update_position self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end def init_visibility self.opacity = 255 end end # Sprite_ActorBattler < Sprite_AnimBattler
#------------------------# #---| WINDOW_BATTLEENEMY |-------------------------------------------------- #------------------------#
class Window_BattleEnemy < Window_Selectable if $imported["YEA-BattleEngine"] def create_flags set_select_flag(:any) select(-1) return if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? select(-1) elsif $game_temp.battle_aid.for_all? select(-1) set_select_flag(:all) elsif $game_temp.battle_aid.for_random? select(-1) set_select_flag(:random) end end end end # Window_BattleEnemy < Window_Selectable
- Windows Icon Command:
#============================================================================== # ■ VXAce-RGSS3-22 ワイドアイコンコマンド [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ # ・アイコンタイプのアクターコマンドです。 # ・コマンド数は5つまで推奨 #==============================================================================
#============================================================================== # ■ Window_ActorIconCmd #============================================================================== class Window_ActorIconCmd < Window_HorzCommand # アクターポジションに合わせる # true : Game_Actor#screen_x, screen_yに合わせる ACTPOS = true # 固定ポジション(ACTPOS=false用) FIXPOS = [0, 0] # [x, y]
# スキルタイプのアイコン SKL_ICON = [0, 115, 119, 14] ITM_ICON = 261 # アイテムのアイコン
# 背景色 BACK_COLOR = Color.new(0,0,0,128)
#-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0) self.openness = 0 self.opacity = 0 deactivate @actor = nil end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 2 end #-------------------------------------------------------------------------- # ● 下端パディングの更新 #-------------------------------------------------------------------------- def update_padding_bottom end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def item_width return 24 end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width item_width * col_max + standard_padding * 2 end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return 1 end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 5 end #-------------------------------------------------------------------------- # ● 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing return 0 end #-------------------------------------------------------------------------- # ● ウィンドウ内容の高さを計算 #-------------------------------------------------------------------------- def contents_height item_height * 2 end #-------------------------------------------------------------------------- # ● ウィンドウ内容の幅を計算 #-------------------------------------------------------------------------- def contents_width [super, item_width * col_max].max end #-------------------------------------------------------------------------- # ● 項目の選択 #-------------------------------------------------------------------------- def select(index) super(index) redraw_cmd_name if item_max > 0 end #-------------------------------------------------------------------------- # ● ずらすX位置 #-------------------------------------------------------------------------- def icon_start_x return 0 if col_max <= item_max (item_width * (col_max - item_max) / 2.0).truncate end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.x += icon_start_x rect.y += item_height rect end #-------------------------------------------------------------------------- # ● コマンド名を描画する矩形の取得 #-------------------------------------------------------------------------- def cmd_rect rect = item_rect(top_col) rect.x -= icon_start_x rect.y = 0 rect.width = item_width * col_max rect end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return unless @actor add_attack_command add_skill_commands add_guard_command add_item_command end #-------------------------------------------------------------------------- # ● 攻撃コマンドをリストに追加 #-------------------------------------------------------------------------- def add_attack_command weapon = @actor.weapons icon = weapon.empty? ? $data_skills[@actor.attack_skill_id].icon_index : weapon[0].icon_index add_command([Vocab::attack, icon], :attack, @actor.attack_usable?) end #-------------------------------------------------------------------------- # ● スキルコマンドをリストに追加 #-------------------------------------------------------------------------- def add_skill_commands @actor.added_skill_types.sort.each do |stype_id| name = $data_system.skill_types[stype_id] add_command([name, SKL_ICON[stype_id]], :skill, true, stype_id) end end #-------------------------------------------------------------------------- # ● 防御コマンドをリストに追加 #-------------------------------------------------------------------------- def add_guard_command icon = $data_skills[@actor.guard_skill_id].icon_index add_command([Vocab::guard, icon], :guard, @actor.guard_usable?) end #-------------------------------------------------------------------------- # ● アイテムコマンドをリストに追加 #-------------------------------------------------------------------------- def add_item_command add_command([Vocab::item, ITM_ICON], :item) end #-------------------------------------------------------------------------- # ● コマンド名の再描画 #-------------------------------------------------------------------------- def redraw_cmd_name contents.clear_rect(cmd_rect) draw_cmd_name end #-------------------------------------------------------------------------- # ● コマンド名の描画 #-------------------------------------------------------------------------- def draw_cmd_name return if @index < 0 change_color(normal_color, command_enabled?(@index)) rect = cmd_rect contents.fill_rect(rect, BACK_COLOR) draw_text(rect, command_name(@index)[0], alignment) end #-------------------------------------------------------------------------- # ● 全項目の描画 #-------------------------------------------------------------------------- def draw_all_items draw_cmd_name super end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) draw_icon(command_name(index)[1], rect.x, rect.y, command_enabled?(index)) end #-------------------------------------------------------------------------- # ● 決定ハンドラの呼び出し #-------------------------------------------------------------------------- def call_ok_handler close super end #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- def setup(actor) @actor = actor clear_command_list make_command_list select(0) refresh if ACTPOS self.x = actor.screen_x - 70 self.y = actor.screen_y - 150 - self.height else self.x = FIXPOS[0] self.y = FIXPOS[1] end show.activate.open end end
- Actor Command:
#============================================================================== # ■ VXAce-RGSS3-23 リッチアクターコマンド [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ #・戦闘時のコマンド表示方法を変更します。 #・戦闘コマンドごとにアイコン表示がつきます # - 攻撃 :装備武器のアイコン + 設定にある攻撃アイコン を描画する # - スキル・防御・アイテム :設定にあるアイコンのみ描画する #・アクター個別のコマンド名を使うことができます #============================================================================== module RICH_ACTCMD # アクターポジションに合わせる # true : Game_Actor#screen_x, screen_yに合わせる ACTPOS = true # 固定ポジション(ACTPOS=false用) FIXPOS = [0, 0] # [x, y] #-------------------------------------------------------------------------- # ● ファイル定義 #-------------------------------------------------------------------------- # IconIndex(Graphics/System/IconSet.png) HAND = 116 # 武器なし(素手)のアイコンIndex GUARD = 161 # 防御のアイコンIndex ITEM = 260 # アイテムのアイコンIndex # TEXT背景色 BACK = Color.new(0,0,0,128) # 表示最大数 CMD_MAX = 4 # 「攻撃」の表示形式 # 0: システム用語(Vocab.attack) # 1: 武器名 # 2: 武器のメモ欄から取得 … @cmd[コマンド名] W_NAME = 1 #-------------------------------------------------------------------------- # ● スキルタイプコマンド設定 #-------------------------------------------------------------------------- # スキルタイプのアイコンIndex SKILL = [] # SKILL[スキルタイプID] = アイコンIndex SKILL[1] = 115 SKILL[2] = 119 #-------------------------------------------------------------------------- # ● 個別コマンド設定 #-------------------------------------------------------------------------- # アクター別のコマンド名 ACT_CMD_T = [] # ここは変更禁止 # ACT_CMD_T[アクターID] = [攻撃, 防御, アイテム] # ※nilを入れるとW_NAMEの設定になります ACT_CMD_T[1] = ["斬撃", nil, nil] ACT_CMD_T[2] = ["突撃", nil, nil] ACT_CMD_T[3] = [ nil, nil, nil] ACT_CMD_T[4] = [ nil, nil, nil] # アクター別のコマンド用アイコンIndex ACT_CMD_I = [] # ここは変更禁止 # ACT_CMD_I[アクターID] = [攻撃, 防御, アイテム] # ※nilを入れるとファイル定義の設定と同じファイルになります ACT_CMD_I[1] = [nil, nil, nil] ACT_CMD_I[2] = [nil, nil, nil] ACT_CMD_I[3] = [nil, nil, nil] ACT_CMD_I[4] = [nil, nil, nil] #-------------------------------------------------------------------------- # ● その他 #-------------------------------------------------------------------------- # 基準Y座標 Y = 220 # TEXT背景の描画幅W、高さH W = 120 H = 28 # 横幅のモーション速さ [ 高速移動時、低速移動時 ] W_F = [40, 10] # 縦移動のモーション速さ[ 高速移動時、低速移動時 ] M_F = [40, 10] # 選択外コマンドの不透明度 OP = 100 =begin 「高速移動」と「低速移動」はコマンド切替時の動作のことです。 - 高速移動 : 次に選択する項目のモーション - 低速移動 : 前回選択した項目のモーション =end end
#============================================================================== # ■ RPG::Weapon #============================================================================== class RPG::Weapon < RPG::EquipItem #-------------------------------------------------------------------------- # ● コマンド名 #-------------------------------------------------------------------------- def cmd_name cmd = @note.scan(/@cmd\[(.+)\]/)[0] return (cmd.nil? ? Vocab.attack : cmd[0]) # 設定なければVocabから取得 end end
#============================================================================== # ■ WindowBattleActorCmd #------------------------------------------------------------------------------ # バトル画面で、アクターのコマンド一覧を表示するウィンドウ?です。 #============================================================================== class WindowBattleActorCmd < Window_Command include RICH_ACTCMD #-------------------------------------------------------------------------- # ● define #-------------------------------------------------------------------------- M_WAIT = 0 # 停止 M_CUR_UP = 1 # ↑移動 M_CUR_DW = 2 # ↓移動 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @cmd_sprite = [] super(0, Y) @base_y = Y hide.deactivate self.opacity = 0 self.openness = 0 end #-------------------------------------------------------------------------- # ● 偽装 #-------------------------------------------------------------------------- def open?; true; end def open; show; end def close; hide; end #-------------------------------------------------------------------------- # ● コマンドリスト初期化 #-------------------------------------------------------------------------- def clear_command_list super dispose_sprites end #-------------------------------------------------------------------------- # ● コマンドリスト生成 #-------------------------------------------------------------------------- def make_command_list return unless @actor add_attack_command add_skill_commands add_guard_command add_item_command create_sprites end #-------------------------------------------------------------------------- # ● コマンドスプライト生成 #-------------------------------------------------------------------------- def create_sprites item_max.times {|i| @cmd_sprite.push(SpriteCmdIcon.new) } end #-------------------------------------------------------------------------- # ● コマンドスプライト生成 #-------------------------------------------------------------------------- def dispose_sprites @cmd_sprite.each {|s| s.dispose} @cmd_sprite.clear end #-------------------------------------------------------------------------- # ● コマンドの追加 #-------------------------------------------------------------------------- def add_command(name, symbol, enabled = true, icon=0, ext = nil) @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :icon=>icon, :ext=>ext}) end #-------------------------------------------------------------------------- # ● アイコンテキスト取得 #-------------------------------------------------------------------------- def vocab_text(cmd_i) case cmd_i when 0; return attack_text when 1; return Vocab::guard when 2; return Vocab::item end end def vocab_icon(cmd_i) case cmd_i when 0; return attack_icon when 1; return GUARD when 2; return ITEM end end def attack_text w = @actor.weapons unless w.empty? case W_NAME when 1; return w[0].name when 2; return w[0].cmd_name end end return Vocab::attack end def attack_icon w = @actor.weapons return HAND if w.empty? return w[0].icon_index end def set_i(set, cmd_i, vocab) (set[@actor.id].nil? or set[@actor.id][cmd_i].nil?) ? vocab : set[@actor.id][cmd_i] end def icon_text(cmd_i) [set_i(ACT_CMD_T, cmd_i, vocab_text(cmd_i)), set_i(ACT_CMD_I, cmd_i, vocab_icon(cmd_i))] end #-------------------------------------------------------------------------- # ● 攻撃コマンドをリストに追加 #-------------------------------------------------------------------------- def add_attack_command it = icon_text(0) add_command(it[0], :attack, @actor.attack_usable?, it[1]) end #-------------------------------------------------------------------------- # ● スキルコマンドをリストに追加 #-------------------------------------------------------------------------- def add_skill_commands @actor.added_skill_types.sort.each do |stype_id| name = $data_system.skill_types[stype_id] icon = SKILL[stype_id] add_command(name, :skill, true, icon, stype_id) end end #-------------------------------------------------------------------------- # ● 防御コマンドをリストに追加 #-------------------------------------------------------------------------- def add_guard_command it = icon_text(1) add_command(it[0], :guard, @actor.guard_usable?, it[1]) end #-------------------------------------------------------------------------- # ● アイテムコマンドをリストに追加 #-------------------------------------------------------------------------- def add_item_command it = icon_text(2) add_command(it[0], :item, true, it[1]) end #-------------------------------------------------------------------------- # ● オブジェクト開放 #-------------------------------------------------------------------------- def dispose dispose_sprites super end #-------------------------------------------------------------------------- # ● 表示/非表示 切り替え #-------------------------------------------------------------------------- def visible=(flag) @cmd_sprite.each_index {|i| @cmd_sprite[i].visible = flag & (real_i(i) < CMD_MAX)} end #-------------------------------------------------------------------------- # ● X座標変更 #-------------------------------------------------------------------------- def x=(x) @cmd_sprite.each {|s| s.set_x(x+} end #-------------------------------------------------------------------------- # ● Y座標変更 #-------------------------------------------------------------------------- def y=(y) @base_y = y @cmd_sprite.each_index {|i| @cmd_sprite[i].set_y(y + real_i(i) * H)} end #-------------------------------------------------------------------------- # ● Index変更 #-------------------------------------------------------------------------- def index=(i) return if item_max == 0 @index = (i + 1) % item_max move(M_CUR_UP) reset end #-------------------------------------------------------------------------- # ● RealIndex #-------------------------------------------------------------------------- def real_i(i) ((i - @index + item_max + 1) % item_max) end #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- def setup(actor) @actor = actor clear_command_list make_command_list refresh self.index = 0 if ACTPOS self.x = actor.screen_x - 70 self.y = actor.screen_y - 210 else self.x = FIXPOS[0] self.y = FIXPOS[1] end activate.show end #-------------------------------------------------------------------------- # ● 決定ハンドラの呼び出し #-------------------------------------------------------------------------- def call_ok_handler hide super end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) @cmd_sprite[index].refresh(@list[index][:icon], command_name(index), command_enabled?(index)) end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false) move(M_CUR_DW) end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false) move(M_CUR_UP) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_motion end #-------------------------------------------------------------------------- # ● モーション設定 #-------------------------------------------------------------------------- def move(mode) case mode when M_CUR_UP @index = (@index - 1 + item_max) % item_max fast_index = (@index - 1 + item_max) % item_max when M_CUR_DW fast_index = (@index - 1 + item_max) % item_max @index = (@index + 1) % item_max else; return end @mode = mode @cmd_sprite.each_index do |i| @cmd_sprite[i].target(@base_y + real_i(i) * H, i == @index, i == fast_index) @cmd_sprite[i].visible = (real_i(i) < CMD_MAX) end end #-------------------------------------------------------------------------- # ● モーション動作 #-------------------------------------------------------------------------- def update_motion return if @mode == M_WAIT moving = false @cmd_sprite.each {|s| moving |= s.update } @mode = M_WAIT unless moving end #-------------------------------------------------------------------------- # ● モーションリセット #-------------------------------------------------------------------------- def reset @cmd_sprite.each { |s| s.reset} @mode = M_WAIT end end
class SpriteCmdIcon < Sprite OPLUS = 25 include RICH_ACTCMD #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(nil) self.bitmap = Bitmap.new(28, H) @view = Viewport.new(20, Y, W, H) @view.z = 1000 @t_sprite = Sprite.new(@view) @t_sprite.bitmap = Bitmap.new(W, H) self.z = 1001 end #-------------------------------------------------------------------------- # ● オブジェクト開放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super @t_sprite.bitmap.dispose @t_sprite.dispose @view.dispose end #-------------------------------------------------------------------------- # ● アイコン描画 #-------------------------------------------------------------------------- def refresh(icon, text, enabled=true) bitmap.clear draw_icon(icon, enabled) draw_text(text, enabled) end #-------------------------------------------------------------------------- # ● アイコン描画 #-------------------------------------------------------------------------- def draw_icon(icon_index, enabled=true) return if icon_index == nil bit = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) bitmap.blt(2, (H-24)/2, bit, rect, enabled ? 255 : 128) end #-------------------------------------------------------------------------- # ● テキスト描画 #-------------------------------------------------------------------------- def draw_text(text, enabled=true) @t_sprite.bitmap.clear @t_sprite.bitmap.font.color = text_color(0) @t_sprite.bitmap.font.color.alpha = enabled ? 255 : 128 @t_sprite.bitmap.fill_rect(0,0,W,H, RICH_ACTCMD::BACK) @t_sprite.bitmap.draw_text(H+4, 0, W-22, H, text) end #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号(0..31) #-------------------------------------------------------------------------- def text_color(n) Cache.system("Window").get_pixel(64 + (n % * 8, 96 + (n / * end #-------------------------------------------------------------------------- # ● X座標変更 #-------------------------------------------------------------------------- def set_x(x) self.x = x r = @t_sprite.viewport.rect @t_sprite.viewport.rect.set(x, r.y, r.width, r.height) end #-------------------------------------------------------------------------- # ● Y座標変更 #-------------------------------------------------------------------------- def set_y(y) self.y = y r = @t_sprite.viewport.rect @t_sprite.viewport.rect.set(r.x, y, r.width, r.height) end #-------------------------------------------------------------------------- # ● Y座標、幅変更 #-------------------------------------------------------------------------- def change(y, w) self.y = y r = @t_sprite.viewport.rect @t_sprite.viewport.rect.set(r.x, y, w, r.height) end #-------------------------------------------------------------------------- # ● 不透明度変更 #-------------------------------------------------------------------------- def opacity=(o) super(o) @t_sprite.opacity = o end #-------------------------------------------------------------------------- # ● 可視状態変更 #-------------------------------------------------------------------------- def visible=(flag) super(flag) @t_sprite.visible = flag end #-------------------------------------------------------------------------- # ● 座標目標設定 #-------------------------------------------------------------------------- def target(y, enable=true, fast=false) @target_y = y @target_opacity = enable ? 255 : OP @target_w = enable ? W : 28 @m_f = fast ? M_F[0] : M_F[1] @w_f = enable ? W_F[0] : W_F[1] end #-------------------------------------------------------------------------- # ● 座標確定 #-------------------------------------------------------------------------- def reset change(@target_y, @target_w) self.opacity = @target_opacity end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update moving = false if self.y != @target_y or @t_sprite.viewport.rect.width != @target_w y = calc_diff(self.y, @target_y, @m_f) w = calc_diff(@t_sprite.viewport.rect.width, @target_w, @w_f) change(y, w) moving = true end if self.opacity != @target_opacity self.opacity = calc_diff(self.opacity, @target_opacity, OPLUS) moving = true end return moving end #-------------------------------------------------------------------------- # ● 目標との差を計算 #-------------------------------------------------------------------------- def calc_diff(org, target, step) plus = org < target ? step : -step return ( (org - target).abs > step ? (org + plus) : target ) end end
|
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 15:12 | |
| - MOG Active Chain:
#============================================================================== # +++ MOG - Active Chain Commands (v1.6) +++ #============================================================================== # By Moghunter # http://www.atelier-rgss.com/ #============================================================================== # Permite combinar (Linkar) ataques consecutivos através do uso de # sequência de botões. #============================================================================== # Arquivos necessários. Graphics/System/ # # Chain_Command.png # Chain_Battle_Layout.png # Chain_Battle_Meter.png # #============================================================================== # UTILIZAÇÃO #============================================================================== # No banco de dados use o sequinte comentário para linkar as ações. # # # # X - ID da habilidade. #==============================================================================
module MOG_CHAIN_ACTIONS #============================================================================== # CHAIN_ACTIONS = { SKILL_ID => [COMMAND] } # # SKILL_ID = ID da habilidade no banco de dados. # COMMANDS = Defina aqui a sequência de botões. # (Para fazer a sequência use os comandos abaixo) # # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W" # # Exemplo de utilização # # CHAIN_SWITCH_COMMAND = { # 25=>["Down","D","S","Right"], # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"], # 80=>["Shift","D"] # } #============================================================================== CHAIN_ACTIONS = { 29=>["Left","Up","Right","Down"], 52=>["Up","Down","Left","Right","Z"], 70=>["X","Right","Left","Z","Z"], 138=>["X"], 139=>["A","S"], 140=>["Z","D","X"], 141=>["Up","Down"], 142=>["Left","Right","Z"], 999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S", "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"] } #Definição do tempo limite para pressionar o botão. CHAIN_INPUT_DURATION = 60 #60 = 1s #Som ao acertar. CHAIN_RIGHT_SE = "Chime1" #Som ao errar. CHAIN_WRONG_SE = "Buzzer1" #Definição do som ao ativar o sistema de chain. CHAIN_START_SE = "Open1" #Definição da posição do botão. CHAIN_SPRITE_POSITION = [0,0] #Posição do layout do medidor. CHAIN_LAYOUT_POSITION = [1,-7] #Posição do medidor de tempo. CHAIN_METER_POSITION = [0,-6] #Posição do Ícone CHAIN_ICON_POSITION = [0,-32] #Definição da palavra Chain. CHAIN_COMMAND_WORD = "Chain Action!" #Definição das palavras de erro. CHAIN_MISSED_WORDS = ["Missed!", "Timeover"] #Definição da posição da palavra. CHAIN_COMMAND_WORD_POSITION = [0,0] #Definição do nome da fonte. CHAIN_WORD_FONT_NAME = "Georgia" #Definição do tamanho da fonte CHAIN_WORD_FONT_SIZE = 20 #Definição da cor da fonte CHAIN_WORD_FONT_COLOR = Color.new(255,255,255) #Prioridade do sprite. CHAIN_SPRITE_Z = 100 end #============================================================================== # ● Histórico (Version History) #============================================================================== # v 1.5 - Melhoria na performance #==============================================================================
#============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :chain_actions #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_chain_actions_initialize initialize def initialize @chain_actions = [0,0,0,false] mog_chain_actions_initialize end end
#============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● Use Item #-------------------------------------------------------------------------- alias mog_chain_actions_use_item use_item def use_item check_chain_targets mog_chain_actions_use_item execute_chain_actions end #-------------------------------------------------------------------------- # ● Check Chain Command Position #-------------------------------------------------------------------------- def check_chain_command_position targets = @subject.current_action.make_targets.compact return if targets == nil for i in targets $game_temp.chain_actions = [i.screen_x,i.screen_y,true] break end end #-------------------------------------------------------------------------- # ● Check Chain Targets #-------------------------------------------------------------------------- def check_chain_targets return if @subject == nil targets = @subject.current_action.make_targets.compact return if targets == nil if @subject.current_action.item.scope == 1 or @subject.current_action.item.scope == 7 or @subject.current_action.item.scope == 9 or @subject.current_action.item.scope == 10 or @subject.current_action.item.scope == 11 @pre_target = targets[0] @pre_target_hp = @pre_target.hp else @pre_target = nil @pre_target_hp = nil end end #-------------------------------------------------------------------------- # ● Execute Chain Actions #-------------------------------------------------------------------------- def execute_chain_actions return if !can_execute_chain_actions_base? if @pre_target != nil return if @pre_target.dead? return if !@pre_target.result.hit? and @pre_target.hp == @pre_target_hp end check_chain_command_position action_id = @subject.current_action.item.note =~ //i ? $1.to_i : nil return if action_id == nil or action_id < 1 chain_command_sequence = MOG_CHAIN_ACTIONS::CHAIN_ACTIONS[action_id] $game_temp.chain_actions[2] = action_id if can_execute_chain_sequence?(chain_command_sequence) chain_sq = Chain_Actions.new(chain_command_sequence,$game_temp.chain_actions) loop do unless @spriteset.animation? chain_sq.update Input.update end chain_sq.update_skill_name @spriteset.update Graphics.update break if chain_sq.phase == 9 end action_id = nil if !chain_sq.success chain_sq.dispose end return if action_id == nil @subject.input.set_skill(action_id) $game_temp.chain_actions = [0,0,0,false] execute_action end #-------------------------------------------------------------------------- # ● Can Execute Chain Sequence? #-------------------------------------------------------------------------- def can_execute_chain_sequence?(chain_command_sequence = nil) return false if chain_command_sequence == nil return true end
#-------------------------------------------------------------------------- # ● Can Execute Chain Actions Base #-------------------------------------------------------------------------- def can_execute_chain_actions_base? return false if @subject == nil return false if @subject.dead? return false if @subject.is_a?(Game_Enemy) return false if @subject.current_action == nil for i in @subject.states return false if i.restriction > 0 end return false if $game_party.members.empty? return false if $game_party.all_dead? return false if $game_troop.all_dead? return true end end #============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :cache_active_chain #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_active_chain_initialize initialize def initialize mog_active_chain_initialize cache_act_chain end #-------------------------------------------------------------------------- # ● Cache Act Chain #-------------------------------------------------------------------------- def cache_act_chain @cache_active_chain = [] @cache_active_chain.push(Cache.system("IconSet")) @cache_active_chain.push(Cache.system("Chain_Battle_Layout")) @cache_active_chain.push(Cache.system("Chain_Battle_Meter")) @cache_active_chain.push(Cache.system("Chain_Battle_Command")) end end
#============================================================================== # ■ Spriteset Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_active_chain_commands_initialize initialize def initialize $game_temp.cache_act_chain mog_active_chain_commands_initialize end end
#============================================================================== # ■ Chain Actions #============================================================================== class Chain_Actions include MOG_CHAIN_ACTIONS attr_accessor :phase attr_accessor :success #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(sequence,chain_temp) $game_temp.chain_actions[3] = true @chain_command = sequence @x = chain_temp[0] + CHAIN_SPRITE_POSITION[0] @y = chain_temp[1] + CHAIN_SPRITE_POSITION[1] @skill = $data_skills[chain_temp[2]] @skillname = @skill.name @duration = [CHAIN_INPUT_DURATION, CHAIN_INPUT_DURATION] @phase = 0 @success = false @com = 0 @com_index = 0 @initial_wait = 1 @wrong_commnad = [false,0,0] Audio.se_play("Audio/SE/" + CHAIN_START_SE, 100, 100) rescue nil create_button_sprite create_skill_name create_icon create_meter end
#-------------------------------------------------------------------------- # ● Create Icon #-------------------------------------------------------------------------- def create_icon @icon_image = $game_temp.cache_active_chain[0] @icon_sprite = Sprite.new @icon_sprite.bitmap = Bitmap.new(24,24) @icon_sprite.z = CHAIN_SPRITE_Z + 1 @org_x2 = @x - 12 + CHAIN_ICON_POSITION[0] - @center @icon_sprite.x = @org_x2 - 50 @icon_sprite.y = @y + CHAIN_ICON_POSITION[1] icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24) @icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect) end
#-------------------------------------------------------------------------- # ● Create Meter #-------------------------------------------------------------------------- def create_meter @meter_layout = Sprite.new @meter_layout.bitmap = $game_temp.cache_active_chain[1] @meter_layout.z = CHAIN_SPRITE_Z @meter_layout.x = @x - (@meter_layout.width / 2) + CHAIN_LAYOUT_POSITION[0] @meter_layout.y = @y + CHAIN_LAYOUT_POSITION[1] @meter_image = $game_temp.cache_active_chain[2] @meter_cw = @meter_image.width @meter_ch = @meter_image.height @meter = Sprite.new @meter.bitmap = Bitmap.new(@meter_image.width, @meter_image.height) @meter.z = CHAIN_SPRITE_Z + 1 @meter.x = @x - (@meter_image.width / 2) + CHAIN_METER_POSITION[0] @meter.y = @y + CHAIN_METER_POSITION[1] @meter.visible = false @meter_layout.visible = false update_meter end #-------------------------------------------------------------------------- # ● Update Meter #-------------------------------------------------------------------------- def update_meter return if @meter == nil @meter.bitmap.clear range = @meter_cw * @duration[0] / @duration[1] m_scr = Rect.new(0,0,range,@meter_ch ) @meter.bitmap.blt(0,0, @meter_image ,m_scr) end #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def create_skill_name @skill_name = Sprite.new @skill_name.bitmap = Bitmap.new(200,32) @skill_name.bitmap.font.name = CHAIN_WORD_FONT_NAME @skill_name.bitmap.font.size = CHAIN_WORD_FONT_SIZE @skill_name.bitmap.font.color = CHAIN_WORD_FONT_COLOR @skill_name.z = CHAIN_SPRITE_Z @skill_name.y = @y - 32 + CHAIN_COMMAND_WORD_POSITION[1] refresh_skill_name end #-------------------------------------------------------------------------- # ● Refresh Skill Name #-------------------------------------------------------------------------- def refresh_skill_name cm = @skillname.to_s.split(//).size @center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5 @org_x = @x - (@button_cw / 2) - 85 + CHAIN_COMMAND_WORD_POSITION[0] @skill_name.x = @org_x - 50 @skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1) end #-------------------------------------------------------------------------- # ● Create Button Sprite #-------------------------------------------------------------------------- def create_button_sprite @button_image = $game_temp.cache_active_chain[3] @button_cw = @button_image.width / 13 @button_ch = @button_image.height @button_sprite = Sprite.new @button_sprite.bitmap = Bitmap.new(@button_cw,@button_ch) @button_sprite.z = CHAIN_SPRITE_Z + 1 @button_sprite.ox = @button_cw / 2 @button_sprite.oy = @button_ch / 2 @button_sprite.x = @x + @button_sprite.ox - (@button_cw / 2) @button_sprite.y = @y + @button_sprite.oy end
#-------------------------------------------------------------------------- # ● Refresh Button Command #-------------------------------------------------------------------------- def refresh_button_command return if @button_sprite == nil @duration[0] = @duration[1] command_list_check(@chain_command[@com_index]) @button_sprite.bitmap.clear button_scr = Rect.new(@com * @button_cw , 0,@button_cw,@button_ch) @button_sprite.bitmap.blt(0,0,@button_image,button_scr) @button_sprite.zoom_x = 2 @button_sprite.zoom_y = 2 @button_sprite.opacity = 255 end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- def dispose dispose_button dispose_meter dispose_name dispose_icon_sprite $game_temp.chain_actions[3] = false end #-------------------------------------------------------------------------- # ● Dispose Icon Sprite #-------------------------------------------------------------------------- def dispose_icon_sprite return if @icon_sprite == nil @icon_sprite.bitmap.dispose @icon_sprite.dispose @icon_sprite = nil end #-------------------------------------------------------------------------- # ● Dispose Name #-------------------------------------------------------------------------- def dispose_name return if @skill_name == nil @skill_name.bitmap.dispose @skill_name.dispose @skill_name = nil end #-------------------------------------------------------------------------- # ● Dispose Button #-------------------------------------------------------------------------- def dispose_button return if @button_sprite == nil @button_sprite.bitmap.dispose @button_sprite.dispose @button_sprite = nil end #-------------------------------------------------------------------------- # ● Dispose Meter #-------------------------------------------------------------------------- def dispose_meter return if @meter_layout == nil @meter_layout.dispose @meter_layout = nil @meter.bitmap.dispose @meter.dispose end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update if @initial_wait > 0 @initial_wait -= 1 if @initial_wait == 0 refresh_button_command @meter.visible = true @meter_layout.visible = true end return end if @wrong_commnad[0] update_fade_command return end update_command update_sprite_button update_time update_meter end
#-------------------------------------------------------------------------- # ● Update Skill Name #-------------------------------------------------------------------------- def update_fade_command fade_speed = 6 @skill_name.opacity -= fade_speed @meter.opacity -= fade_speed @meter_layout.opacity -= fade_speed @icon_sprite.opacity -= fade_speed @button_sprite.opacity -= fade_speed * 2 missed if @meter.opacity == 0 end #-------------------------------------------------------------------------- # ● Update Skill Name #-------------------------------------------------------------------------- def update_skill_name return if @skill_name == nil if @skill_name.x < @org_x @skill_name.x += 3 @icon_sprite.x += 3 if @skill_name.x > @org_x @skill_name.x = @org_x @icon_sprite.x = @org_x2 end end end #-------------------------------------------------------------------------- # ● Update Time #-------------------------------------------------------------------------- def update_time return if @button_sprite == nil @duration[0] -= 1 if @duration[0] > 0 wrong_command(1) if @duration[0] == 0 end #-------------------------------------------------------------------------- # ● Update Sprite Button #-------------------------------------------------------------------------- def update_sprite_button return if @button_sprite == nil if @button_sprite.zoom_x > 1.00 @button_sprite.zoom_x -= 0.05 @button_sprite.zoom_x = 1.00 if @button_sprite.zoom_x < 1.00 end @button_sprite.zoom_y = @button_sprite.zoom_x end
#-------------------------------------------------------------------------- # ● Update Command #-------------------------------------------------------------------------- def update_command if Input.trigger?(Input::X) check_command(0) elsif Input.trigger?(Input::Z) check_command(1) elsif Input.trigger?(Input::Y) check_command(2) elsif Input.trigger?(Input::A) check_command(3) elsif Input.trigger?(Input::C) check_command(4) elsif Input.trigger?(Input::B) check_command(5) elsif Input.trigger?(Input::L) check_command(6) elsif Input.trigger?(Input::R) check_command(7) elsif Input.trigger?(Input::RIGHT) check_command( elsif Input.trigger?(Input::LEFT) check_command(9) elsif Input.trigger?(Input::DOWN) check_command(10) elsif Input.trigger?(Input::UP) check_command(11) end end #-------------------------------------------------------------------------- # ● command_list_check #-------------------------------------------------------------------------- def command_list_check(command) case command when "A" @com = 0 when "D" @com = 1 when "S" @com = 2 when "Shift" @com = 3 when "Z" @com = 4 when "X" @com = 5 when "Q" @com = 6 when "W" @com = 7 when "Right" @com = 8 when "Left" @com = 9 when "Down" @com = 10 when "Up" @com = 11 else @com = 12 end end
#-------------------------------------------------------------------------- # ● check_command #-------------------------------------------------------------------------- def check_command(com) index = 0 if com != -1 right_input = false for i in @chain_command if index == @com_index command_list_check(i) right_input = true if @com == com end index += 1 end else command_list_check(@com_index) right_input = true end if right_input next_command else wrong_command(0) end end #-------------------------------------------------------------------------- # ● Next Command #-------------------------------------------------------------------------- def next_command @com_index += 1 Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100) if @com_index == @chain_command.size @phase = 9 @success = true return end refresh_button_command end
#-------------------------------------------------------------------------- # ● wrong_command #-------------------------------------------------------------------------- def wrong_command(type = 0) @wrong_commnad[0] = true @wrong_commnad[1] = type @skill_name.bitmap.clear Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100) wname = type == 0 ? CHAIN_MISSED_WORDS[0] : CHAIN_MISSED_WORDS[1] @skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1) end #-------------------------------------------------------------------------- # ● missed #-------------------------------------------------------------------------- def missed @success = false @phase = 9 end
end
$mog_rgss3_active_chain_commands = true
- MOG AT Systeme:
#============================================================================== # +++ MOG - AT System (v0.7 Beta) +++ #============================================================================== # By Moghunter # http://www.atelier-rgss.com/ #============================================================================== # Sistema de batalha de turnos em tempo real. #==============================================================================
#============================================================================== # ● Histórico (Version History) #============================================================================== # v 0.7 - Melhoria na performance. #==============================================================================
#============================================================================== # ● AT SYSTEM #============================================================================== # A velocidade de AT é baseaddo na agilidade do Battler. # Em caso de batalhas preventivas (Preemptive) os aliados começarão com AT em # 80% e os inimigos começarão com AT em 0 (Zero) # Em batalhas surpresas (Surprise) é o inverso das batalhas preventivas. # Em batalhas normais todos os battlers começarão com AT em 40%. #============================================================================== # ● CAST TIME #============================================================================== # Para definir uma habilidade ou item com a função de Cast Time basta definir # o valor da velocidade (Speed) diferente de 0 (Zero). # # NOTA - Não é possível ativar 2 ou mais habilidades com a função Cast Time no # mesmo turno. (Caso você esteja usando características de Multi Action em # seu projeto.) #============================================================================== module MOG_AT_SYSTEM #Som quando o sistema AT estiver no maximo SE_ACTIVE = "Decision2" #Definição do valor de AT para ativar a ação.(Gauge Meter). AT_GAUGE_METER = 5000 # Definição do tipo de duração (Contagem/formula) de um turno. # Essa definição influência na ativação dos eventos de batalha. # (BATTLE EVENTS) # # 0 - Duração de um turno é um valor fixo. # 1 - Duração de um turno é multiplicado pela quantidade de batllers. # 2 - Duração de um turno é baseado na média de agilidade dos battlers. # TURN_DURATION_TYPE = 1 # Definição de valor usado para calcular a duração de um turno. TURN_DURATION = 60 # Definição da animação quando o battler usa habilidades de carregamento. CAST_ANIMATION = 49 # Ativar a janela de LOG, deixe desativado se desejar uma batalha mais # dinâmica. WAIT_LOG_WINDOW = false # Ativar a mensagem inicial com os nomes dos inimigos. MESSAGE_ENEMY_APPEAR = false # Definição da posição da janela de mensagem. # 0 - Superior # 1 - Centro # 2 - Inferior MESSAGE_POSITION = 0 # Tipo de posicionamento da Hud. # 0 - Posição fixa. # 1 - Posição baseado no valor X e Y do battler. AT_HUD_POSITION_TYPE = 0 #Posição geral (Inicial) da Hud. AT_HUD_POSITION = [25,400] #Posição do medidor de AT AT_METER_POSITION = [29,1] #Definição da posição do espaço da HUD entre os membros do grupo. # #MEMBERS_SPACE = [Horizontal ,Vertical] # MEMBERS_SPACE = [136,0] #Velocidade de animação do medidor de at, defina 0 se não quiser a animação. AT_METER_FLOW_SPEED = 3 #Prioridade da Hud. BATTLE_HUD_Z = 0 end
#============================================================================== # ■ Game_System #============================================================================== class Game_System attr_accessor :at_max #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize @at_max = [[MOG_AT_SYSTEM::AT_GAUGE_METER, 999999].min, 100].max mog_at_system_initialize end end
#============================================================================== # ■ BattleManager #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● Battle Start #-------------------------------------------------------------------------- def self.battle_start $game_system.battle_count += 1 $game_party.on_battle_start $game_troop.on_battle_start if MOG_AT_SYSTEM::MESSAGE_ENEMY_APPEAR $game_troop.enemy_names.each do |name| $game_message.add(sprintf(Vocab::Emerge, name)) end end if @preemptive $game_message.add(sprintf(Vocab::Preemptive, $game_party.name)) elsif @surprise $game_message.add(sprintf(Vocab::Surprise, $game_party.name)) end wait_for_message end #-------------------------------------------------------------------------- # ● Input Start #-------------------------------------------------------------------------- def self.input_start_at(battler) if @phase != :input @phase = :input battler.make_actions clear_actor end return !@surprise && battler.inputable? end
#-------------------------------------------------------------------------- # ● Turn Start #-------------------------------------------------------------------------- def self.turn_start @phase = :turn clear_actor make_action_orders end #-------------------------------------------------------------------------- # ● Preemtive Attack #-------------------------------------------------------------------------- def self.preemptive_attack @preemptive end #-------------------------------------------------------------------------- # ● Suprise Attack #-------------------------------------------------------------------------- def self.surprise_attack @surprise end end
#============================================================================== # ■ Game Action #============================================================================== class Game_Action
#-------------------------------------------------------------------------- # ● Prepare #-------------------------------------------------------------------------- alias mog_at_system_prepare prepare def prepare mog_at_system_prepare set_cast_action end #-------------------------------------------------------------------------- # ● Set Cast Action #-------------------------------------------------------------------------- def set_cast_action return if forcing if @item.object != nil and @item.object.speed != 0 and @subject.at_cast.empty? @subject.at_cast = [@item.object,@item.object.speed.abs,@target_index] @item.object = nil @subject.animation_id = MOG_AT_SYSTEM::CAST_ANIMATION @subject.at = 0 BattleManager.turn_end if @subject.auto_battle? elsif !@subject.at_cast.empty? if @subject.at_cast[1] == 0 @item.object = @subject.at_cast[0] @target_index = @subject.at_cast[2] @subject.at_cast.clear else @item.object = nil end end end end
#============================================================================== # ■ Game Battler Base #============================================================================== class Game_BattlerBase
#-------------------------------------------------------------------------- # ● Inputable? #-------------------------------------------------------------------------- def inputable? normal? && !auto_battle? && self.at == $game_system.at_max end end
#============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler < Game_BattlerBase attr_accessor :at attr_accessor :at_cast attr_accessor :at_turn_duration attr_accessor :at_action #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize mog_at_system_initialize @at = 0 @at_cast = [] @at_cast_selectable = true @at_turn_duration = 0 @at_action = nil end #-------------------------------------------------------------------------- # ● At #-------------------------------------------------------------------------- def at n = at_active? ? $game_system.at_max : 0 return [[@at, n].min, 0].max end #-------------------------------------------------------------------------- # ● At Active #-------------------------------------------------------------------------- def at_active? return false if restriction >= 4 return false if self.hp == 0 return true end #-------------------------------------------------------------------------- # ● Added New State #-------------------------------------------------------------------------- alias mog_at_system_add_new_state add_new_state def add_new_state(state_id) mog_at_system_add_new_state(state_id) if restriction >= 4 self.at_cast.clear self.at = 0 end end #-------------------------------------------------------------------------- # ● can AT? #-------------------------------------------------------------------------- def can_upd_at? return false if restriction >= 4 return false if self.hp == 0 return false if !self.at_cast.empty? return false if self.at_action != nil return true end end
#============================================================================== # ■ Game Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● Tranform #-------------------------------------------------------------------------- alias mog_at_system_transform transform def transform(enemy_id) mog_at_system_transform(enemy_id) self.at = 0 self.at_cast.clear end end
if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW #============================================================================== # ■ BattleManager #============================================================================== class Window_BattleLog < Window_Selectable
#-------------------------------------------------------------------------- # ● Refresh #-------------------------------------------------------------------------- def refresh end
#-------------------------------------------------------------------------- # ● Message Speed #-------------------------------------------------------------------------- def message_speed return 5 end
end end
#============================================================================== # ■ Scene Battle #============================================================================== class Scene_Battle < Scene_Base include MOG_AT_SYSTEM #-------------------------------------------------------------------------- # ● AT Wait #-------------------------------------------------------------------------- alias mog_at_system_start start def start reset_at_parameter mog_at_system_start end #-------------------------------------------------------------------------- # ● Battle Start #-------------------------------------------------------------------------- def battle_start BattleManager.battle_start process_event set_turn_duration end #-------------------------------------------------------------------------- # ● Reset AT Parameter #-------------------------------------------------------------------------- def reset_at_parameter return if @at_phase != nil @at_phase = 0 n_at = $game_system.at_max * 40 / 100 p_at = $game_system.at_max * 90 / 100 s_at = 0 all_battle_members.each do |battler| if BattleManager.preemptive_attack battler.at = p_at if battler.is_a?(Game_Actor) battler.at = s_at if battler.is_a?(Game_Enemy) elsif BattleManager.surprise_attack battler.at = p_at if battler.is_a?(Game_Enemy) battler.at = s_at if battler.is_a?(Game_Actor) else battler.at = n_at end if battler.at >= $game_system.at_max battler.at = $game_system.at_max - 1 end battler.at = 0 if battler.at < 0 battler.at_cast.clear end end
#-------------------------------------------------------------------------- # ● Set Turn Duration #-------------------------------------------------------------------------- def set_turn_duration max_battlers = all_battle_members.size > 0 ? all_battle_members.size : 1 case TURN_DURATION_TYPE when 1 n = TURN_DURATION * max_battlers when 2 turn_sp = 0 all_battle_members.each do |battler| turn_sp += battler.agi end n = TURN_DURATION + (turn_sp / max_battlers) else n = TURN_DURATION end turn_time_max = [[n, 9999].min, 120].max @turn_duration = [0, turn_time_max] if @status_window != nil @status_window.open end end #-------------------------------------------------------------------------- # ● Turn End #-------------------------------------------------------------------------- def turn_end @at_phase = 0 all_battle_members.each do |battler| if battler.at >= $game_system.at_max battler.at = 0 refresh_status @log_window.display_auto_affected_status(battler) @log_window.wait_and_clear end end BattleManager.turn_end end #-------------------------------------------------------------------------- # ● Update Turn Duration #-------------------------------------------------------------------------- def update_turn_duration return if @turn_duration == nil or @turn_duration[0] == nil @turn_duration[0] += 1 if @turn_duration[0] >= @turn_duration[1] @turn_duration[0] = 0 $game_troop.increase_turn process_event check_states_effect_turn end end #-------------------------------------------------------------------------- # ● Check States Effect Turn #-------------------------------------------------------------------------- def check_states_effect_turn all_battle_members.each do |battler| battler.on_turn_end if battler.restriction >= 4 end end #-------------------------------------------------------------------------- # ● Update AT System #-------------------------------------------------------------------------- def update_at_system reset_at_parameter if @at_phase == nil set_turn_duration if @turn_duration == nil return if !can_update_at? update_turn_duration all_battle_members.each do |battler| update_battler_turn_duration(battler) if !battler.at_cast.empty? battler.at_cast[1] -= 1 if battler.at_cast[1] <= 0 execute_at_cast(battler) break end else battler.at += battler.agi end if battler.at >= $game_system.at_max battler.on_turn_end update_at_actor(battler) update_at_enemy(battler) battler.current_action.prepare if battler.current_action if battler.at_cast.empty? @at_phase = 1 turn_start if battler.is_a?(Game_Enemy) end break end end end #-------------------------------------------------------------------------- # ● Update Battler Turn Duration #-------------------------------------------------------------------------- def update_battler_turn_duration(battler) if battler.restriction >= 4 battler.at_turn_duration += 1 if battler.at_turn_duration >= $game_system.at_max battler.on_turn_end battler.at_turn_duration = 0 end else battler.at_turn_duration = 0 end end #-------------------------------------------------------------------------- # ● Execute AT CAST #-------------------------------------------------------------------------- def execute_at_cast(battler) @subject = battler battler.make_actions turn_start end #-------------------------------------------------------------------------- # ● Update AT Actor #-------------------------------------------------------------------------- def update_at_actor(battler) return if !battler.is_a?(Game_Actor) Audio.se_play("Audio/SE/" + SE_ACTIVE,100,100) start_party_command_selection_at(battler) end #-------------------------------------------------------------------------- # ● Update AT Enemy #-------------------------------------------------------------------------- def update_at_enemy(battler) return if !battler.is_a?(Game_Enemy) battler.make_actions end #-------------------------------------------------------------------------- # ● Can Update AT #-------------------------------------------------------------------------- def can_update_at? return false if $game_troop.interpreter.running? return false if BattleManager.action_forced? return false if @at_phase != 0 return false if $game_message.visible return false if BattleManager.in_turn? return true end #-------------------------------------------------------------------------- # ● Star Party Command Selection at #-------------------------------------------------------------------------- def start_party_command_selection_at(battler) unless scene_changing? refresh_status @status_window.unselect @status_window.open if BattleManager.input_start_at(battler) @actor_command_window.close next_command else turn_start end end end #-------------------------------------------------------------------------- # ● Update Basic #-------------------------------------------------------------------------- alias mog_at_system_update_basic update_basic def update_basic mog_at_system_update_basic update_at_system update_party_command $game_message.position = MESSAGE_POSITION end #-------------------------------------------------------------------------- # ● Update Party Command #-------------------------------------------------------------------------- def update_party_command return if !@party_command_window.active return if !@actor_command_window.visible return if $game_message.visible if Input.trigger?(:B) next_command Sound.play_cancel @party_command_window.active = false end end end
#============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :cache_at_meter #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_meter_initialize initialize def initialize mog_at_meter_initialize cache_atmeter end #-------------------------------------------------------------------------- # ● Cache ATmeter #-------------------------------------------------------------------------- def cache_atmeter @cache_at_meter = [] @cache_at_meter.push(Cache.system("Battle_AT_Meter")) @cache_at_meter.push(Cache.system("Battle_AT_Layout")) end end
#============================================================================== # ■ AT Meter #============================================================================== class AT_Meter include MOG_AT_SYSTEM #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(actor) @actor = actor @flow_speed = 0 if AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite? @x = AT_HUD_POSITION[0] + @actor.screen_x rescue 0 @y = AT_HUD_POSITION[1] + @actor.screnn_y rescue 0 else @x = AT_HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index) @y = AT_HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index) end pre_cache create_layout create_at_meter end #-------------------------------------------------------------------------- # ● Pre Cache #-------------------------------------------------------------------------- def pre_cache @meter = $game_temp.cache_at_meter[0] @meter_cw = @meter.width / 3 @meter_ch = @meter.height / 3 end #-------------------------------------------------------------------------- # ● Create Layout #-------------------------------------------------------------------------- def create_layout @layout = Sprite.new @layout.bitmap = $game_temp.cache_at_meter[1] @layout.z = BATTLE_HUD_Z @layout.x = @x @layout.y = @y end #-------------------------------------------------------------------------- # ● Create AT Meter #-------------------------------------------------------------------------- def create_at_meter @at_meter = Sprite.new @at_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch) @at_meter.z = BATTLE_HUD_Z + 50 @at_meter.x = @x + AT_METER_POSITION[0] @at_meter.y = @y + AT_METER_POSITION[1] @at_flow = rand(@meter_cw * 2) at_flow_update end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- def dispose return if @layout == nil @layout.dispose @layout = nil @at_meter.bitmap.dispose @at_meter.dispose end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update return if @layout == nil at_position @flow_speed += 1 if @flow_speed >= AT_METER_FLOW_SPEED @flow_speed = 0 at_flow_update end end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def at_position return unless AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite? @x = AT_HUD_POSITION[0] + @actor.screen_x rescue 0 @y = AT_HUD_POSITION[1] + @actor.screnn_y rescue 0 @layout.x = @x @layout.y = @y @at_meter.x = @x + AT_METER_POSITION[0] @at_meter.y = @y + AT_METER_POSITION[1] end #-------------------------------------------------------------------------- # ● AT Flow Update #-------------------------------------------------------------------------- def at_flow_update @at_meter.bitmap.clear if !@actor.at_cast.empty? max_cast = @actor.at_cast[0].speed.abs != 0 ? @actor.at_cast[0].speed.abs : 1 at_width = @meter_cw * @actor.at_cast[1] / max_cast ch = @meter_ch * 2 else at_width = @meter_cw * @actor.at / $game_system.at_max ch = @actor.at < $game_system.at_max ? 0 : @meter_ch end src_rect = Rect.new(@at_flow, ch,at_width, @meter_ch) @at_meter.bitmap.blt(0,0, @meter, src_rect) @at_flow += AT_METER_FLOW_SPEED @at_flow = 0 if @at_flow >= @meter_cw * 2 end end
#============================================================================== # ■ Spriteset Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize mog_at_system_initialize create_at_meter end #-------------------------------------------------------------------------- # ● Create AT Meter #-------------------------------------------------------------------------- def create_at_meter @at_meter = [] for i in $game_party.battle_members @at_meter.push(AT_Meter.new(i)) end end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- alias mog_at_system_dispose dispose def dispose mog_at_system_dispose dispose_at_meter end #-------------------------------------------------------------------------- # ● Dispose AT Meter #-------------------------------------------------------------------------- def dispose_at_meter return if @at_meter == nil @at_meter.each {|sprite| sprite.dispose } @at_meter = nil end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- alias mog_at_system_update update def update mog_at_system_update update_at_meter end #-------------------------------------------------------------------------- # ● Update AT Meter #-------------------------------------------------------------------------- def update_at_meter return if @at_meter == nil @at_meter.each {|sprite| sprite.update } end end
$mog_rgss3_at_system = true
|
| | | Revan Ancien staffeux
Messages postés : 578 Date d'inscription : 01/11/2013 Jauge LPC :
| Sujet: Re: Realisation volontaire de script !! Dim 17 Nov 2013 - 15:12 | |
| Et le dernier - Batle result:
#============================================================================== # +++ MOG - Battle Result (1.4) +++ #============================================================================== # By Moghunter # http://www.atelier-rgss.com #============================================================================== # Apresentação animada do resultado da batalha. #============================================================================== # Arquivos necessários. (Graphics/System) # # Result.png # Result_Layout.png # Result_Levelup.png # Result_Levelword.png # Result_Number_1.png # Result_Number_2.png # #============================================================================== # Histórico (Version History) #============================================================================== # 1.4 - Compatibilidade com o script de pause. # 1.3 - Melhoria do código e compatibilidade. # 1.2 - Melhoria do código e compatibilidade. # - Adição de sons. # 1.1 - Corrigido o erro de apresentar o Resultado ao fugir ou perder a batalha. #============================================================================== module MOG_BATLE_RESULT #Posição do EXP. RESULT_EXP_POSITION = [440,80] #Posição do GOLD. RESULT_GOLD_POSITION = [476,125] #Posição da palavra LeveL UP. RESULT_LEVELWORD_POSITION = [0,0] #Posição do Level. RESULT_LEVEL_POSITION = [230,-7] #Posição dos parâmetros RESULT_PARAMETER_POSITION = [70,70] #Posição da janela de skill. RESULT_NEW_SKILL_POSITION = [240,230] #Definição da animação de Level UP. RESULT_LEVELUP_ANIMATION_ID = 37 end
#============================================================================== # ■ Game Temp #============================================================================== class Game_Temp attr_accessor :level_parameter attr_accessor :level_parameter_old attr_accessor :result attr_accessor :battle_end
#-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_result_initialize initialize def initialize @level_parameter = [] @level_parameter_old = [] @result = false @battle_end = false mog_result_initialize end
end
#============================================================================== # ■ Game Actor #============================================================================== class Game_Actor < Game_Battler
#-------------------------------------------------------------------------- # ● Display_level_up #-------------------------------------------------------------------------- alias mog_result_display_level_up display_level_up def display_level_up(new_skills) if $game_temp.result $game_temp.level_parameter = [@level,new_skills] return end mog_result_display_level_up(new_skills) end
end
#============================================================================== # ■ BattleManager #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● Process Victory #-------------------------------------------------------------------------- def self.process_victory play_battle_end_me replay_bgm_and_bgs if $mog_rgss3_battle_cry != nil execute_battle_cry(1, nil, nil) end battle_end(0) SceneManager.return return true end end
#============================================================================== # ■ Spriteset Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- alias mog_battle_result_pre_terminate pre_terminate def pre_terminate execute_result if can_enable_battle_result? mog_battle_result_pre_terminate end #-------------------------------------------------------------------------- # ● Can Enable Battle Result? #-------------------------------------------------------------------------- def can_enable_battle_result? return false if !$game_troop.all_dead? return false if $game_party.members.empty? return false if $game_party.all_dead? return true end #-------------------------------------------------------------------------- # ● Execute Result #-------------------------------------------------------------------------- def execute_result @result = Battle_Result.new if $mog_rgss3_combo_count != nil $game_temp.combo_time = 0 rescue nil end loop do @result.update @spriteset.update Graphics.update Input.update break if @result.victory_phase == 10 end @result.dispose end end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result include MOG_BATLE_RESULT attr_accessor :victory_phase #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize $game_temp.battle_end = true $game_temp.result = true @victory_phase = 0 @victory_wait_duration = 0 @fade_result_window = false create_victory_sprites end #-------------------------------------------------------------------------- # ● Create Victory Sprites #-------------------------------------------------------------------------- def create_victory_sprites @result_number = Cache.system("Result_Number_1") @result_number2 = Cache.system("Result_Number_2") @result_cw = @result_number.width / 10 @result_ch = @result_number.height / 2 @result2_cw = @result_number2.width / 10 @result2_ch = @result_number2.height / 2 create_victory_text create_victory_layout create_victory_exp create_victory_gold create_window_treasure end
#-------------------------------------------------------------------------- # ● Victory Wait ? #-------------------------------------------------------------------------- def victory_wait? return false if @victory_wait_duration <= 0 @victory_wait_duration -= 1 return true end #-------------------------------------------------------------------------- # ● End Victory #-------------------------------------------------------------------------- def end_victory @victory_wait_duration = 10 dispose end #-------------------------------------------------------------------------- # ● Create Victory Layout #-------------------------------------------------------------------------- def create_victory_layout return if @victory_layout_sprite != nil @victory_layout_sprite = Sprite.new @victory_layout_sprite.z = 1001 @victory_layout_sprite.bitmap = Cache.system("Result_Layout") @victory_layout_sprite.zoom_x = 2.0 @victory_layout_sprite.opacity = 0 end #-------------------------------------------------------------------------- # ● Create Victory Text #-------------------------------------------------------------------------- def create_victory_text return if @victory_sprite != nil @victory_sprite = Sprite.new @victory_sprite.z = 1000 @victory_sprite.bitmap = Cache.system("Result") @victory_sprite.ox = @victory_sprite.width / 2 @victory_sprite.oy = @victory_sprite.height / 2 @victory_sprite.x = @victory_sprite.ox @victory_sprite.y = @victory_sprite.oy @victory_sprite.zoom_x = 1.5 @victory_sprite.zoom_y = 1.5 @victory_sprite.opacity = 0 end end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- def dispose $game_temp.result = false $game_temp.battle_end = false @victory_sprite.bitmap.dispose @victory_sprite.dispose @victory_layout_sprite.bitmap.dispose @victory_layout_sprite.dispose @exp_number.bitmap.dispose @exp_number.dispose @gold_number.bitmap.dispose @gold_number.dispose @result_number.dispose @window_treasure.dispose dispose_level_up @result_number.dispose @result_number2.dispose @tr_viewport.dispose end #-------------------------------------------------------------------------- # ● Dispose Result Actor Bitmap #-------------------------------------------------------------------------- def dispose_result_actor_bitmap return if @result_actor_sprite == nil return if @result_actor_sprite.bitmap == nil @result_actor_sprite.bitmap.dispose end #-------------------------------------------------------------------------- # ● Dispose Level UP #-------------------------------------------------------------------------- def dispose_level_up return if @levelup_layout == nil @levelup_layout.bitmap.dispose @levelup_layout.dispose @levelup_word.bitmap.dispose @levelup_word.dispose @result_actor_sprite.bitmap.dispose @result_actor_sprite.dispose @parameter_sprite.bitmap.dispose @parameter_sprite.dispose @level_sprite.bitmap.dispose @level_sprite.dispose if @new_skill_window != nil @new_skill_window.dispose end end end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update if $mog_rgss3_pause != nil update_pause if MOG_PAUSE::PAUSE_SCENE_BATTLE end return if @victory_phase == nil update_victory_fade if @fade_result_window return if victory_wait? case @victory_phase when 0; update_victory_initial when 1; update_victory_initial2 when 2; update_victory_initial3 when 3; update_victory_exp when 4; update_victory_gold when 5; update_victory_item when 6; update_victory_levelup when 9; update_skip_result end if Input.trigger?(:C) if @victory_phase == 10 end_victory elsif @victory_phase.between?(1,5) Sound.play_cursor @victory_phase = 9 end end end #-------------------------------------------------------------------------- # ● Skip Result #-------------------------------------------------------------------------- def update_skip_result @victory_sprite.opacity -= 10 @victory_sprite.visible = false @victory_layout_sprite.opacity += 10 @victory_layout_sprite.zoom_x = 1.00 @gold_number.opacity += 10 @gold_number.zoom_x = 1.00 @gold_number.zoom_y = 1.00 @exp_number.opacity += 10 @exp_number.zoom_x = 1.00 @exp_number.zoom_y = 1.00 @window_treasure.contents_opacity += 10 if @exp_old != @exp_total @exp_old = @exp_total refresh_exp_number end if @gold_old = @gold_total @gold_old = @gold_total refresh_gold_number end @window_treasure.x = 0 update_victory_item if @window_treasure.contents_opacity == 255 end #-------------------------------------------------------------------------- # ● Update Victory Fade #-------------------------------------------------------------------------- def update_victory_fade fade_speed = 10 @victory_sprite.opacity -= fade_speed @victory_layout_sprite.opacity -= fade_speed @gold_number.opacity -= fade_speed @exp_number.opacity -= fade_speed @window_treasure.contents_opacity -= fade_speed end #-------------------------------------------------------------------------- # ● Update Victory Initial #-------------------------------------------------------------------------- def update_victory_initial @victory_sprite.zoom_x -= 0.01 @victory_sprite.zoom_y -= 0.01 @victory_sprite.opacity += 10 if @victory_sprite.zoom_x <= 1.00 @victory_sprite.zoom_x = 1 @victory_sprite.zoom_y = 1 @victory_sprite.opacity = 255 @victory_phase = 1 @victory_wait_duration = 20 end end
#-------------------------------------------------------------------------- # ● Update Victory Initial 2 #-------------------------------------------------------------------------- def update_victory_initial2 @victory_sprite.zoom_x += 0.01 @victory_sprite.zoom_y += 0.01 @victory_sprite.opacity -= 10 if @victory_sprite.opacity <= 0 @victory_sprite.zoom_x = 1 @victory_sprite.zoom_y = 1 @victory_sprite.opacity = 0 @victory_phase = 2 end end
#-------------------------------------------------------------------------- # ● Update Victory Initial 3 #-------------------------------------------------------------------------- def update_victory_initial3 @victory_layout_sprite.zoom_x -= 0.02 @victory_layout_sprite.opacity += 10 if @victory_layout_sprite.zoom_x <= 1.00 @victory_layout_sprite.zoom_x = 1 @victory_layout_sprite.opacity = 255 @victory_phase = 3 end end end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result
#-------------------------------------------------------------------------- # ● Create Victory Exp #-------------------------------------------------------------------------- def create_victory_exp @exp_number = Sprite.new @exp_number.bitmap = Bitmap.new(@result_number.width,@result_ch) @exp_number.z = 1002 @exp_number.y = RESULT_EXP_POSITION[1] @exp_number.zoom_x = 2 @exp_number.zoom_y = 2 @exp_total = $game_troop.exp_total @exp_number.opacity = 0 @exp_old = 0 @exp_ref = ((1 * @exp_total) / 111).truncate rescue nil @exp_ref = 1 if @exp_ref < 1 or @exp_ref == nil @exp_ref = 0 if @exp_total == 0 refresh_exp_number end #-------------------------------------------------------------------------- # ● Update Victory Exp #-------------------------------------------------------------------------- def update_victory_exp update_exp_sprite update_exp_number end #-------------------------------------------------------------------------- # ● Update EXP Sprite #-------------------------------------------------------------------------- def update_exp_sprite @exp_number.opacity += 15 if @exp_number.zoom_x > 1.00 @exp_number.zoom_x -= 0.03 @exp_number.zoom_x = 1.00 if @exp_number.zoom_x <= 1.00 end @exp_number.zoom_y = @exp_number.zoom_x if (@exp_old >= @exp_total) and @exp_number.zoom_x == 1.00 @victory_phase = 4 Sound.play_cursor end end
#-------------------------------------------------------------------------- # ● Refresh Exp Number #-------------------------------------------------------------------------- def refresh_exp_number @exp_number.bitmap.clear draw_result_exp(@exp_old, 0,0) end
#-------------------------------------------------------------------------- # ● Update Exp_number #-------------------------------------------------------------------------- def update_exp_number return if @exp_old == @exp_total @exp_old += @exp_ref @exp_old = @exp_total if @exp_old > @exp_total refresh_exp_number end
#-------------------------------------------------------------------------- # ● Draw Result EXP #-------------------------------------------------------------------------- def draw_result_exp(value,x,y) ncw = @result_cw nch = @result_ch number = value.abs.to_s.split(//) x2 = x - (number.size * ncw) @exp_number.ox = (number.size * ncw) / 2 @exp_number.oy = @result_ch / 2 @exp_number.x = (RESULT_EXP_POSITION[0] + @result_cw + @exp_number.ox) - (number.size * ncw) for r in 0..number.size - 1 number_abs = number[r].to_i nsrc_rect = Rect.new(ncw * number_abs, 0, ncw, nch) @exp_number.bitmap.blt(x + (ncw * r), y, @result_number, nsrc_rect) end end
end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result
#-------------------------------------------------------------------------- # ● Create Victory Gold #-------------------------------------------------------------------------- def create_victory_gold @gold_number = Sprite.new @gold_number.bitmap = Bitmap.new(@result_number.width,@result_ch) @gold_number.z = 1002 @gold_number.y = RESULT_GOLD_POSITION[1] @gold_number.opacity = 0 @gold_number.zoom_x = 2 @gold_number.zoom_y = 2 @gold_total = $game_troop.gold_total @gold_old = 0 @gold_ref = ((1 * @gold_total) / 111).truncate rescue nil @gold_ref = 1 if @gold_ref < 1 or @gold_ref == nil @gold_ref = 0 if @gold_total == 0 $game_party.gain_gold($game_troop.gold_total) refresh_gold_number end #-------------------------------------------------------------------------- # ● Update Victory Gold #-------------------------------------------------------------------------- def update_victory_gold update_gold_sprite update_gold_number end #-------------------------------------------------------------------------- # ● Update GOLD Sprite #-------------------------------------------------------------------------- def update_gold_sprite @gold_number.opacity += 15 if @gold_number.zoom_x > 1.00 @gold_number.zoom_x -= 0.03 @gold_number.zoom_x = 1.00 if @gold_number.zoom_x <= 1.00 end @gold_number.zoom_y = @gold_number.zoom_x if @gold_old >= @gold_total and @gold_number.zoom_x == 1.00 @victory_phase = 5 Sound.play_cursor end end #-------------------------------------------------------------------------- # ● Refresh gold Number #-------------------------------------------------------------------------- def refresh_gold_number @gold_number.bitmap.clear draw_result_gold(@gold_old, 0,0) end #-------------------------------------------------------------------------- # ● Update Gold Number #-------------------------------------------------------------------------- def update_gold_number return if @gold_old == @gold_total @gold_old += @gold_ref @gold_old = @gold_total if @gold_old > @gold_total refresh_gold_number end #-------------------------------------------------------------------------- # ● Draw Result Gold #-------------------------------------------------------------------------- def draw_result_gold(value,x,y) ncw = @result_cw nch = @result_ch number = value.abs.to_s.split(//) x2 = x - (number.size * ncw) @gold_number.ox = (number.size * ncw) / 2 @gold_number.oy = @result_ch / 2 @gold_number.x = (RESULT_GOLD_POSITION[0] + @result_cw + @gold_number.ox) - (number.size * ncw) for r in 0..number.size - 1 number_abs = number[r].to_i nsrc_rect = Rect.new(ncw * number_abs, @result_ch, ncw, nch) @gold_number.bitmap.blt(x + (ncw * r), y, @result_number, nsrc_rect) end end
end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result #-------------------------------------------------------------------------- # ● Create Window Treasure #-------------------------------------------------------------------------- def create_window_treasure @tr_viewport = Viewport.new(-8, 164, 576, 118) @tr_viewport.z = 1003 @window_treasure = Window_Treasure.new @window_treasure.viewport = @tr_viewport end #-------------------------------------------------------------------------- # ● Update Victory Item #-------------------------------------------------------------------------- def update_victory_item @window_treasure.update @actor_level = [] return if @window_treasure.x != 0 and @victory_phase >= 6 @victory_phase = 6 @result_member_max = $game_party.battle_members.size @result_member_id = 0 end end
#============================================================================== # ■ Window Treasure #============================================================================== class Window_Treasure < Window_Base
#-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize super(-544,-10, 576, 256) self.opacity = 0 self.contents_opacity = 0 self.contents.font.size = 24 self.contents.font.bold = true self.z = 1003 @range_max = 256 @wait_time = 30 @scroll = false draw_treasure end
#-------------------------------------------------------------------------- # ● Draw_Treasure #-------------------------------------------------------------------------- def draw_treasure contents.clear t_index = 0 space_x = 540 / 3 $game_troop.make_drop_items.each do |item| xi = (t_index * space_x) - ((t_index / 3) * (space_x * 3)) yi = (t_index / 3) * 32 $game_party.gain_item(item, 1) draw_item_name(item,xi, yi, true, 140) t_index += 1 end @range_max = (t_index / 3) * 32 @scroll = true if t_index > 12 end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update super self.contents_opacity += 10 if self.x < 0 self.x += 15 if self.x >= 0 self.x = 0 Sound.play_cursor end end if @scroll and self.contents_opacity == 255 and self.x == 0 @wait_time -= 1 if @wait_time > 0 return if @wait_time > 0 self.y -= 1 self.y = 128 if self.y < -@range_max @wait_time = 30 if self.y == -10 end end
end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result #-------------------------------------------------------------------------- # ● Create Levelup #-------------------------------------------------------------------------- def create_levelup if @levelup_layout == nil @levelup_layout = Sprite.new @levelup_layout.z = 1000 @levelup_layout.bitmap = Cache.system("Result_Levelup") end if @levelup_word == nil @levelup_word = Sprite.new @levelup_word.z = 1001 @levelup_word.bitmap = Cache.system("Result_Levelword") @levelup_word.ox = @levelup_word.bitmap.width / 2 @levelup_word.oy = @levelup_word.bitmap.height / 2 @levelup_word.x = @levelup_word.ox + RESULT_LEVELWORD_POSITION[0] @levelup_word.y = @levelup_word.oy + RESULT_LEVELWORD_POSITION[1] end @levelup_word.blend_type = 1 @levelup_word.zoom_x = 2 @levelup_word.zoom_y = 2 end #-------------------------------------------------------------------------- # ● Create Parameter Number #-------------------------------------------------------------------------- def create_parameter_number if @parameter_sprite == nil @parameter_sprite = Sprite.new @parameter_sprite.bitmap = Bitmap.new(250,220) @parameter_sprite.z = 1001 @parameter_sprite.x = RESULT_PARAMETER_POSITION[0] @parameter_sprite.y = RESULT_PARAMETER_POSITION[1] @parameter_sprite.bitmap.font.size = 16 @parameter_sprite.bitmap.font.bold = true end refresh_parameter end #-------------------------------------------------------------------------- # ● Refresh Parameter #-------------------------------------------------------------------------- def refresh_parameter @parameter_animation = 0 @parameter_sprite.bitmap.clear @parameter_sprite.opacity = 0 @parameter_sprite.x = RESULT_PARAMETER_POSITION[0] - 200 actor_old = $game_temp.level_parameter_old draw_result_parameter(@actor_result.mhp,actor_old[1],0,28 * 0) draw_result_parameter(@actor_result.mmp,actor_old[2],0,28 * 1) draw_result_parameter(@actor_result.atk,actor_old[3],0,28 * 2) draw_result_parameter(@actor_result.def,actor_old[4],0,28 * 3) draw_result_parameter(@actor_result.mat,actor_old[5],0,28 * 4) draw_result_parameter(@actor_result.mdf,actor_old[6],0,28 * 5) draw_result_parameter(@actor_result.agi,actor_old[7],0,28 * 6) draw_result_parameter(@actor_result.luk,actor_old[8],0,28 * 7) end #-------------------------------------------------------------------------- # ● Draw Result EXP #-------------------------------------------------------------------------- def draw_result_parameter(value,value2,x,y) ncw = @result2_cw nch = @result2_ch number = value.abs.to_s.split(//) x2 = x + (number.size * ncw) + 16 for r in 0..number.size - 1 number_abs = number[r].to_i nsrc_rect = Rect.new(ncw * number_abs, 0, ncw, nch) @parameter_sprite.bitmap.blt(x + (ncw * r), y, @result_number2, nsrc_rect) end value3 = value - value2 par = "" if value > value2 par = "+" @parameter_sprite.bitmap.font.color = Color.new(50,255,255) elsif value < value2 par = "" @parameter_sprite.bitmap.font.color = Color.new(255,155,100) end return if value == value2 @parameter_sprite.bitmap.draw_text(x2,y - 8,100,32,par.to_s + value3.to_s,0) end #-------------------------------------------------------------------------- # ● Create Result Actor #-------------------------------------------------------------------------- def create_result_actor if @result_actor_sprite == nil @result_actor_sprite = Sprite.new @result_actor_sprite.z = 999 end dispose_result_actor_bitmap @result_actor_sprite.bitmap = Cache.picture("Actor" + @actor_result.id.to_s) @result_actor_org = [380 - (@result_actor_sprite.bitmap.width / 2), Graphics.height - @result_actor_sprite.bitmap.height] @result_actor_sprite.x = @result_actor_org[0] + 200 @result_actor_sprite.y = @result_actor_org[1] @result_actor_sprite.opacity = 0 end
#-------------------------------------------------------------------------- # ● Check New Skill #-------------------------------------------------------------------------- def check_new_skill @new_skills = $game_temp.level_parameter[1] @new_skills_index = 0 end #-------------------------------------------------------------------------- # ● Show New Skill #-------------------------------------------------------------------------- def show_new_skill(start = false) Sound.play_recovery unless start @new_skill_window.draw_new_skill(@new_skills[@new_skills_index]) @new_skills_index += 1 if @new_skills_index == @new_skills.size or @new_skills[@new_skills_index] == nil @new_skills = nil end end #-------------------------------------------------------------------------- # ● Check Level UP #-------------------------------------------------------------------------- def check_level_up if @new_skills != nil and !@new_skills.empty? show_new_skill return end for battler_id in @result_member_id..@result_member_max actor_result = $game_party.members[@result_member_id] $game_temp.level_parameter = [] if $game_temp.level_parameter == nil $game_temp.level_parameter_old = [] if $game_temp.level_parameter_old == nil $game_temp.level_parameter.clear $game_temp.level_parameter_old.clear $game_temp.level_parameter_old = [actor_result.level,actor_result.mhp,actor_result.mmp, actor_result.atk, actor_result.def, actor_result.mat, actor_result.mdf, actor_result.agi, actor_result.luk] rescue nil actor_result.gain_exp($game_troop.exp_total) rescue nil @result_member_id += 1 @new_skills = nil @new_skills_index = 0 if $game_temp.level_parameter != nil and !$game_temp.level_parameter.empty? show_level_result break end end return if !$game_temp.level_parameter.empty? @victory_phase = 10 if @result_member_id >= @result_member_max end #-------------------------------------------------------------------------- # ● Create Level #-------------------------------------------------------------------------- def create_level if @level_sprite == nil @level_sprite = Sprite.new @level_sprite.bitmap = Bitmap.new(200,64) @level_sprite.z = 1002 end @level_sprite.bitmap.font.size = 48 @level_sprite.bitmap.font.bold = true @level_sprite.x = RESULT_LEVEL_POSITION[0] @level_sprite.y = RESULT_LEVEL_POSITION[1] @level_sprite.bitmap.clear @level_sprite.bitmap.font.color = Color.new(255,255,255) @level_sprite.bitmap.draw_text(0,0,100,64,@actor_result.level,1) levelup = @actor_result.level - $game_temp.level_parameter_old[0] @level_sprite.bitmap.font.color = Color.new(50,255,255) @level_sprite.bitmap.font.size = 18 @level_sprite.bitmap.draw_text(80,0,100,64,"+" + levelup.to_s ,0) end #-------------------------------------------------------------------------- # ● Create New Skill Windos #-------------------------------------------------------------------------- def create_new_skill_window if @new_skill_window == nil @new_skill_window = Window_Result_Skill.new end @new_skill_window.x = RESULT_NEW_SKILL_POSITION[0] @new_skill_window.y = RESULT_NEW_SKILL_POSITION[1] check_new_skill if @new_skills != nil and !@new_skills.empty? show_new_skill else @new_skill_window.x = -544 end end #-------------------------------------------------------------------------- # ● Show Level Result #-------------------------------------------------------------------------- def show_level_result Sound.play_cursor @actor_result = $game_party.members[@result_member_id - 1] rescue nil return if @actor_result == nil @actor_result.animation_id = RESULT_LEVELUP_ANIMATION_ID @fade_result_window = true create_levelup create_level create_parameter_number create_result_actor create_new_skill_window end end
#============================================================================== # ■ Battle Result #============================================================================== class Battle_Result #-------------------------------------------------------------------------- # ● Update Victory Item #-------------------------------------------------------------------------- def update_victory_levelup check_level_up if Input.trigger?(:C) update_show_levelup if @levelup_layout == nil @window_treasure.update else @window_treasure.contents_opacity -= 15 end end #-------------------------------------------------------------------------- # ● Update Show Level UP #-------------------------------------------------------------------------- def update_show_levelup return if @levelup_layout == nil return if @result_actor_sprite == nil @new_skill_window.update if @result_actor_sprite.x > @result_actor_org[0] @result_actor_sprite.x -= 5 @result_actor_sprite.opacity += 7 if @result_actor_sprite.x <= @result_actor_org[0] @result_actor_sprite.x = @result_actor_org[0] @result_actor_sprite.opacity = 255 end end if @levelup_word.zoom_x > 1.00 @levelup_word.zoom_x -= 0.03 if @levelup_word.zoom_x < 1.00 @levelup_word.zoom_x = 1.00 @levelup_word.blend_type = 0 end end @levelup_word.zoom_y = @levelup_word.zoom_x if @parameter_sprite.x < RESULT_PARAMETER_POSITION[0] @parameter_sprite.opacity += 13 @parameter_sprite.x += 5 if @parameter_sprite.x >= RESULT_PARAMETER_POSITION[0] @parameter_sprite.opacity = 255 @parameter_sprite.x = RESULT_PARAMETER_POSITION[0] end end end end
#============================================================================== # ■ Window Result Skill #============================================================================== class Window_Result_Skill < Window_Base
#-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize super(0,0, 270, 58) self.opacity = 160 self.contents_opacity = 255 self.contents.font.name = "Arial" self.contents.font.bold = true self.z = 1003 @animation_time = 999 @org = [MOG_BATLE_RESULT::RESULT_NEW_SKILL_POSITION[0],MOG_BATLE_RESULT::RESULT_NEW_SKILL_POSITION[1]] end
#-------------------------------------------------------------------------- # ● DrawNew Skill #-------------------------------------------------------------------------- def draw_new_skill(skill) contents.clear self.contents.font.size = 16 self.contents.font.color = Color.new(100,200,100) contents.draw_text(0,0,100,32, "New Skill",0) self.contents.font.color = Color.new(255,255,255) draw_item_name_skill(skill,70,0, true, 170) self.x = @org[0] self.y = @org[1] @animation_time = 0 self.opacity = 0 self.contents_opacity = 0 end #-------------------------------------------------------------------------- # ● Draw Item Name #-------------------------------------------------------------------------- def draw_item_name_skill(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y + 4, width, line_height, item.name) end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update super return if @animation_time == 999 @animation_time += 1 if @animation_time != 999 case @animation_time when 0..30 self.y -= 1 self.opacity += 5 self.contents_opacity += 5 when 31..60 self.y += 1 self.opacity += 5 self.contents_opacity += 5 else self.y = @org[1] self.opacity = 255 self.contents_opacity = 255 @animation_time = 999 end end end
$mog_battle_result = true
|
| | | Contenu sponsorisé
| Sujet: Re: Realisation volontaire de script !! | |
| |
| | | |
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |