[XP] Weapon Specific Skills

Started by Aqua, July 29, 2009, 02:04:12 pm

Previous topic - Next topic

Wizered67

In order to do that you would have to do some editing so that it checks your shield instead of your weapon.

Lanzer

no, i tried everything it keeps me sending errors since i modded the weapons part for armor1, armor2 etc
besides the weapon database is only for weapon reading so i requested aqua to rework his addon =) to change the weapon for armor accessor




Grogy

hello, kinda retarded that this is a major necro post BUT
I've been searching for this kind of script, but that it works with armors, too (maybe by using the element defense things)
Anyway, thanks

Imanton

Seems it is does not work with "Tankentai Sideview Battle System: Actor Advanced Status" for custom slots. i would like to add separate slot for a bot but wont work, i know it works because i got it to work on a different project on the shield slot. oh, and the demo link went down.

gmaker808

This script is awesome but i wanted to know what would it take to change this so that instead of using a specific weapon can you make it so it's a specific Class
Example: Squire and Knights use swords but Squires can use First Aid and knights can use Break Helmet. you can only use the skill if you are that class.

ThallionDarkshine

Can't you set that up in the database by making a certain class learn a skill?

gmaker808

oops i forgot to say im using tons of add on - Equap SKill Script so if i put a skill on the sword any one equiping the sword can learn the skill i want to be able to specify.

ThallionDarkshine

Alright, I edited it for you. Just set the element efficiency of the class to anything other than C to allow that class to use the skill.

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
# Weapon Specific Skills Script by TerreAqua
# Version: 1.1
# Type: Skill Limitation Add-on
# Key Term: Custom Skill System
# Date: 7/29/09
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#

#===============================================================================
# Information
#-------------------------------------------------------------------------------
#
#   This script makes it so that some skills can only be used when a certain
#   weapon type is equipped.
#   For example, it shouldn't be possible to use a skill that shoots a bullet
#   when you're equipped with a sword.
#
#   Note: Should be compatible with all battle systems.
#
#   If you need to contact me about this script, please go to:
#   http://forum.chaos-project.com
#
#   You should have only gotten this script from http://chaos-project.com
#   Please let me know if you have found it somewhere else.
#===============================================================================
module Aqua
  module WeaponSpecificSkills
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~::~:~:~: Instructions :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#===============================================================================
#
# Configure DUMMY_ELEMENT to include all the elements that are used for weapon
# types.
# Each weapon should have at least one of the dummy elements.
#
# Skills without a dummy element can be used with any weapon.
# Skills with 1 dummy element can only be used by that weapon type.
# Skills with multiple dummy elements can be used by multiple weapon types.
#
#===============================================================================

DUMMY_ELEMENT = [17, 18, 19, 20]

#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~  End Configure Area  :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  end
end

#===============================================================================
# Credits:
# Aqua (aka TerreAqua) for making this.
# vacancydenied for requesting it.
# Starrodkirby86 for just being him :)
#===============================================================================

#===============================================================================
#  This work is protected by the following license:
# #-----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #-----------------------------------------------------------------------------
#===============================================================================

class Game_Actor
  alias aqua_weapon_specific_skill_can_use? skill_can_use?
  def skill_can_use?(skill_id)
    for i in 0...Aqua::WeaponSpecificSkills::DUMMY_ELEMENT.size
      dummyele = Aqua::WeaponSpecificSkills::DUMMY_ELEMENT[i]
      weapon = $data_weapons[self.weapon_id]
      clss = $data_classes[self.class_id]
      if weapon == nil && $data_skills[skill_id].element_set.include?(dummyele)
        return false
      end
      if $data_skills[skill_id].element_set.include?(dummyele) &&
          weapon.element_set.include?(dummyele) && clss.element_ranks[dummyele] != 3
       return super
      end
    end
    a = Aqua::WeaponSpecificSkills::DUMMY_ELEMENT.any? {|e|
        $data_skills[skill_id].element_set.include?(e)}
    return false if a == true
    aqua_weapon_specific_skill_can_use?(skill_id)
  end
end

if $DUMMY_ELEMENTS != nil
  $DUMMY_ELEMENTS |= Aqua::WeaponSpecificSkills::DUMMY_ELEMENT
else
  $DUMMY_ELEMENTS = Aqua::WeaponSpecificSkills::DUMMY_ELEMENT.clone
end

class Game_Battler
  #--------------------------------------------------------------------------
  # * Fix Elements
  #--------------------------------------------------------------------------
  def elements_correct(elements)
    multiplier = size = 0
    elements.each {|i|
        unless $DUMMY_ELEMENTS.include?(i)
          multiplier += self.element_rate(i)
          size += 1
        end}
    return (size == 0 ? 100 : multiplier/size)
  end
 
end

Jotari

Hey, so, pretty far in the future now, not sure if you're still around, but I have a question. What about enemies? Enemies don't have weapons, so if I set a skill up to work with only certain weapons it means enemies can't use that skill. That kind of sucks because my game has enemies using all the same skills as the player for the most part. I guess I could make two copies of every skill, one for players and one for enemies, but that's very troublesome if stats needed to be altered. Is there a way to give all enemies access to all skills without this limitation?

KK20

January 23, 2024, 02:06:27 pm #49 Last Edit: January 23, 2024, 02:08:51 pm by KK20
Did you try adding the script in a project? Looking at the code, the logic is only being applied to Game Actors, not Game Enemies. Your concern shouldn't be an issue.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Jotari

Quote from: KK20 on January 23, 2024, 02:06:27 pmDid you try adding the script in a project? Looking at the code, the logic is only being applied to Game Actors, not Game Enemies. Your concern shouldn't be an issue.
Yes, I tested it. Made a skill need an element and then gave an enemy only that skill and the enemy's turn just kept ending with nothing happening.

KK20

Worked for me on a new project.

You sure the enemy can naturally use the skill (e.g. has enough SP to satisfy the SP cost)? Remove the script from your project and confirm the enemy is still unable to use the skill.

Otherwise, will need your project files to investigate it further. Highly doubt it's a script compatibility issue; I think it's more of a database configuration issue.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Jotari

Opps. Yeah, the issue was just that the enemy I was testing with didn't have enough SP to use the skill in question. Sorry about that. Obvious in retrospect.