Save-Point
changing stat effects for the defualt batle system? - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: changing stat effects for the defualt batle system? (/thread-12.html)

Pages: 1 2


changing stat effects for the defualt batle system? - corpsegirl - 10-24-2010

I didn't see any better section to ask about this. How do I change the default battle system in the following ways

Evasion (chance to be missed) = Agi + Dex +50
Accuracy (chance to peirce evasion) = Dex + Int
Chance to evade = Target's Evasion - Attacker's Accuracy


changing stat effects for the defualt batle system? - computerwizoo7 - 10-24-2010

You would have to edit this by script, somewhere in the calculation of those >.<

question, why? why would you want to do this?
its not like the player will use one set of armor for the rest of his life...
eg. rookie armor = 1% eva
learned how to write a webpage armor = 5% eva
wizkid divine wind armor ^^ = 100% eva


anyway, u can get the same result without touching those scary lines of code @>@
or search through the forum for a script.


changing stat effects for the defualt batle system? - corpsegirl - 10-24-2010

This makes an evasion system rather than a damage reduction system. It makes stats leveling up function smoother. And there is no 100% evade since attacker accuracy reduces the evade in the formula. its an accuracy score not an accuracy flat percent.


changing stat effects for the defualt batle system? - deValdr - 10-24-2010

Go into the Battler1 script. Here you will find methods for things like evade. Messing around there should be able to achieve what you wanna do.


changing stat effects for the defualt batle system? - corpsegirl - 10-24-2010

I tried looking at it but none of the terms I used seemed to work. I'm not sure how to call the stats an do math to them.

Code:
def hit
    n = 100
    for i in @states
      n *= $data_states[i].hit_rate / 100.0
    end
    return Integer(n)
  end

I think tahts what I need to change. how do I call a stat + a stat? I'm not sure what the line n *= $data_states[i].hit_rate / 100.0 is doing.

maybe I should be lookign in game battler 3 in this section instead?

Code:
#--------------------------------------------------------------------------
  # First hit detection
    hit_result = (rand(100) < attacker.hit)
    # If hit occurs
    if hit_result == true

I need I need hit_result to be
Code:
hit_result ((rand(100)) < (50 + (def stat + def stat) - (att stat + att stat) + element bonus/penalty)
so say both def stats are 10 and both att stats are 5 that total is 60 rand needs to be 60 or less to hit. I'm not sure how to call the stats for the formula.

*From DerVV: I just wrapped your script samples in CODE bbcode.
Thanks. I should have used the,. Sorry for the inconvenience.


changing stat effects for the defualt batle system? - corpsegirl - 10-24-2010

Error on line 90.
Code:
#--------------------------------------------------------------------------
  # * Applying Normal Attack Effects
  #     attacker : battler
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # Clear critical flag
    self.critical = false
    # First hit detection
    hit_result = ((rand(100)) < ((50 + (self.agi + self.dex) - (attacker.dex + attacker.int))
    hit = self.cant_evade? ? 100 : hit
    # If hit occurs
    if hit_result == true
      # Calculate basic damage
      min = [attacker.atk + attacker.str + attacker.int]
      max = [attacker.atk + attacker.str + attacker.str]
      atk = (rand(max - min) + min)
      self.damage = atk
      # Element correction
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # If damage value is strictly positive
      if self.damage > 0
        # Critical correction
        if rand(100) < (attacker.agi + attacker.int)
          self.damage *= (((attacker.str + attacker.int + attacker.agi)/100)+1)
          self.critical = true
        end
        # Guard correction
        if self.guarding?
          self.damage /= 2
        end
      end
    end
    # If hit occurs
    if hit_result == true
      # State Removed by Shock
      remove_states_shock
      # Substract damage from HP
      self.hp -= self.damage
      # State change
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # When missing
    else
      # Set damage to "Miss"
      self.damage = "Miss"
      # Clear critical flag
      self.critical = false
    end
    # End Method
    return true
  end



changing stat effects for the defualt batle system? - computerwizoo7 - 10-24-2010

hmm... u might wanna clearly indicate which line is line 90.
btw, double posting is "bad" and i dont mean good ^^ (kids these days)


changing stat effects for the defualt batle system? - corpsegirl - 10-24-2010

Ah. sorry about the double post. The last line of the code is the line in question.


changing stat effects for the defualt batle system? - deValdr - 10-24-2010

Add another
Code:
end
on the next line.


changing stat effects for the defualt batle system? - DerVVulfman - 10-25-2010

And add
Code:
class Game_Battler
in front as the first line