RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Weapon Unleash

0 Members and 1 Guest are viewing this topic.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
Weapon Unleash
Version: 1.0
Author: TDS
Date: April 23, 2011

Version History


  • Version 1.0 04.23.2011 - Public release.

Description


A Script that replicates the "Weapon Unleash" system from the game series "Golden sun". It allows a weapon to randomly use a skill instead of an attack.

Features

  • Gives weapon a chance to "Unleash" a pre set skill during battle which replaces a normal attack.

Instructions

To use the unleash effect add the following to a weapon's note box.
Code: [Select]
UNLEASH: Skill_ID %_Chance

  Skill_ID = The ID of the skill used for the weapon's unleash effect
  %_Chance = Chance of the unleash effect activating from 0-100%

Example:
Code: [Select]
UNLEASH: 23 100

Script


Code: [Select]
#==============================================================================
# ** TDS Weapon Unleash
#    Ver: 1.0
#------------------------------------------------------------------------------
#  * Description:
#  A Script that replicates the "Weapon Unleash" system from the game series
#  "Golden sun".
#------------------------------------------------------------------------------
#  * Features:
#  Gives weapon a chance to "Unleash" a pre set skill during battle.
#------------------------------------------------------------------------------
#  * Instructions:
#  To use the unleash effect add the following to a weapon's note box.
#
#  UNLEASH: Skill_ID %_Chance
#
#  Skill_ID = The ID of the skill used for the weapon's unleash effect
#  %_Chance = Chance of the unleash effect activating from 0-100%
#
#  Example:
#
#  UNLEASH: 23 100
#------------------------------------------------------------------------------
#  * Notes:
#    None.
#------------------------------------------------------------------------------
#  * New Methods:
#  RPG::Weapon Module
#  - unleash_info
#    ^ Method used to read from the weapon's notebox and get unleash information.
#
#  Game_Battler:
#  - weapon_unleash?
#    ^ Method used to determine if unleash effect is possible and set unleash
#      skill as an action.
#
#  Scene_Battle:
#  - execute_weapon_unleash
#    ^ Method used to execute unleash process.
#------------------------------------------------------------------------------
#  * Aliased Methods:
#  Scene_Battle:
#  - execute_action
#    ^ Aliased to check for weapon unleash effect before original method runs.
#------------------------------------------------------------------------------
# WARNING:
#
# Do not release, distribute or change my work without my expressed written
# consent, doing so violates the terms of use of this work.
#
# If you really want to share my work please just post a link to the original
# site.
#
# * Not Knowing English or understanding these terms will not excuse you in any
#   way from the consequenses.
#==============================================================================

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Determine and set Weapon Unleash
  #--------------------------------------------------------------------------
  def weapon_unleash?
    # If self is not an actor ir action is not to attack
    return false if !actor? or !@action.attack?
    # Get Main Weapon
    weapon = weapons[0]
    # Return false if main weapon is nil
    return false if weapon == nil 
    # Get Unleash Information
    unleash_info = weapon.unleash_info
    # Return false if unleash info is nil
    return false if unleash_info == nil
    # If Unleash Rate is more than a random number from 0-100%
    if (rand(100) < unleash_info[1])
      # Set Weapon Unleash Skill
      @action.set_skill(unleash_info[0])
      # Return true
      return true 
    end
    # Return false by default
    return false
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------- 
  alias tds_weapon_unleash_scene_battle_execute_action execute_action unless $@
  #--------------------------------------------------------------------------
  # * Execute Battle Actions
  #--------------------------------------------------------------------------
  def execute_action
    # If Active Battler weapon unleash
    if @active_battler.weapon_unleash?
      # Execute Weapon Unleash
      execute_weapon_unleash
      return
    end   
    # Run Original Method
    tds_weapon_unleash_scene_battle_execute_action   
  end
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Weapon Unleash
  #--------------------------------------------------------------------------
  def execute_weapon_unleash   
    # Get Skill
    skill = @active_battler.action.skill
    # Weapon Unleash Text
    text = sprintf("%s's %s let's out a howl! %s!", @active_battler.name,
    @active_battler.weapons[0].name, skill.name)
    # Add Instant Text
    @message_window.add_instant_text(text)
    # Wait 20 frames
    wait(20)
    # Make Action Targets
    targets = @active_battler.action.make_targets
    # Display Animation
    display_animation(targets, skill.animation_id)
    # Run skill common event if it exist
    $game_temp.common_event_id = skill.common_event_id
    # Go Through Targets
    for target in targets
      # Execute Skill Effect
      target.skill_effect(@active_battler, skill)
      # Display Action Effects
      display_action_effects(target, skill)
    end
  end
end

#==============================================================================
# ** RPG Module
#------------------------------------------------------------------------------
# Module for handling information.
#==============================================================================

module RPG
  #============================================================================
  # ** RPG::Weapon
  #----------------------------------------------------------------------------
  # This module handles Weapon Information
  #============================================================================
  class Weapon < BaseItem
    #-------------------------------------------------------------------------
    # * Get Weapon Unleash Information
    #-------------------------------------------------------------------------
    def unleash_info
      # Check notes for Unleash Skill ID and Chance
      self.note[/UNLEASH: ([-0-9]+) ([-0-9]+)/]     
      # Retunr nil first match is nil
      return nil if $1 == nil
      # Return Array containing unleash values
      return [$1.to_i, $2.to_i]
    end
  end
end



Credit


  • TDS

Support


On this topic.

Known Compatibility Issues

There could be some compatibility issues with custom battle systems, since this script was tested only with the default battle system.

Restrictions

Only for use in non-commercial games.

***
Rep:
Level 74
I'm baaack!
This is a really awesome script... I just don't know where to use it...  :(

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
To use the unleash effect, add into a weapon's notebox the text instructed above.

Example:
Code: [Select]
UNLEASH: 14 100

If this is added for example to the default weapon "Long Sword", every time you attack with that weapon it will instead use the skill "Sickle Weasel". If you don't want it to always use the skill when it attacks lower the 100 to a lower number.

****
Rep:
Level 76
Praise the Sun (Arcana)
GIAW 14: 1st Place (Hard Mode)
Wow, another piece of excellent work. I'm definitely going to use this, perhaps on a weapon that has a chance to set an enemy on fire... oh the possibilities.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Neat effect TDS and very creative; I had never even thought of it. Good stuff! :)
« Last Edit: April 24, 2011, 03:45:03 AM by modern algebra »

*
Rep: +0/-0Level 70
RMRK Junior
It's very good work, but when I try to copy it into my scripts it just becomes one loooooooong line of code.
Would you happen to know who I can remedy this? I'm super excited to use it.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
I think you have to copy the code and paste it in a wordpad/notepad document then put in on your game when that happens.

*
Rep: +0/-0Level 70
RMRK Junior
I'll try that out, thanks TDS!

Edit: It worked! Thanks a bunch!
« Last Edit: May 10, 2011, 12:59:11 AM by TheBlueFlame »

**
Rep: +0/-0Level 69
RMRK Junior
How do you make the text appear before you use the unleash skill? I tried using it, the attack worked fine, but it didnt say the "Characters's weapon let out a howl" thing. thanks for the help if you can give it, if not, then I'll mess around with it

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
Are you using a custom battle system and the message wont appear? Or do you want to know which line displays the unleash message?

If it's the latter, these are the lines where the unleash message is prepared.

Code: [Select]
text = sprintf("%s's %s let's out a howl! %s!", @active_battler.name, @active_battler.weapons[0].name, skill.name)

**
Rep: +0/-0Level 69
RMRK Junior
I'm using a custom battle system. It's a side view battle system, not sure exactly which one because i'm sure there are other ones... if you could help that would be great, and if not then oh well. I'll just do my own experiments.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
I need to know which battle system it is before I can help you.

**
Rep: +0/-0Level 69
RMRK Junior
It's the Tankentai 3.4 battle system.

*
Rep: +0/-0Level 70
RMRK Junior
It would be brilliant to see this work for Yanfly's Melody Engine.  Right now, it throws up errors for most of the execute_weapon_unleash section at line 123 and below.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
Please provide a link to the script when you ask people to make them compatible with them.