Class-Actor-Skill Hybrid?

Started by shintashi, October 06, 2011, 09:46:57 pm

Previous topic - Next topic

ForeverZer0

Don't us a "return" nested in a loop. Use the word "next" to skip to the next iteration, or "break" if you want to exit the loop. If you are using the method as an iterator (which you're not in that example), you would use the "yield" keyword, not "return".

From what you have posted, it could be a few things, not all of which can be determined by the code. The "return" thing I just mentioned could easily be the cause, but some other things such as what the values of your techniques are and how they initialized.

I mean nothing bad by this, but I want to point out that your coding is very sloppy. Having your code poorly structured can make debugging a nightmare. My best suggestion would be to stop where you are, go back and see how you might structure it a bit better, and implement it. Having done so, you will be surprised how many less problems you have, and how much easier the ones you do get will be to find. I'm not suggesting that you start over, but I see many cases where it would benefit you greatly to subclass something or handle data differently that would make everything much easier to control.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

shintashi

I majored in Religious Studies, and have 0 classes in programming, I can't even tell the difference between sloppy and not. This month has been pretty good for me - I started using indents.

Meanwhile, I got a really weird semifunctional result with this one:


#--------------------------------------------------------------------------
  # * Get Hit Rate
  #--------------------------------------------------------------------------
  def hit
     if self.is_a?(Game_Actor)
       sword_skills = [] # blank array
       if self.techniques.size == 0
         sword_skills << 0
       else
        for m in 0..self.techniques.size
          p self.techniques[2] #prints normal data...3 times?
          a = self.techniques[2].skills
           if a.include?(6)
             sword_skills << self.techniques[2].level
           else
             return
           end
         end
       end
       
     n = 1 + sword_skills.max
    #n = 100
    #p self.techniques #works
    else   
    n = 100
    end
    for i in @states
      n *= $data_states[i].hit_rate / 100.0
    end
    return Integer(n)
  end


What I don't get, is why it prints 3 times when I only have one technique, and why I can't get the for loop to

1. check all techniques for skill number 6,
2. add technique to the sword_skill array
3. get the highest listed skill in sword_skill
4. use that highest skill level as the basis for my "hit"

like say I have $game_actor[2].technique[2].skill[6]... that means my actor has a technique that has "swords" as a skill.
That technique (technique[2]) has a level: $game_actor[2].technique[2].level

shintashi

ok so i took out the for loop.


 #--------------------------------------------------------------------------
 # * Get Hit Rate
 #--------------------------------------------------------------------------
 def hit
    if self.is_a?(Game_Actor)
      sword_skills = []
     
      if self.techniques.size == 0
        sword_skills << 0
      else
       a = self.techniques[2].skills
         if a.include?(6)
           sword_skills << self.techniques[2].level
         else
           return
         end
      end
    n = 1 + sword_skills.max
   else  
     n = 100
   end
   for i in @states
     n *= $data_states[i].hit_rate / 100.0
   end
   return Integer(n)
 end


This script works fine. The only problem is, if my actor has a different technique that also has swords, this script will not detect it.

i need to
first; check all the actor's techniques
second: check each technique for all skills
third: compare all these skills to an integer
four: if that integer is the same, get the technique skill level
five: put the skill level in a temporary array
six: get the highest skill level in the array
seven: use the highest skill level as my "hit" score in battle.


ForeverZer0

I have never taken a programming class myself, and have never been to college, so that is not an excuse to not learn it.
To be quite honest, the sloppiness and disorganization is the problem with your script. No one starts out scripting as a master, I have made some very unorganized scripts myself. That is why I am telling you from experience, you are going to continue to have numerous problems until you look into cleaning it up a bit, plus it would help others understand enough to help you better.

Did you try removing the "return" from the for..end loop before just removing the loop altogether?
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

shintashi

October 23, 2011, 10:12:52 pm #44 Last Edit: October 23, 2011, 10:21:41 pm by shintashi
Quote from: ForeverZer0 on October 23, 2011, 09:20:28 pm
I have never taken a programming class myself, and have never been to college, so that is not an excuse to not learn it.
To be quite honest, the sloppiness and disorganization is the problem with your script. No one starts out scripting as a master, I have made some very unorganized scripts myself. That is why I am telling you from experience, you are going to continue to have numerous problems until you look into cleaning it up a bit, plus it would help others understand enough to help you better.

Did you try removing the "return" from the for..end loop before just removing the loop altogether?


yep


 def hit
    if self.is_a?(Game_Actor)
      sword_skills = []
      for i in 0.. self.techniques.size
        if self.techniques.size == 0
          sword_skills << 0
        else
         a = self.techniques[i].skills
           if a.include?(6)
             sword_skills << self.techniques[i].level
           else
             next
           end
         end
       end


but I get a undefined method 'skills' for niNilClass referring to this:

         a = self.techniques[i].skills


Which I have no idea how to get around.


I'm hoping to turn a working version of this into a method I can apply to any weapon,

i.e, something like:


def weapon_range
weapon = ($data_weapons[@weapon_id] / 4.0)
return weapon.ceil
end
...

when 1
weapon_check(6)
when 2
weapon_check(7)
when 3
weapon_check(7)

...

def weapon_check(num)
if self.is_a?(Game_Actor)
   for i in 0.. self.techniques.size
      a =self.techniques[i].skills
      if a.include?(num)
         weapon_skills <<  self.techniques[i].level
      else
        next
      end
   end
  end
end


ForeverZer0

Your looking in the wrong place. Find where "technique" is created, and find out why it is setting one of them to nil.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

shintashi

October 23, 2011, 10:23:59 pm #46 Last Edit: October 23, 2011, 10:51:42 pm by shintashi
Quote from: ForeverZer0 on October 23, 2011, 10:21:26 pm
Your looking in the wrong place. Find where "technique" is created, and find out why it is setting one of them to nil.


by 'setting one of them' to nil, do you mean techniques or techniques[n].skills? It detects techniques, but I'm having difficulty detecting the skills.

edit: here's the section where skills are added:

Quote
 def initialize(tech_id)
   tech = techniques_data(tech_id)
   @tech_id = tech_id
   @name = tech[0]
   @level = tech[5]              
   @physical = tech[3]                
   @magical = tech[4]
   @description = tech[7]            
   @skills = []
   tech[6].each{|id|
     @skills.push(id)
   }
   @skills.sort!                      

   @multiplier = get_multi
   @exp_list = Array.new(100)
   make_exp_list
   @exp = tech[2]
 end


i have the @actor getting the attack skill here:


$game_actors[2].add_tech(2)


which refers to this in Game_Actor


  def add_tech(tech_id)
    return if @techniques[tech_id] != nil # stops if tech is already possessed
    @techniques[tech_id] = Game_Technique.new(tech_id)
    my_id = tech_id
    weapon_tech(my_id)
  end

ForeverZer0

Juts insert a "p tech[6]" and "p tech[5]" there, and make sure they are okay. If not, look through the "techniques_data" method and see why they are not.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

shintashi

Quote from: ForeverZer0 on October 23, 2011, 10:51:24 pm
Juts insert a "p tech[6]" and "p tech[5]" there, and make sure they are okay. If not, look through the "techniques_data" method and see why they are not.


i get nil and nil, whereas p techniques[0] and p techniques[2], produce nil, and this:

Spoiler: ShowHide




before the next line produces the same undefined method 'skills' for niNilClass


shintashi

I've realized I don't need "self" as part of battler, so I did some reorganizing,


         if @techniques.size == 0
           sword_skills << 0
         else
           for i in 0...@techniques.size
            p @techniques[i]
            a = @techniques[i].skills
            if a.include?(6)
              sword_skills << @techniques[i].level
            else
              next
            end
          end         
        end
 


but I noticed the result is almost identical, and unexplainable.

p @techniques[i]


also produces "nil" which naturally leads to crash on nil.skills. I was about to do something amazing related to picking out what little data I could and then slamming down the the program's throat, as it were, but the whole self/@ thing messed up my train of thought... I'll keep trying though.

shintashi

October 23, 2011, 11:59:41 pm #50 Last Edit: October 24, 2011, 12:04:45 am by shintashi
this appears to have worked, but I'm not sure...


 def hit
    if self.is_a?(Game_Actor)
      sword_skills = []
     
        if @techniques.size == 0
          sword_skills << 0
        else
         for i in 0...@techniques.size
           
            if @techniques[i] == nil
              p "nope"
              next
            else
             p @techniques[i]
             a = @techniques[i].skills
               if a.include?(6)
                 sword_skills << @techniques[i].level
               else
                 next
               end #if include
               
           end #if tech = nil
           
         end #for i in 0
         
       end # if tech size
 
    n = 1 + sword_skills.max
   else  
     n = 100
   end # if is actor
   
   for i in @states
     n *= $data_states[i].hit_rate / 100.0
   end
   return Integer(n)
 end


I will have test it with multiple levels and multiple characters with swords before determining if it's actually functional... unless I've made some kind of obvious error.

edit: tried it with multiple actors, seems to work, but posts "nope" twice before posting techniques. Not sure why it gets two nils first, but it gets them for all actors.

shintashi

Update:

So I broke "Get Hit Rate" into three parts, and for the most part, it works, although if for some reason your actor has a technique (in other words, the technique array isn't blank), and you are for some crazy reason wielding a weapon you don't have a technique for, it crashes where it says  "weapon_skills << @techniques[ i ].level"

Spoiler: ShowHide


  #--------------------------------------------------------------------------
  # * Get Hit Rate I: Weapon Range
  #--------------------------------------------------------------------------
  def weapon_range
    if self.is_a?(Game_Actor)
      weapon = @weapon_id / 4.0
      return weapon.ceil
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate II: Weapon Check
  #--------------------------------------------------------------------------
  def weapon_check(num)
       if self.is_a?(Game_Actor)
       weapon_skills = []
         if @techniques.size == 0
           weapon_skills << 0
           p weapon_skills
         else
          for i in 0...@techniques.size
             if @techniques[i] == nil
               next
             else
              a = @techniques[i].skills
                if a.include?(num)
                  weapon_skills << @techniques[i].level
                  p weapon_skills
                else
                  next
                end #if include
            end #if tech = nil
          end #for i in 0
        end # if tech size
p weapon_skills       
     n = 1 + weapon_skills.max
    else   
      n = 100
    end # if is actor
    #check for states
    for i in @states
      n *= $data_states[i].hit_rate / 100.0
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate III: Hit
  #--------------------------------------------------------------------------
  def hit
    case weapon_range
      when 0 #unarmed - will be revised later
        n = 100 #default for monsters for now... add when -1 or something later
      when 1 #swords (lists like this one will be expanded)
        weapon_check(6)
      when 2 #spears
        weapon_check(7)
      when 3 #axes
        weapon_check(8)
      when 4 #knives
        weapon_check(9)
      when 5 #bows
        weapon_check(10)
      when 6 #guns
        weapon_check(11)
      when 7 #maces
        weapon_check(12)
      when 8 #rods (canes, staves etc.)
        weapon_check(13)
      when 9 #asian blades (katana, wakazashi, zatoichi, shikomezui)
        weapon_check(14)
      when 10 #mecha blades
        weapon_check(15)
      end
    end




I think I can fix that, but it will have to wait till the morning.

KK20

October 24, 2011, 03:14:53 am #52 Last Edit: October 24, 2011, 03:28:59 am by KK20
$game_actors[1].add_tech(0) #=> Aluxes gets technique with ID 0 (last time I checked, this was Endurance).
p $game_actors[1].techniques #=> DOES NOT DISPLAY an array with 0 in it. It will print out the whole technique array you have set up in Game_Technique.
'for index in 0.. @techniques.size' followed with '@techniques[index]' will be wrong. The way I have set up @techniques in Game_Actors is that the index value of the technique is located at the index value within @techniques. So if you added techniques 0, 1, and 5, '@techniques.size = 3'. @techniques[0] and @techniques[1] exist. But what the hell would @techniques[2] be? @techniques[2] is nil.

Use @techniques.each{|tech| #CODE HERE# } instead.

Edit: Upon further realization, if there is a gap between tech IDs, 'each' still runs through them. Nothing like a 'next if tech.nil?' can't fix.
Further Edit: Okay, so @techniques.size would include the nils as well...forget everything I said. Just use what I said directly above ^^^^.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

shintashi

Quote from: KK20 on October 24, 2011, 03:14:53 am
$game_actors[1].add_tech(0) #=> Aluxes gets technique with ID 0 (last time I checked, this was Endurance).
p $game_actors[1].techniques #=> DOES NOT DISPLAY an array with 0 in it. It will print out the whole technique array you have set up in Game_Technique.
'for index in 0.. @techniques.size' followed with '@techniques[index]' will be wrong. The way I have set up @techniques in Game_Actors is that the index value of the technique is located at the index value within @techniques. So if you added techniques 0, 1, and 5, '@techniques.size = 3'. @techniques[0] and @techniques[1] exist. But what the hell would @techniques[2] be? @techniques[2] is nil.

Use @techniques.each{|tech| #CODE HERE# } instead.

Edit: Upon further realization, if there is a gap between tech IDs, 'each' still runs through them. Nothing like a 'next if tech.nil?' can't fix.
Further Edit: Okay, so @techniques.size would include the nils as well...forget everything I said. Just use what I said directly above ^^^^.


That would explain it actually. Since we created stock techniques as a starting framework for "beginners", they would be assigning id numbers like 2 or 6 to their first techniques. Endurance is definitely tech 0, since it's going to be the "get more hit points" technique.

here's the stock list so far:


when 0 then return ["Endurance", 1, 0, true, false, 0, [1], "Hit Point Bonus"]
    when 1 then return ["Dodge", 1, 0, true, false, 0, [3], "Avoid Attack"]
    when 2 then return ["Swords", 1, 0, true, false, 0, [6], "Use Swords"]
    when 3 then return ["Willpower", 1, 0, false, true, 0, [2], "Spell Point Bonus"]
    when 4 then return ["White Magic", 1, 0, false, true, 0, [35,36,37], "Protection and Healing"]
    when 5 then return ["Black Magic", 1, 0, false, true, 0, [38,39,40], "War and Death"]
    when 6 then return ["Stealth", 1, 0, true, false, 0, [32], "Avoid Detection"]
    when 7 then return ["Perception", 1, 0, false, true, 0, [30], "Percieve Reality"]
    when 8 then return ["Guns", 1, 0, true, false, 0, [11], "Use Guns"]
    when 9 then return ["Block", 1, 0, true, false, 0, [13], "Block Attacks Unarmed"]
    when 10 then return ["Parry", 1, 0, true, false, 0, [14], "Block Attacks With Weapon"] 


numbers may change later, but for now the goal is get at least ONE tech to do something. Two questions:
first question:
how does next if tech.nil? differ from


if @techniques[i] == nil
               next


second question:
if we used that copy class weapons thing for actors like Aluxes,


    @weapon_set = $data_classes[@class_id].weapon_set.clone


how can we "auto fill" some techniques, so when the battler says "hey you can use this weapon... but uh... you don't have a technique for it.. here ya go... you get tech[6 or whatever] at level 0... happy hunting"

shintashi

October 24, 2011, 02:07:32 pm #54 Last Edit: October 24, 2011, 02:33:04 pm by shintashi
here's something I came up with called the grandfather clause:


 #--------------------------------------------------------------------------
 # * Get Hit Rate IV: Grandfather Clause - adds techs for weapons you have
 #--------------------------------------------------------------------------
 def grandfather_tech
   case @grandfather
     when 0 #unarmed - will be revised later
       next
     when 6 #swords
       #$game_actors[2].add_tech(0)
       #self.add_tech(0)
       add_tech(2)
     when 7 #spears
       add_tech(11)
     when 8 #axes
       add_tech(12)
     when 9 #knives
       add_tech(13)
     when 10 #bows
       add_tech(14)
     when 11 #guns
       add_tech(8)
     when 12 #maces
       add_tech(15)
     when 13 #rods
       add_tech(16)
     when 14 #asian blades
       add_tech(17)
     when 36 #mecha blades
       add_tech(18)
     end
   end



I don't know if it works yet, because I'm still deciding on which line to implement it in, but basically, when you are checking to see if player has "tech" related to their existing wielded weapons, if no technique comes up, you get an adjoining technique with levels. This is tweaky because at some point someone's going to make a kensai who can only wield one kind of weapon, and that should only be worth like 0.2 to their skill multiplier.

I was thinking of on the fly skill allocation, or a dumping bucket. All said, I don't want 40+ "skills" dedicated just to weapon proficiencies. Maybe I can make an "exotic" or "specialist" skill that's worth some points, but I don't see how I'm going to get around the "now everyone with specialist has access to that weapon".

Edit: Wait,

what if I ninja it by creating a special skill that has access to all skills, but not really? like a skill the program checks for to see if you have a 'special' weapon, or special weapons, and then if you have a technique with the "special weapon" skill, it includes that as a viable option for whatever weapon you have, and gets it's level from the technique with "special weapon' skill.

This works perfectly as long as a character only has one special weapon, but I think an array option for the technique has to be checked to see which special weapon it is.

This way, the computer would first check to see if you had a generic stock skill that matched in one of your techniques, plus the special weapon category. if the special weapon category existed, it would then check THAT skills @special category - probably a short list of array options for addenum, just like this. Much like "level" the number would be unique to the @actor with THAT technique,

thus, if Aluxes is game actor 1, "special" is skill #42 (life, universe, and everything, etc.) and "Blademaster" is a technique[21], we might have
$game_actor.techniques[21].level
$game_actor.techniques[21].skills[42]
$game_actor.techniques[21].addendum[nil,nil,2]

with the third slot of "addendum" being which weapon in the $data_weapons list to check against, and if that's the same as the weapon they are wielding - then blamo, add $game_actor.techniques[21].level to the weapon_skills array for determining hit bonus.  :???: 

KK20

There is no difference. It's a matter of one line of code versus two. '== nil' is the same as '.nil?'.

For that, you will have to make another method to check that. Get the class's useable weapons, run through all the possible techniques you have that have the skill required to use that weapon, then use that technique's ID in method 'add_tech'. It's probably best that this new method is called in two spots: when the actor is initialized (aka under def setup) and rewriting or aliasing class change.

Since you posted something while I was typing this up, what you have there seems to work, assuming that you don't want this script to be easily customizable. And the use of 'next' only applies to loops. If you want 'case 0' to do nothing, you don't have to write anything.

And you lost me with all of your explanation stuff below.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

shintashi

it appears to work:

start to finish it looks like this:

Spoiler: ShowHide


#--------------------------------------------------------------------------
  # * Get Hit Rate I: Weapon Range
  #--------------------------------------------------------------------------
  def weapon_range
    if self.is_a?(Game_Actor)
      weapon = @weapon_id / 4.0
      return weapon.ceil
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate II: Weapon Check
  #--------------------------------------------------------------------------
  def weapon_check(num)
       if self.is_a?(Game_Actor)
       weapon_skills = []
       @grandfather = num
         if @techniques.size == 0
           weapon_skills << 0
         else
          for i in 0...@techniques.size
             if @techniques[i] == nil
               next
             else
              a = @techniques[i].skills
                if a.include?(num)
                  weapon_skills << @techniques[i].level
                  p weapon_skills
                else
                  grandfather_tech
                  weapon_skills << @techniques[i].level
                  next
                end #if include
            end #if tech = nil
          end #for i in 0
        end # if tech size
     n = 10 + weapon_skills.max #change to other number later
    else   
      n = 100
    end # if is actor
    #check for states
    for i in @states
      n *= $data_states[i].hit_rate / 100.0
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate III: Hit
  #--------------------------------------------------------------------------
  def hit
    case weapon_range
      when 0 #unarmed - will be revised later
        n = 100 #default for monsters for now... add when -1 or something later
      when 1 #swords (lists like this one will be expanded)
        weapon_check(6)
      when 2 #spears
        weapon_check(7)
      when 3 #axes
        weapon_check(8)
      when 4 #knives
        weapon_check(9)
      when 5 #bows
        weapon_check(10)
      when 6 #guns
        weapon_check(11)
      when 7 #maces
        weapon_check(12)
      when 8 #rods (canes, staves etc.)
        weapon_check(13)
      when 9 #asian blades (katana, wakazashi, zatoichi, shikomezui)
        weapon_check(14)
      when 10 #mecha blades
        weapon_check(36)
      end
    end
  #--------------------------------------------------------------------------
  # * Get Hit Rate IV: Grandfather Clause - adds techs for weapons you have
  #--------------------------------------------------------------------------
  def grandfather_tech
    case @grandfather
      when 0 #unarmed - will be revised later
        next #may crash
      when 6 #swords
        #$game_actors[2].add_tech(0)
        #self.add_tech(0)
        add_tech(2)
      when 7 #spears
        add_tech(11)
      when 8 #axes
        add_tech(12)
      when 9 #knives
        add_tech(13)
      when 10 #bows
        add_tech(14)
      when 11 #guns
        add_tech(8)
      when 12 #maces
        add_tech(15)
      when 13 #rods
        add_tech(16)
      when 14 #asian blades
        add_tech(17)
      when 36 #mecha blades
        add_tech(18)
      end
    end





I'll come back to this @addendum and specialist stuff later - I have a feeling it will be useful when setting up the level ranges for martial arts and spell acquisition (i.e. how to stop a level 1 character from summoning Bahamut). For now, I need to integrate "dodge" and "hit" together with the Strategy bar in battle.

shintashi

So I've integrated Dodge and Hit together, with the strategy bar system also built into it:


in Game_Battler 1
Spoiler: ShowHide


#--------------------------------------------------------------------------
  # * Get Base Dodge
  #--------------------------------------------------------------------------
  def dodge_check
       if self.is_a?(Game_Actor)
       dodge_skills = []
         if @techniques.size == 0
           dodge_skills << 0
         else
          for i in 0...@techniques.size
             if @techniques[i] == nil
               next
             else
              a = @techniques[i].skills
                if a.include?(3)
                  dodge_skills << @techniques[i].level
                else
                  dodge_skills << 0
                  next
                end #if include
            end #if tech = nil
          end #for i in 0
        end # if tech size
     player_dodge = 0 + dodge_skills.max
     if player_dodge < self.agi
      b_dodge = self.agi - player_dodge
      n = player_dodge + Integer(b_dodge / 3)
    else
      n = player_dodge # dodge higher than agility?
    end
  else   
      n = Integer(self.agi / 3)
    end # if is actor
    return Integer(n)
  end





and in Game_Battler 3
Spoiler: ShowHide


  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects
  #     attacker.hit : battler vs. self.dodge_check
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # Clear critical flag
    self.critical = false
    # First hit detection: high finesse (dodge) vs. low uke (hit)
    if attacker.is_a?(Game_Actor)
       if attacker.hit > self.dodge_check
        bonus_dodge = attacker.hit - self.dodge_check
        dynamic_bonus = bonus_dodge + 10 #enemies don't have strat_bars (+agg)
        dynamic_dodge = self.dodge_check + rand(dynamic_bonus)
        static_hit = attacker.hit - attacker.uke
        hit_result = (dynamic_dodge < static_hit)
      else
        bonus_hit = self.dodge_check - attacker.hit
        dynamic_bonus = bonus_hit - attacker.uke + 10
        dynamic_hit = attacker.hit + rand(dynamic_bonus)
        hit_result = (self.dodge_check < dynamic_hit)
      end
    else
      if attacker.hit > self.dodge_check
        bonus_dodge = attacker.hit - self.dodge_check
        dynamic_bonus = bonus_dodge + self.agg + 10
        dynamic_dodge = self.dodge_check + rand(dynamic_bonus)
        hit_result = (dynamic_dodge < attacker.hit)
      else
        bonus_hit = self.dodge_check - attacker.hit
        dynamic_bonus = bonus_hit + 10 #enemies don't hav strat_bars (-uke)
        dynamic_hit = attacker.hit + rand(dynamic_bonus)
        hit_result = (self.dodge_check < dynamic_hit)
      end
    end
    # If hit occurs
    if hit_result == true
      # Calculate basic damage



right now it favors the actors who use strategy and favors creatures with high stats because they can default a stat at 1/3rd for their dodge skill. I'm still integrating other parts of the strategy bar, after which, I think I'll tackle hit points, then spell points (which should be a clone of hit point script), and then @addendum

which will probably be something like
@addendum = [[spell_order], [martial_order], specialist, nil, nil, nil,...]

since so far i've only confirmed unique weapons, spell levels, and martial arts levels.

shintashi

I've integrated critical hit and strategy bars together, and got a nice clean 2000+ damage when critical hit was level 94. I'm using a multi-technique script, that for now works with one attribute,

Spoiler: ShowHide


  #--------------------------------------------------------------------------
  # * Get Base Critical/other Int based Techniques
  #--------------------------------------------------------------------------
  # critical = int_check(34); perception = int_check(??)
  def int_check(num)
       if self.is_a?(Game_Actor)
       int_skills = []
         if @techniques.size == 0
           int_skills << 0
         else
          for i in 0...@techniques.size
             if @techniques[i] == nil
               next
             else
              a = @techniques[i].skills
                if a.include?(num) #replace with 34 to make "critical"
                  int_skills << @techniques[i].level
                else
                  int_skills << 0
                  next
                end #if include
            end #if tech = nil
          end #for i in 0
        end # if tech size
        player_int = 0 + int_skills.max
        if player_int < self.int
          b_int = self.int - player_int
          n = player_int + Integer(b_int / 3)
        else
          n = player_int # example: critical higher than intellect?
        end
      else
      n = Integer(self.int / 3) #10 intellect is average, 3% critical
    end # if is actor
    return Integer(n)
  end




This is in conjunction with this in part 3 of battler:

Spoiler: ShowHide


# Calculate critical damage *Plus Timing*
      if self.damage > 0
        critical_hit = attacker.int_check(34)
        if attacker.is_a?(Game_Actor)
          if rand(100) < (critical_hit + attacker.spd)
            self.damage *= (1 + Integer(critical_hit / 10))
            self.critical = true
          end
        else
          if rand(100) < critical_hit #vs. danger sense/solo/precog.?
            self.damage *= (1 + Integer(critical_hit /10))
            self.critical = true
          end
        end
          # Guard correction #replace this with parry or "defend other" options
        if self.guarding?
          self.damage /= 2
        end
      end



I've also started messing around with "size" as in sprites vs. dragons or giant robots. At first I was going to rewrite hit points so @actor.stamina X @actor.endurance = hit points, but I realized the actors have no stamina, which puts us at @actor.str x @actor.endurance, but then I realized monsters have no endurance, so my dilemma looks like this:

@actor.sta x @actor.end = hp
@enemy.sta x @enemy.end = hp

@actor.??? x @actor.end = hp
@enemy.??? x @enemy.??? = hp


of course, I can just assign monsters hit points, and use physical defense and magical defense and strength as the defaults for Stamina, but that seems oddly more quirky than assigning them a single new attribute to handle all of those factors.

I figure by taking the target's base strength and giving them a "size", they can have stamina that won't directly correlate 1:1.