I know this is a pretty rudimentary scripting question, but I'm quite new to scripting and spent all morning trying to find an answer. My situation is this:
I have changed the TP gain upon hitpoint loss to only work for a certain class by scraping together the following code:
#-------------------------------------------------------------------------- # * Charge TP by Damage Suffered #-------------------------------------------------------------------------- def charge_tp_by_damage(damage_rate) if self.class_id == 3 self.tp += 50 * damage_rate * tcr else self.tp += 0 * damage_rate * tcr end endThis does its job well enough when the player gets hit, but the game crashes when I attack the enemy with this message: "undefined method 'class_id' for Game_Enemy"
I understand the logic well enough to know that the script needs to know what to do in the case of a target with no class suffering damage, but I don't know what language to use to do so. I'm sure this is on the forum somewhere, but all I could find in my search was information about giving monsters classes, which (presumably) would work, but isn't exactly what I'm looking for.
Help on this would be greatly appreciated. Thank you!