[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.
Script Show
  1. #==============================================================================
  2. # ** Weapon Unleash
  3. #------------------------------------------------------------------------------
  4. #    © Dargor, 2008
  5. #   04/03/08
  6. #   Version 1.1
  7. #------------------------------------------------------------------------------
  8. #   INSTRUCTIONS:
  9. #    - Edit the constants in the Weapon_Unleash module and enjoy!
  10. #   VERSION HISTORY:
  11. #    - 1.0 (02/03/08), Initial release
  12. #    - 1.1 (04/03/08), Two Swords Style support has been added
  13. #    - 1.2 (04/03/08), Display bug fixed with Battle Frenzy script
  14. #==============================================================================
  15.  
  16. #==============================================================================
  17. #   ** Weapon Unleash Configuration
  18. #==============================================================================
  19.  
  20. module Weapon_Unleash
  21.   # Weapons that can unleash a skill
  22.   Weapons = [1,2,3]
  23.   # The skill unleashed by weapon_id
  24.   # SYNTAX: weapon_id => skill_id
  25.   Skill = {
  26.                     1 => 59,
  27.                     2 => 82
  28.                  }
  29.   # Default skill unleashed             
  30.   Skill.default = 1
  31.   # Chances in percent to unleash a skill
  32.   # SYNTAX: weapon_id => percent
  33.   Rate = {
  34.                     1 => 100,
  35.                     2 => 100
  36.                   }
  37.   # Default rate             
  38.   Rate.default = 25             
  39. end
  40.  
  41. # Text displayed in the battle text window when the skill is unleashed
  42. Vocab::WeaponUnleash = "%s's %s unleashed %s!"
  43.  
  44. #==============================================================================
  45. # ** Game_Actor
  46. #------------------------------------------------------------------------------
  47. #   This class handles actors. It's used within the Game_Actors class
  48. # ($game_actors) and referenced by the Game_Party class ($game_party).
  49. #==============================================================================
  50.  
  51. class Game_Actor < Game_Battler
  52.   #--------------------------------------------------------------------------
  53.   # * Get Normal Attack Animation ID
  54.   #--------------------------------------------------------------------------
  55.   def atk_animation_id
  56.      if two_swords_style
  57.         return weapons[0].animation_id if weapons[0] != nil
  58.         return weapons[1] == nil ? 1 : 1
  59.      else
  60.         return weapons[0] == nil ? 1 : weapons[0].animation_id
  61.      end
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Get Normal Attack Animation ID (Dual Wield: Weapon 2)
  65.   #--------------------------------------------------------------------------
  66.   def atk_animation_id2
  67.      if two_swords_style
  68.         return weapons[1] == nil ? 1 : weapons[1].animation_id
  69.      else
  70.         return 1
  71.      end
  72.   end
  73. end
  74.  
  75. #==============================================================================
  76. # ** Scene_Battle
  77. #------------------------------------------------------------------------------
  78. #   This class performs battle screen processing.
  79. #==============================================================================
  80.  
  81. class Scene_Battle < Scene_Base
  82.   #--------------------------------------------------------------------------
  83.   # * Alias listing
  84.   #--------------------------------------------------------------------------
  85.   alias dargor_execute_action_attack execute_action_attack
  86.   #--------------------------------------------------------------------------
  87.   # * Execute Battle Action: Attack
  88.   #--------------------------------------------------------------------------
  89.   def execute_action_attack
  90.      # Execute weapon unleash check
  91.      if @active_battler.is_a?(Game_Actor)
  92.         weapon = @active_battler.weapons[0]
  93.         if weapon_can_unleash?(weapon)
  94.            # Execute weapon unleash for weapon 1
  95.            execute_action_weapon_unleash(weapon)
  96.         else
  97.            # Execute normal attack for weapon 1
  98.            execute_specific_action_attack(1)
  99.         end
  100.         # If battler has two swords style
  101.         if @active_battler.two_swords_style
  102.            weapon = @active_battler.weapons[1]
  103.            if weapon_can_unleash?(weapon)
  104.               # Execute weapon unleash for weapon 2
  105.               execute_action_weapon_unleash(weapon)
  106.            else
  107.               # Execute normal attack for weapon 2
  108.               execute_specific_action_attack(2)
  109.            end
  110.         end    
  111.      # Execute normal attack
  112.      else
  113.         dargor_execute_action_attack
  114.      end
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # * Execute Specific Battle Action: Attack
  118.   #       weapon : actor's weapon (1 or 2)
  119.   #--------------------------------------------------------------------------
  120.   def execute_specific_action_attack(weapon)
  121.      if weapon == 1
  122.         animation = @active_battler.atk_animation_id
  123.      end
  124.      if weapon == 2
  125.         animation = @active_battler.atk_animation_id2
  126.      end
  127.      text = sprintf(Vocab::DoAttack, @active_battler.name)
  128.      @message_window.add_instant_text(text)
  129.      targets = @active_battler.action.make_targets
  130.      display_normal_animation(targets, animation)
  131.      wait(30)
  132.      for target in targets
  133.         target.attack_effect(@active_battler)
  134.         display_action_effects(target)
  135.      end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # * Execute Battle Action: Weapon Unleash
  139.   #--------------------------------------------------------------------------
  140.   def execute_action_weapon_unleash(weapon)
  141.      skill = $data_skills[Weapon_Unleash::Skill[weapon.id]]
  142.      skill = $data_skills[Weapon_Unleash::Skill.default] if skill.nil?
  143.      weapon_name = weapon.name
  144.      text = sprintf(Vocab::WeaponUnleash, @active_battler.name, weapon_name, skill.name)
  145.      @message_window.add_instant_text(text)
  146.      targets = @active_battler.action.make_targets
  147.      display_animation(targets, skill.animation_id)
  148.      for target in targets
  149.         target.skill_effect(@active_battler, skill)
  150.         display_action_effects(target, skill)
  151.         @message_window.back_to(4)
  152.      end
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # * Weapon can unleash?
  156.   #--------------------------------------------------------------------------
  157.   def weapon_can_unleash?(weapon)
  158.      return false if @active_battler.is_a?(Game_Enemy)
  159.      return false unless Weapon_Unleash::Weapons.include?(weapon.id)
  160.      rate = Weapon_Unleash::Rate[weapon.id]
  161.      rate = Weapon_Unleash::Rate.default if rate.nil?
  162.      random = rand(100)
  163.      return random <= rate
  164.   end
  165. end
Expand to see the code.


Notes

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

-Dargor
Pretty nice, but you forgot to include support for VX's dual wield option ;p
Oops, I'm still thinking RMXP! Thanks, I'll fix that.

EDIT: FIXED!
Thank you for this, this is brilliant for me to use. Nice first [RMVX] script!
This is a very good script, i might use this one day
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 .
Wow i love this! Thank you so much!  😆 😆 😆
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.
Thanks to everyone, I'm glad you like my script!

@zephstudio
Sure, I can add that feature. :thumb:
I just tried it out and love it. Great Job. Thanks!
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!
Quote:
This script is based on Golden Sun weapons special attacks

I love you  :thumb:
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.
Just a question
It's this compatible with abs?
But BTW it's a great script
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
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?
Don't necropost. It's not healthy.
  -KRoP
It's not a necropost, but it would have been in two days :P

@drewgast 
Have you tried to change the Rate constants in the customization module?
Besides that, do you use Takentai CBS or any other CBS? If so then that's probably the problem.
Actually, when I implemented the script in Tankentai, it fixed the problem. The problem I now have is that the message announcing that the weapon has unleashed won't show up / the damage won't show up.

Also, thanks for such a quick reply.
Uh, your script has a bug.  I have a Weapon Unleash that's supposed to affect the user, but it hits whatever enemy it has targeted instead.  Could you please take a look at it?
It would be nice to make this Tankentai battle system compatible...
@MysteryMan_23 
I'll fix that.
is there any chance you can make it work with tankentai side view battle system? :P
awesome script by the way. :)

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=42357