Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
marcel.makkink

Is it possible to make attack rely on a stat?

Question

Hey folks,

Came across this line in Game_Battler 3 :

 

      atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     # Element?
     self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100

 

Now I was wondering if this could be modified per class.

As in only the Warrior class needs 'the' Strength, but the Hunter relies on Dexterity, a Mage on Intelligence and a Rogue on Agility.

To make it so each class has it's specific 'Strength Stat'.

 

For example an attacking Hunter, I was thinking of something along the lines of this:

 

      if $game_actors[class_id] == 2
     self.damage = atk * (20 + attacker.dex) / 20
     elsif .. etc

 

But I'm just getting into Ruby again so.. yeah.

 

Any help is appreciated! :)

Edited by marcel.makkink

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Honestly, yes. All you'd have to do is edit this section of the code that you posted from Game_Battler 3, where the formula for damage originates. Set it so there is a case statement, and based upon the class's ID number, that class does damage with a different stat. Granted, if you do this, use an 'else' at the end of the case, otherwise you could get hit with an error if you use a character who doesn't have a class listed in the script.

Share this post


Link to post
Share on other sites
  • 0

Thanks man, for future references I managed to do it like this:

     case attacker.class_id
     when 1
     atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.dex) / 20
     self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100
     else
     atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100
     end

Edited by marcel.makkink

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...