In Window_Base, I have created a definition called 'draw_actor_resistance.'
For now, its sole purpose is to display the value of the character's resistance to a certain element, based on the table in Game_Actor:
But it's not working. Here is the error I get.
Here is the script I am currently working in Window_Base, where the error occurs:
Here is the part of class Game_Actor where I get ".element_rate" from:
If my method is undefined, how will I define the actor's rate of elemental resistance based on the table in Game_Actor? If this doesn't make sense, I will try to clarify my problem further. Thank you in advance.
For now, its sole purpose is to display the value of the character's resistance to a certain element, based on the table in Game_Actor:
Code:
table = [0,200,150,100,50,0,-100]
But it's not working. Here is the error I get.
Code:
Script 'Window_Base' line 333: NoMethodError occured.
undefined method 'element_rate' for nil:NilClass
Here is the script I am currently working in Window_Base, where the error occurs:
Code:
def draw_actor_resistance(actor, x, y, element)
case element
when 0
element_resist = $game_actor.element_rate(0)
end
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 36, 32, element_resist.to_s, 2)
end
Here is the part of class Game_Actor where I get ".element_rate" from:
Code:
#-------------------------------------------------------------------------
# * Get Element Revision Value
# element_id : element ID
#-----------------------------------------------------------------------
def element_rate(element_id)
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# If this element is protected by armor, then it's reduced by half
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# If this element is protected by states, then it's reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
If my method is undefined, how will I define the actor's rate of elemental resistance based on the table in Game_Actor? If this doesn't make sense, I will try to clarify my problem further. Thank you in advance.