Main Menu
  • Welcome to The RPG Maker Resource Kit.

Skill uses elements/hitratio from weapon

Started by Mr G W, July 17, 2011, 07:51:40 PM

0 Members and 1 Guest are viewing this topic.

Mr G W

Is there any script that does this? I remember seeing one around, but i cant seem to find it anywhere...

doomed2die

I don't know about any officially released ones, but I requested one before on rpgmakervx.net (credits go to Zetu from there) and it got answered :) Credits to me for the annotation and instructions lol

#Add <w elemental> tag to whatever skill tag box you'd like to have weapon ele


class Game_Battler
 
  alias z_make_obj_damage_value make_obj_damage_value unless $@
  def make_obj_damage_value(user, obj)
    recreate_element_set(user, obj)
    z_make_obj_damage_value(user, obj)
  end
 
  def recreate_element_set(user, obj)
    return unless user.actor?
    return unless obj.welemental
    obj.element_set = []
    return if user.weapons[0].nil?
    obj.element_set = weapons[0].element_set
  end
 
end

class RPG::Weapon < RPG::BaseItem
 
  def welemental
    self.note.scan(/<w[ ]elemental>/i){
    return true}
    return false
  end
 
end

Mr G W

#2
Great. thanks. Is there also a script that sets the skill hit ratio to the same as weapon too?

That script is incompatible with the scripts im using... is there any other script like that?

pacdiggity

To solve that compatibility issue, tell us what scripts you're using, post some that would be hard to find, or upload a project with all the scripts you're using.
And above all, tell us what the error is. You don't need another script if it can be fixed.
it's like a metaphor or something i don't know

Mr G W

Its incompatible with Yanfly Equipment Overhaul. Gives a nonmethoderror, i think its because both override the same Class, it seems the only explanaition i can find.

If i place that script above that one it doesnt give errors, but wont work at all.

pacdiggity

YEM, YERD or YEZ? It seems to work fine with the YEM one. No errors.
Quote from: Pacman on July 18, 2011, 12:54:52 PM
tell us what scripts you're using, post some that would be hard to find, or upload a project with all the scripts you're using.
And above all, tell us what the error is. You don't need another script if it can be fixed.
Please do this.
it's like a metaphor or something i don't know

Mr G W

After testing the script with every other script individually, i have found that its incompatible with the Luck script by modern algebra.

This is the error:

Script weaponElement line 14: NoMethodError occurred.

undefined method 'welemental' for #<RPG::Skill:0x2b5ad60>

Placing it below the luck script fixes the problem, but causes the script to not work...

modern algebra

Are you sure that's an incompatibility and not just an error with this script? I don't see how Luck would interfere and there is definitely no reason that placing it below the Luck script would cause it to bug. The problem seems to me to be that make_obj_damage_value (user, obj) is being aliased and the obj it expects is either a Skill or an Item, but then the script checks the obj.welemental method (which doesn't exist because that method is defined only for Weapons). I think this script would throw that error even by itself; I don't think it's an incompatibility. It is, however, a simple enough fix. Where it says:


class RPG::Weapon < RPG::BaseItem


Change that to:

class RPG::BaseItem

I think the script is still imperfect - maybe I'll write this script for you when I find the time.

Mr G W

#8
Ok, ill try. Well the luck script seems to cause problems and even when i place below it it sometimes gives the error or it just does nothing.

Anyway, changing that makes this error

Script Weaponelement line 17: NameError occurred.

undefined local variable or method 'weapons' for
#<Game_enemy:0xbf9e508>

This script still looks flawed...

modern algebra

This line:
    obj.element_set = weapons[0].element_set


Should be:
    obj.element_set = user.weapons[0].element_set

Mr G W

#10
Its working now! thanks!

If possible, im looking for a script that gets the hitratio from the actor.