Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Weapon Unleash

Weapon Unleash
by Dargor
Version 1.2


Introduction

This script is based on Golden Sun weapons special attacks. When you attack, there is a chance (in percent) that your weapon unleash a skill.
It now supports Two Swords Style.

Script

Please read the instructions in the script header.
Code:
#==============================================================================

# ** Weapon Unleash

#------------------------------------------------------------------------------

#  © Dargor, 2008

#  04/03/08

#  Version 1.1

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#   - Edit the constants in the Weapon_Unleash module and enjoy!

#  VERSION HISTORY:

#   - 1.0 (02/03/08), Initial release

#   - 1.1 (04/03/08), Two Swords Style support has been added

#   - 1.2 (04/03/08), Display bug fixed with Battle Frenzy script

#==============================================================================

 

#==============================================================================

#  ** Weapon Unleash Configuration

#==============================================================================

 

module Weapon_Unleash

  # Weapons that can unleash a skill

  Weapons = [1,2,3]

  # The skill unleashed by weapon_id

  # SYNTAX: weapon_id => skill_id

  Skill = { 

              1 => 59,

              2 => 82

            }

  # Default skill unleashed          

  Skill.default = 1

  # Chances in percent to unleash a skill

  # SYNTAX: weapon_id => percent

  Rate = {

              1 => 100,

              2 => 100

             }

  # Default rate          

  Rate.default = 25          

end

 

# Text displayed in the battle text window when the skill is unleashed

Vocab::WeaponUnleash = "%s's %s unleashed %s!"

 

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles actors. It's used within the Game_Actors class

# ($game_actors) and referenced by the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Get Normal Attack Animation ID

  #--------------------------------------------------------------------------

  def atk_animation_id

    if two_swords_style

      return weapons[0].animation_id if weapons[0] != nil

      return weapons[1] == nil ? 1 : 1

    else

      return weapons[0] == nil ? 1 : weapons[0].animation_id

    end

  end

  #--------------------------------------------------------------------------

  # * Get Normal Attack Animation ID (Dual Wield: Weapon 2)

  #--------------------------------------------------------------------------

  def atk_animation_id2

    if two_swords_style

      return weapons[1] == nil ? 1 : weapons[1].animation_id

    else

      return 1

    end

  end

end

 

#==============================================================================

# ** Scene_Battle

#------------------------------------------------------------------------------

#  This class performs battle screen processing.

#==============================================================================

 

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------

  # * Alias listing

  #--------------------------------------------------------------------------

  alias dargor_execute_action_attack execute_action_attack

  #--------------------------------------------------------------------------

  # * Execute Battle Action: Attack

  #--------------------------------------------------------------------------

  def execute_action_attack

    # Execute weapon unleash check

    if @active_battler.is_a?(Game_Actor)

      weapon = @active_battler.weapons[0]

      if weapon_can_unleash?(weapon)

        # Execute weapon unleash for weapon 1

        execute_action_weapon_unleash(weapon) 

      else

        # Execute normal attack for weapon 1

        execute_specific_action_attack(1) 

      end

      # If battler has two swords style

      if @active_battler.two_swords_style

        weapon = @active_battler.weapons[1]

        if weapon_can_unleash?(weapon)

          # Execute weapon unleash for weapon 2

          execute_action_weapon_unleash(weapon)

        else

          # Execute normal attack for weapon 2

          execute_specific_action_attack(2) 

        end

      end    

    # Execute normal attack

    else

      dargor_execute_action_attack

    end

  end

  #--------------------------------------------------------------------------

  # * Execute Specific Battle Action: Attack

  #     weapon : actor's weapon (1 or 2)

  #--------------------------------------------------------------------------

  def execute_specific_action_attack(weapon)

    if weapon == 1

      animation = @active_battler.atk_animation_id

    end

    if weapon == 2

      animation = @active_battler.atk_animation_id2

    end

    text = sprintf(Vocab::DoAttack, @active_battler.name)

    @message_window.add_instant_text(text)

    targets = @active_battler.action.make_targets

    display_normal_animation(targets, animation)

    wait(30)

    for target in targets

      target.attack_effect(@active_battler)

      display_action_effects(target)

    end

  end

  #--------------------------------------------------------------------------

  # * Execute Battle Action: Weapon Unleash

  #--------------------------------------------------------------------------

  def execute_action_weapon_unleash(weapon)

    skill = $data_skills[Weapon_Unleash::Skill[weapon.id]]

    skill = $data_skills[Weapon_Unleash::Skill.default] if skill.nil?

    weapon_name = weapon.name

    text = sprintf(Vocab::WeaponUnleash, @active_battler.name, weapon_name, skill.name)

    @message_window.add_instant_text(text)

    targets = @active_battler.action.make_targets

    display_animation(targets, skill.animation_id)

    for target in targets

      target.skill_effect(@active_battler, skill)

      display_action_effects(target, skill)

      @message_window.back_to(4)

    end

  end

  #--------------------------------------------------------------------------

  # * Weapon can unleash?

  #--------------------------------------------------------------------------

  def weapon_can_unleash?(weapon)

    return false if @active_battler.is_a?(Game_Enemy)

    return false unless Weapon_Unleash::Weapons.include?(weapon.id)

    rate = Weapon_Unleash::Rate[weapon.id]

    rate = Weapon_Unleash::Rate.default if rate.nil?

    random = rand(100)

    return random <= rate

  end

end

Notes

This is my first script for RMVX, I hope you'll enjoy it!
Don't forget to give me credit!

-Dargor
 
Ow i loved those crit(unleashes) fom golden sun (espacially with my lvl 40 Isaac with his gaia sword ) :p .
I'm really going to try this out .
 
I see a section in the script that might be what I"m talking about but I'm not sure how to edit it.  For me, if the skill is triggered it negates the original attack and animation.  Is there a way to have it so that...

1. Weapon attacks and does the regular weapon damage
2. THEN it says 'Skill unleashed!' and proceeds with the skill animation and damage

Sorry if it's in front of me and I'm just missing it.
 
The point of the unleash was to replace the basic attack. When Felix used his Sol Blade, it either attacked normally or unleashed Meggido. (How do you spell that?)
The system should be used so that the players can look forward to it and so that it can make the difference in a boss battle.
Great script!
 
I copied and pasted the script, but nothing's happening. I haven't changed anything yet. I keep attacking with the longsword, but it doesn't unleash Newclear. Am I doing something wrong?

Edit: Never mind, it works now.
 
Seeing as other people are posting, I may aswell add a comment.
Very interesting script, I like the idea, but did you ever think about using the Skills 'Notes' Section to work everything out? It might be a lot easier (especially for the user of the script).
Anyways, like the script ^_^
 
@kire
This script was designed for the default battle system. So it won't be compatible with an ABS.

@syvkal
The note feature can certainly be exploited and I'm actually working on it. Not especially for this script but I could add this as a feature in another version.
Also, I'm working on what I call my 'Playground', a collection of all my VX scripts, and this playground will include an editor (made with RMVX) that will let you edit all my scripts with a visual interface.

Thanks for the feedbacks!
-Dargor
 

kire

Member

Thanks
Might use it for a future project, now i'm working with an ABS
I know It's difficult but you might try to do this compatible for ABS, with ABS It might/will be the best add-on I ever seen
 
@Dargor I was thinking about making that Scene customisation thing too or 'Playground'.

But I'd have to implement a mouse system with Drag and Drop. So I couldn't be bothered because it wasn't amazingly important to me xD
 
Umm... excuse me, could somebody help? I can't seem to get this to work. I didn't change anything, but Club won't unleash Fire / Long Sword won't unleash Newclear. Is there something i need to change?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top