Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Unarmed Combat Code problems

Save-Point

Full Version: Unarmed Combat Code problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok so I was trying to make an unarmed attack option for a particular character class, #9, and I don't think I addressed them correctly. I based the following modification off of:

$data_actors[11].class_id == 9...

which is to say if 'character #11' is 'class #9' then X.
I swapped out "self" for $data_actors but I'm pretty sure that's a bad Idea, and think "self" might also be used for all the monsters as well. I think I also mis addressed the code.


Code:
if self.class_id == 9
  self.damage = (atk + 1) * (2 + attacker.str) / 2
     else
  self.damage = atk * (20 + attacker.str) / 20
      end

Help?
"self" is the battler *taking* damage.
The one attacking is the "attacker"
also, remember that enemies *dont* have classes.
first you must add an condition to check if the attackers is an actor, the check the attacker class.

Code:
if attacker.is_a?(Game_Actor) and attacker.class_id == 9
  self.damage = (atk + 1) * (2 + attacker.str) / 2
else
  self.damage = atk * (20 + attacker.str) / 20
end