The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Mr G W on July 17, 2011, 07:51:40 PM

Title: Skill uses elements/hitratio from weapon
Post by: Mr G W on July 17, 2011, 07:51:40 PM
Is there any script that does this? I remember seeing one around, but i cant seem to find it anywhere...
Title: Re: Skill uses elements from weapon
Post by: doomed2die on July 17, 2011, 09:45:42 PM
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
Title: Re: Skill uses elements from weapon
Post by: Mr G W on July 18, 2011, 09:53:47 AM
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?
Title: Re: Skill uses elements/hitratio from weapon
Post by: pacdiggity on July 18, 2011, 12:54:52 PM
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.
Title: Re: Skill uses elements/hitratio from weapon
Post by: Mr G W on July 18, 2011, 01:33:22 PM
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.
Title: Re: Skill uses elements/hitratio from weapon
Post by: pacdiggity on July 19, 2011, 11:37:06 AM
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.
Title: Re: Skill uses elements/hitratio from weapon
Post by: Mr G W on July 21, 2011, 04:19:25 PM
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...
Title: Re: Skill uses elements/hitratio from weapon
Post by: modern algebra on July 21, 2011, 04:44:57 PM
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.
Title: Re: Skill uses elements/hitratio from weapon
Post by: Mr G W on July 21, 2011, 05:05:27 PM
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...
Title: Re: Skill uses elements/hitratio from weapon
Post by: modern algebra on July 21, 2011, 05:32:21 PM
This line:
    obj.element_set = weapons[0].element_set


Should be:
    obj.element_set = user.weapons[0].element_set
Title: Re: Skill uses elements/hitratio from weapon
Post by: Mr G W on July 21, 2011, 06:00:10 PM
Its working now! thanks!

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