Help - Search - Members - Calendar
Full Version: Simple Script Fix
RPG RPG Revolution Forums > Scripting > Script Development and Support
Mustaklaki
(Pretty sure this is in the right spot)
I was having a custom script being done for my game, but the person scripting it hasn't improved upon this script and hasn't even started and it's been around a month.

The script was made to allow the damage of a skill happen DURING the skill's animation. This allows battles to go a lot faster, and gives the game a more realistic perspective.

The problems with this script are two things:
1. Using "Attack" makes the Attack hit twice, or 4 times for "Dual attack" attacks.
2. Same thing using items that heal/damage ETC.

I normally wouldn't post it, I'm not sure if he wants others using it, but it doesn't work in it's current state due to these 2 problems.

Hungrysnake's Show Damage
CODE
# ============================================================================ #
# Quick snippet by HungrySnake                                                 #
#                                                                              #
# This snippet simply shows the dealt damage directly after using a skill.     #
# It's plug and play                                                           #
# ============================================================================ #

class Scene_Battle < Scene_Base  
  
  def execute_action_skill
    @skill_lol = @active_battler.action.skill
    skill = @skill_lol
    text = @active_battler.name + skill.message1
    @message_window.add_instant_text(text)
    unless skill.message2.empty?
      wait(10)
      @message_window.add_instant_text(skill.message2)
    end
    targets = @active_battler.action.make_targets
    display_animation(targets, skill.animation_id)
    @active_battler.mp -= @active_battler.calc_mp_cost(skill)
    $game_temp.common_event_id = skill.common_event_id
  end
  
  def display_normal_animation(targets, animation_id, mirror = false)
    animation = $data_animations[animation_id]
    if animation != nil
      to_screen = (animation.position == 3)       # Is the positon "screen"?
      for target in targets.uniq
        target.animation_id = animation_id
        target.animation_mirror = mirror
        for target1 in targets
          target1.skill_effect(@active_battler, @skill_lol)
          display_action_effects(target1, @skill_lol)
        end
        wait(20, true) unless to_screen           # If for one, wait
      end
      wait(20, true) if to_screen                 # If for all, wait
    end
  end
end
Legacy
What engine is this for? I tried to do something in VX Ace. It doesn't draw at the same time, but it pretty much instant.

CODE
#==============================================================================
# :: Show Damage Instantly ::
#------------------------------------------------------------------------------
# Author : Legacy
# Date   : 17.08.2012
#------------------------------------------------------------------------------
# Instructions:
#  To instal the script, open you script editor and paste this script on
#  a new section bellow the Materials section.
#
#------------------------------------------------------------------------------
# Description:
#   This is a snippet to allow for the damage to be drawn instantly after the
# animation is executed.

#------------------------------------------------------------------------------
# Compatibility:
#
# * Overwrite methods
#     class Scene_Battle
#       def wait_for_animation
#       def wait_for_effect
#       def show_attack_animation
#       def show_normal_animation
#
#==============================================================================

class Scene_Battle < Scene_Base  
   #--------------------------------------------------------------------------
   # * Wait Until Animation Display has Finished
   #--------------------------------------------------------------------------
   def wait_for_animation
     update_for_wait
   end
   #--------------------------------------------------------------------------
   # * Wait Until Effect Execution Ends
   #--------------------------------------------------------------------------
   def wait_for_effect
     update_for_wait
   end
   #--------------------------------------------------------------------------
   # * Show Attack Animation
   #     targets : Target array
   #    Account for dual wield in the case of an actor (flip left hand weapon
   #    display). If enemy, play the [Enemy Attack] SE and wait briefly.
   #--------------------------------------------------------------------------
   def show_attack_animation(targets)
     if @subject.actor?
       show_normal_animation(targets, @subject.atk_animation_id1, false)
       show_normal_animation(targets, @subject.atk_animation_id2, true)
     else
       Sound.play_enemy_attack
       abs_wait(5)
     end
   end
   #--------------------------------------------------------------------------
   # * Show Normal Animation
   #     targets      : Target array
   #     animation_id : Animation ID
   #     mirror       : Flip horizontal
   #--------------------------------------------------------------------------
   def show_normal_animation(targets, animation_id, mirror = false)
     animation = $data_animations[animation_id]
     if animation
       targets.each do |target|
         target.animation_id = animation_id
         target.animation_mirror = mirror
         abs_wait(5) unless animation.to_screen?
       end
       abs_wait(5) if animation.to_screen?
     end
   end
end


Hope it helps.
Mustaklaki
This is for VX
Mustaklaki
Nevermind, the original creator has already fixed it
amerk
So since this is resolved, I'll go ahead and close this. You can PM me if you need it re-opened.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.