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.

[xp]Ryex's Weapons Unleash Skills

Ryex's Weapons Unleash Skills
Authors: Ryex
Version: 1.22
Type: Weapon Add-On System


Introduction

Implements a Unleash system like the one found in Golden sun


Features

  • Allows Weapons to have a chance to "Unleash" skills from the database
  • Customizable unleash rates/chance to unleash for every weapon

Screenshots

unleashsystem.jpg


Demo

Media Fire


Script

Code:
 

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

#

# ** Ryex's Weapons Unleash Skills 

#

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

#

# By Ryex

# V 1.22

#

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

#

# Features

#

#  * Allows Weapons to have a chance to "Unleash" skills from the database

#  * Customizable unleash rates / chance to unleash for every weapon

# 

#   

#

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

#

# Instructions 

#

# Place in a new script above main then fill out the Configuration.

#

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

module RPG

  class Weapon

    def unleash_id(id)

      case id

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# START Configuration for the skills weapons unleash 

# Use when <WeaponID> then return <ID of Unleash skill>

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

when 1 then return 7

when 5 then return 10

when 25 then return 19

when 29 then return 22

#add new lines here

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      end

      return 0

    end

   

    def unleash_chance(id)

      case id

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# START Configuration for unleash chance. 

# this must be filled out other wise weapons will NEVER unleash

# Use when <WeaponID> then return <% chance of unleash (a # 0 - 100)>

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

when 1 then return 100

when 5 then return 50

when 25 then return 25

when 29 then return 75

#add new lines here

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      end

      return false

    end

  end

end

  

class Game_BattleAction

  

  attr_accessor :unleash

  

  alias ryex_WUS_GBattleAction_clear_later clear

  def clear

    @unleash = false

    ryex_WUS_GBattleAction_clear_later

  end

  

  

end

 

class Scene_Battle

 

  alias ryex_WUS_SBattle_update_phase4_step2_later update_phase4_step2

  def update_phase4_step2

    if @active_battler.is_a?(Game_Actor)

      if @active_battler.current_action.basic == 0

        unless $data_weapons[@active_battler.weapon_id].unleash_chance(@active_battler.weapon_id) == false

          if rand(100) <= ($data_weapons[@active_battler.weapon_id].unleash_chance(@active_battler.weapon_id))

            @active_battler.current_action.kind = 1

            @active_battler.current_action.skill_id = $data_weapons[@active_battler.weapon_id].unleash_id(@active_battler.weapon_id)

            @active_battler.current_action.unleash = true

          else

            @active_battler.current_action.unleash = false

          end

        else

          @active_battler.current_action.unleash = false

        end

      end

    end

    ryex_WUS_SBattle_update_phase4_step2_later

  end

  

  alias ryex_WUS_SBattle_make_skill_action_result_later make_skill_action_result

  def make_skill_action_result

    if @active_battler.current_action.unleash == true

      # Get skill

      @skill = $data_skills[@active_battler.current_action.skill_id]

      @active_battler.current_action.unleash = false

      @status_window.refresh

      # Show skill name on help window

      @help_window.set_text(@active_battler.name+"'s Weapon Unleashes "+@skill.name, 1)

      # Set animation ID

      @animation1_id = @skill.animation1_id

      @animation2_id = @skill.animation2_id

      # Set command event ID

      @common_event_id = @skill.common_event_id

      # Set target battlers

      set_target_battlers(@skill.scope)

      # Apply skill effect

      for target in @target_battlers

        target.skill_effect(@active_battler, @skill)

      end

    else

      ryex_WUS_SBattle_make_skill_action_result_later

    end

    @active_battler.current_action.unleash = false

  end

  

end

 

Use the below version if you use Blizz ABS
Code:
 

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

#

# ** Ryex's Weapons Unleash Skills BABS version

#

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

#

# By Ryex

# V 1.00

#

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

#

# Features

#

#  * Allows Weapons to have a chance to "Unleash" skills from the database

#  * Customizable unleash rates / chance to unleash for every weapon

# 

#   

#

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

#

# Instructions 

#

# Place in a new script above main then fill out the Configuration.

#

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

module RPG

  class Weapon

    def unleash_id(id)

      case id

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# START Configuration for the skills weapons unleash 

# Use when <WeaponID> then return <ID of Unleash skill>

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

when 1 then return 7

when 5 then return 10

when 25 then return 19

when 29 then return 22

#add new lines here

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      end

      return 0

    end

   

    def unleash_chance(id)

      case id

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# START Configuration for unleash chance. 

# this must be filled out other wise weapons will NEVER unleash

# Use when <WeaponID> then return <% chance of unleash (a # 0 - 100)>

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

when 1 then return 100

when 5 then return 50

when 25 then return 25

when 29 then return 75

#add new lines here

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      end

      return false

    end

  end

end

  

class class Game_Actor < Game_Battler

  

  attr_accessor :unleash

  

  alias ryex_WUS_GActor_init_later initialize

  def initialize(actor_id)

    @unleash = false

    ryex_WUS_GActor_init_later(actor_id)

  end

  

  

end

 

class Map_Actor < Map_Battler

 

  def use_attack

    unless $data_weapons[@battler.weapon_id].unleash_chance(@battler.weapon_id) == false

      if rand(100) <= ($data_weapons[@battler.weapon_id].unleash_chance(@battler.weapon_id))

        use_skill($data_skills[$data_weapons[@battler.weapon_id].unleash_id(@battler.weapon_id])

        @battler.unleash = ture

      end

    end

    return super

  end

  

  alias ryex_WUS_Map_Actor_use_skill_latter use_skill

  def use_skill(skill)

    #if this skill in a waepon unleash

    if @battler.unleash

      @battler.hpdamage = @battler.spdamage = 0

      # call common event

      common_event_call(skill)

      # set usage animation

      set_usage_animation(skill)

      # set up user damage display if necessary

      user_damage_display

      # reset action

      self.reset_action

      # if using skill sprites for this type of battler

      if BlizzABS::Config::A_SKILL_SPRITES

        # setup sprite extension with ID

        setup_sprites("_skl#{skill.id}")

      else

        # setup sprite extension

        setup_sprites('_skl')

      end

      @battler.unleash = false

      return true

    else

      ryex_WUS_Map_Actor_use_skill_latter(skill)

    end

  end

 

end 

 


Instructions

In Script

Compatibility

no problems known
May not work with old save games
works with all target scopes


Credits and Thanks

  • Ryex

Author's Notes

Wow this was WAY easer than I though it would be

Enjoy and post any bugs!

NOTE: I (the author) do NOT provide support in this thread. I simply don't visit this forum often enough. another scripter may be able to offer help but if you need support from me please go here http://forum.chaos-project.com/index.php?topic=3509.0
 

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