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 Training System v1.00

0 Members and 1 Guest are viewing this topic.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
Weapon Training System
Version: 1.00
Author: NAMKCOR
Date: April 06, 2008

Version History


  • v1.00 - Completed System

Planned Future Versions

  • v?.?? possible efficiency upgrades and bug fixes

Description


Think FF2 with this one.  Characters all have 'skill levels' with types of weapons that grant them bonuses with those types of weapons.  They gain experience every time they attack with the weapon, and each weapon skill level gives them bonus skill in determining attack damage, the accuracy, and the critical rate of that weapon type

Features

  • Easy to configure bonus rates
  • Easy to configure experience/level requirement
  • Easy to configure default level values
  • Uses weapon elements to make weapon categories a breeze

Screenshots

N/A for this type of script

Instructions

Comments and instructions for the individual customizations will be given right where they are located.  Only real skills needed are reading, typing, and copy&paste

Script


Code: [Select]
#=================================================================
#   Weapon Training System                                                     
#---------------------------------------------------------------------------------------------------------------------
#   Created By: NAMKCOR                                                                                                     
#   Created for the Websites: Chaos Project, RPG Maker Resource Kit
#                                                  (www.chaosproject.co.nr; www.rmrk.net)                       
#   If this script is hosted on any other website, then it is stolen, please contact           
#   me at the address given below                                                                                         
#--------------------------------------------------------------------------------------------------------------------
#   If you find any Bugs/Incompatability issues with this script, please contact me at   
#   the following e-mail address: Rockman922@aol.com, and please be descriptive   
#   with your e-mail subject, as I delete spam on sight.                                                                                                             
#--------------------------------------------------------------------------------------------------------------------
#   Function:                                                                                                                             
#    Think FF2 with this one.  Characters all have 'skill levels' with types of weapons that
#    grant them bonuses with those types of weapons.  They gain experience every time
#    they attack with the weapon, and each weapon skill level gives them bonus skill in
#     determining attack damage, the accuracy, and the critical rate of that weapon type
#                                                                         
#    Compatability:                                                                                                                   
#     100% compatability with SDK (some things may conflict I dunno SDK well)
#      80% compatability with exotic CBSes
#      uses own damage calculations that might cause errors in some cases (merge required)
#      0% compatibility with RTAB
#      Unknown as of yet, but high possibility of corrupting old save files
#
#     Instructions:                                                                                                                     
#      Comments and instructions for the individual customizations will be given           
#       right where they are located.  Only real skills needed are reading, typing,             
#       and copy&paste
#--------------------------------------------------------------------------------------------------------------------
#     Version History:
#     1.0 - completed system
#=================================================================
    #how much experience is given per attack
    $WTSexp_rate = 5
   
    #bonus rate formula is weapon level * bonus amount
    $WTSattack_bonus = 10
    $WTSaccuracy_bonus = 10
    $WTScritical_bonus = 10
   
    #==============================================================
    # @exp_levels : how much experience is needed to reach the next level
    #----------------------------------------------------------------------------------------------------------------
    # this array functions quite simply, each element is a level, and the value in that
    # element is the amount of experience needed to reach that level.
    # so an array with values [15, 30, 45] would have 3 levels, level 1 needing 15xp
    # level 2 needing 30xp and level 3 needing 45xp
    #==============================================================
    $WTSexp_levels = [10, 30, 60, 100, 150, 210, 280]
   
    #==============================================================
    # @elements : which elements are used to store weapon types
    #----------------------------------------------------------------------------------------------------------------
    # simply place the indexes of the elements you plan on using in the array below
    # a REMINDER that only the first numerical value of an element will be taken
    # into consideration.  So if you make a weapon with elements 17 and 20, only
    # element 17 will be taken into consideration.
    # ALSO a weapon type -must- be set, or else you will get a range error
    #==============================================================
    $WTSelements = [17, 18, 19, 20]
   


class Game_Actor < Game_Battler

  attr_accessor  :WTSweapon_experience
  attr_accessor  :WTSweapon_levels
 
  alias WTS_setup_after setup
  def setup(actor_id)
    WTS_setup_after(actor_id)
    #==============================================================
    # @WTSweapon_experience
    #----------------------------------------------------------------------------------------------------------------
    # by modifying the case-when, adding whens for every actor, you are able to
    # set what amount of experience with a given weapon type teh character has
    # at the start of your game.  That way a swordsman could be good with swords
    # or a sniper with rifles etc...
    #----------------------------------------------------------------------------------------------------------------
    # default: @WTSweapon_experience = [0,0,0,0]
    #                @WTSweapon_levels = [0,0,0,0]
    # template when [actor_id] then
    #                             @WTSweapon_experience = [0,0,0,...]
    #                             @WTSweapon_levels = [0,0,0,...]
    #                 end
    # !!! WARNING !!! be sure to add an element to these arrays for every weapon
    # element type used, or you may encounter bugs later on; and try to line up
    # weapon levels with the appropriate amount of experience, or when it
    # auto-corrects, it will appear very buggy
    #==============================================================
    case actor_id
      when 1 then
        @WTSweapon_experience = [0,0,0,0]
        @WTSweapon_levels = [0,0,0,0]
      when 2 then
        @WTSweapon_experience = [0,0,0,0]
        @WTSweapon_levels = [0,0,0,0]
      end
    end
   
    #===================================================================
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
    #===================================================================
   
    def attack_bonus
      @temp_element = $data_weapons[self.weapon_id].element_set
      for i in 0...@temp_element.size
          for j in 0...$WTSelements.size
            if $WTSelements[j] == @temp_element[i]
              return $WTSattack_bonus * @WTSweapon_levels[j]
            end
          end
        end
      end
     
      def accuracy_bonus
      @temp_element = $data_weapons[self.weapon_id].element_set
      for i in 0...@temp_element.size
          for j in 0...$WTSelements.size
            if $WTSelements[j] == @temp_element[i]
              return $WTSaccuracy_bonus * @WTSweapon_levels[j]
            end
          end
        end
      end
     
      def critical_bonus
      @temp_element = $data_weapons[self.weapon_id].element_set
      for i in 0...@temp_element.size
          for j in 0...$WTSelements.size
            if $WTSelements[j] == @temp_element[i]
              return $WTScritical_bonus * @WTSweapon_levels[j]
            end
          end
        end
      end
  end

class Scene_Battle
 
  alias make_basic_action_result_first make_basic_action_result
  def make_basic_action_result
    make_basic_action_result_first
    if !$game_troop.enemies.include?(@active_battler)
      @temp_element = $data_weapons[@active_battler.weapon_id].element_set
      if @active_battler.current_action.basic == 0
        for i in 0...@temp_element.size
          for j in 0...$WTSelements.size
            if $WTSelements[j] == @temp_element[i]
              @active_battler.WTSweapon_experience[j] += $WTSexp_rate
              if $WTSexp_levels[@active_battler.WTSweapon_levels[j]] != nil
                while @active_battler.WTSweapon_experience[j] >=
                  $WTSexp_levels[@active_battler.WTSweapon_levels[j]]
                  @active_battler.WTSweapon_levels[j] += 1
                end
              end
            end
          end
        end
      end
    end
  end
 
end

class Game_Battler
 
  alias attack_effect_old attack_effect
  def attack_effect(attacker)
    self.critical = false
    if !$game_troop.enemies.include?(attacker)
    hit_result = (rand(100) < (attacker.hit + attacker.accuracy_bonus))
    if hit_result == true
      atk = [(attacker.atk + attacker.attack_bonus) - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * (attacker.dex + attacker.critical_bonus) / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end
      end
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    if hit_result == true
      remove_states_shock
      self.hp -= self.damage
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    else
      self.damage = "Miss"
      self.critical = false
    end
    return true
    end
    attack_effect_old(attacker)
  end
end

Credit


  • NAMKCOR

Thanks

  • FF2 for inspiring the system
  • Zeriab and Falcon for bits of help in IRC

Support


If you find any Bugs/Incompatability issues with this script, please contact me at the following e-mail addresses: Rockman922@aol.com and rockmanamkcor@yahoo.com, and please be descriptive with your e-mail subject, as I delete spam on sight.

Known Compatibility Issues

incompatible with RTAB, trying to figure out a merge or something

Demo


demo attached to bottom of post

Author's Notes


This is my first foray back into scripting for a while, I'm glad it finally worked, and I hope y'all like it \o/

Restrictions

Created for the Websites: Chaos Project, RPG Maker Resource Kit
(www.chaosproject.co.nr; www.rmrk.net)                     
If this script is hosted on any other website, then it is stolen, please contact me at either of the locations given

If you use this script in your game, please link me to the topic
I love to see what my work is used for

do NOT use this script in a commercial game unless you get my permission first
« Last Edit: April 06, 2008, 09:21:10 PM by 1namkcorI »

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: Bandcamp | Twitter | Patreon

*
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 Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
It looks very cool NAM, will try it out later.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
crap, I forgot to remove the print lines in the script >.<
re-uploading now

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: Bandcamp | Twitter | Patreon

*
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 Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
By the way, I think you might need to update your links to chaos project. It's something like http://chaos-project.com/cpforum/index.php or something now.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
the .co.nr still loaded for me the other day, I'll find the new link and update it

also, topic updated ;-;

edit: I'm working on making the system RTAB compatible, please bear with me :)
« Last Edit: April 07, 2008, 07:17:12 PM by 1namkcorI »

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: Bandcamp | Twitter | Patreon

***
Rep:
Level 86
Brits, or gtfo.
-hammers down on +Rep button-
why are you looking down here srsly i mean, my post is up there.

**
Rep:
Level 86
I've been searching for something like this for a while! And now, I have a question: Is there a way to make certain weapons require a certain level of mastery using this script? Like in Fire Emblem, fora swordsman to use certain swords, they need to have a certain level of mastery.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
I'm working on a version of my equipment requirement system that allows for weapon level requirement, so I'll PM you when that's done and added

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: Bandcamp | Twitter | Patreon

pokeball NoxOffline
*
Rep: +0/-0Level 80
RMRK Junior
Sorry if this is considered necro-posting ._.

Quote
    #==============================================================
    # @elements : which elements are used to store weapon types
    #----------------------------------------------------------------------------------------------------------------
    # simply place the indexes of the elements you plan on using in the array below
    # a REMINDER that only the first numerical value of an element will be taken
    # into consideration.  So if you make a weapon with elements 17 and 20, only
    # element 17 will be taken into consideration.
    # ALSO a weapon type -must- be set, or else you will get a range error
    #==============================================================
    $WTSelements = [17, 18, 19, 20]

So if I get things right... The elements are the fire, water, vs beasts, etc, right? And there needs to be one element per weapon type, right? And they'd have to be the first elements, otherwise if I make a weapon that has both element fire (1) and sword (16), it wouldn't even register that it was a sword, and therefore not take the exp system into account?
Or have I misunderstood stuff?

Edit: I check in now and then, NAMKCOR ^^;  Thanks for answering my question =D You're made of awesomesauce!
*edits post to avoid necroposting with a thankyou*
« Last Edit: September 03, 2010, 09:25:05 AM by Nox »

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
wow, I don't think the person that asked is here to see this but, that explanation was about weapon types only.  If you try to make a sword/spear it won't work, but if you wanted to make a fire/sword it should, because fire isn't in the weapons type array.

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: Bandcamp | Twitter | Patreon