RPG Maker Forums

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!

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,836
Latest member
T62352536256t362
Top