[XP] Ryex's Weapons Unleash Skills

Started by Ryex, May 11, 2009, 12:08:10 am

Previous topic - Next topic

Ryex

May 11, 2009, 12:08:10 am Last Edit: November 18, 2014, 08:39:18 pm by KK20
Ryex's Weapons Unleash Skills
Authors: Ryex
Version: 1.22
Type: Weapon Add-On System
Key Term: Battle Add-on



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

Spoiler: ShowHide






Demo

Media Fire



Script

Spoiler: ShowHide


#=============================================================================
#
# ** 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
     case self.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
     case self.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 @active_battler.weapon_id == 0 || $data_weapons[@active_battler.weapon_id].unleash_chance == false
         if rand(100) <= ($data_weapons[@active_battler.weapon_id].unleash_chance)
           @active_battler.current_action.kind = 1
           @active_battler.current_action.skill_id = $data_weapons[@active_battler.weapon_id].unleash_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
BABS version: ShowHide


#=============================================================================
#
# ** Ryex's Weapons Unleash Skills BABS version
#
#-----------------------------------------------------------------------------
#
# By Ryex
# V 1.01
#
#-----------------------------------------------------------------------------
#
# 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
     case self.id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration for the skills weapons unleash
# Use when <WeaponID> then return <ID of Unleash skill>
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then return 7
#add new lines here
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     end
     return 0
   end
 
   def unleash_chance
     case self.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 50
#add new lines here
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     end
     return false
   end
 end
end
 
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 @battler.weapon_id == 0 || $data_weapons[@battler.weapon_id].unleash_chance == false
     if rand(100) <= ($data_weapons[@battler.weapon_id].unleash_chance)
       use_skill($data_skills[$data_weapons[@battler.weapon_id].unleash_id])
       @battler.unleash = true
     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.unleash = false
     # remove last hpdamage and spdamage values
     @battler.hpdamage = @battler.spdamage = 0
     # execute skill
     result = $BlizzABS.skillitem_process(self, skill)
     # if used and not charging up
     if result
       # 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
     end
     # used or charging
     return (result || charging?)
   else
     ryex_WUS_Map_Actor_use_skill_latter(skill)
   end
 end

end





Instructions

In Script


Compatibility

none know
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!
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

Rye the $data_weapons thing wont work without modding module RPG

Ryex

May 11, 2009, 12:11:45 am #2 Last Edit: May 11, 2009, 12:13:15 am by Ryexander
It work trust me I've tried it

oh and
Quote

module RPG
 
  class Weapon
   
    attr_accessor :unleash_id
    attr_accessor :unleash_chance
   
    alias ryex_WUS_MWeapon_init_later initialize
    def initialize
      ryex_WUS_MWeapon_init_later
      @unleash_id = 0
      @unleash_chance = false
    end
   
  end
 
end


I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

I didnt realize you had put the module RPG in there sorry  :shy:

and in the other topic I was showing you another way to setup config that way people dont ahve to type up
$data_weapons


  • they can just use this

    module RPG
     
      class Weapon
       
        def unleash_id
          case id
          when 1 then return 2
          end
          return 1
        end
       
        def unleash_chance
          case id
          when 1 then return 100
          end
          return 50
        end
       
      end
     
    end


    That way people dont have to type up the long $data_weapons
    its a simple
    when x then return y

Ryex

May 11, 2009, 12:18:41 am #4 Last Edit: May 11, 2009, 12:21:27 am by Ryexander
but then they have to type longer

When <Weapon_Id> then return <Unleash chance or Skill_ID>

as opposed to
$data_weapons.unleash_id = <ID>


I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

Spoiler: ShowHide
#=============================================================================
#
# ** Ryex's Weapons Unleash Skills
#
#-----------------------------------------------------------------------------
#
# 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
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    def unleash_id
      case id
      # Use
      # when weapon_id then return skill_id
      when 1 then return 2
      end
      return 1
    end
   
    def unleash_chance
      case id
      # Use
      # when weapon_id then return chance
      when 1 then return 100
      end
      return 50
    end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   
  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)
      unless $data_weapons[@active_battler.weapon_id].unleash_chance == false
        if rand(100) <= ($data_weapons[@active_battler.weapon_id].unleash_chance)
          @active_battler.current_action.kind = 1
          @active_battler.current_action.skill_id = $data_weapons[@active_battler.weapon_id].unleash_id
          @active_battler.current_action.unleash = true
        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]
      @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
  end
 
end


I added the easy configure in there.
I dont get how it'd be longer its really easy.

Ryex

ok I see how this is simpler from a logic point of view but not speed or space
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

Its completely up to you I was just trying to help make it easier is all.  :^_^':


tSwitch

May 11, 2009, 09:02:03 am #8 Last Edit: May 11, 2009, 09:55:53 am by Elite Four NAMKCOR
Quote from: Ryexander on May 11, 2009, 12:24:20 am
ok I see how this is simpler from a logic point of view but not speed or space


by using the case/when it keeps all the config and such in one place, it also doesn't require that you make two new variables per weapon, which take up more memory and don't work significantly faster than going through a case/when.

Also, it puts code in less classes (no more game_system) which can help keep the code sleeker and more compatible with other scripts that may also modify the same classes.

lastly, it's just as easy for someone to understand how to configure a case/when, if not a little easier, because the syntax is clear and is almost pseudocode.  "when 1 then return 5" sounds like english whereas "$data_weapons[1].unleash_id = 5" can look pretty cryptic to noncoders.

edit:
oh and I forgot, you'd have to call $data_weapons.unleash_id(id) rather than $data_weapons[id].unleash_id, but that's not a significant difference tbh.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: tSwitch.us | Twitter | Tumblr

Ryex

May 11, 2009, 03:30:18 pm #9 Last Edit: May 11, 2009, 08:36:16 pm by Elite Four Aqua
Alright I relent.

Script updated win new config :P

Edit:
Important UPDATE  I found Two rather huge bugs and promptly fixed then with three lines of code..


Aqua's Note:
Don't double post within 24 hours.  A simple edit to your post would have automatically bumped this. ^_^"
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Calintz

I can't say whether or not I will use this, but this is cool.

Aqua

Think this works with Blizz-ABS?

Might use it if it does... lol

Calintz


Ryex

June 11, 2009, 07:20:38 pm #14 Last Edit: June 11, 2009, 07:26:38 pm by Ryexander
Quote from: Aqua on June 11, 2009, 06:05:28 pm
Think this works with Blizz-ABS?

Might use it if it does... lol

that would be a bit more complex as skills work differently in Babs, but I could work on it you you want. and it would be a bit weird (i think) if you were swinging you sword about and fire balls randomly fly out... come to think of it that would be AWESOME!
I would have to make a babs only version i think.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Kagutsuchi

It seems like when you block, you can do a Unleash skill instead. I think that should be removed.

Calintz

So, is this kinda like in Final Fantasy Tactics, when you hit someone with a flame rod as a regular attack, and the rod casts magic all by itself!?

G_G


Calintz


Ryex

Quote from: Kagutsuchi on June 12, 2009, 11:26:41 am
It seems like when you block, you can do a Unleash skill instead. I think that should be removed.


caused by a typo

UPDATED TO V1.22!
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />