Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Ally AI - Computer Controlled Allies V2.0

Status
Not open for further replies.
Ally AI - Computer Controlled Allies
Version: 2.0 [Beta]


Introduction

This is a fairly advanced script that allows some of the party members in battle to be controlled by an algorithm I made up. The system may still have a few hiccups. The algorithm is setup up to ten different variables aggressiveness, magic_casting, item_using, supportive, defensiveness, intelligence, cautiousness, laziness, cowardice, and strategist. The script also comes with an implementation AutoBattle command which just runs the algorithm and chooses the action for you

Screenshots
http://trickster.wg2140.com/images/Ally%20AI.PNG[/img]

Demo

http://www.rmxp.org/forums/downloads.php?do=file&id=812


Instructions
See Setup Section everything is explained there.

Note this: Some of the variables are not meant to be set to 20 (cautiousness for one)

FAQ


Compatibility

May be incompatible with your battle system

SDK 2.x compliant

Battle Addons Like Overdrive Systems and Skill Effects will not be taken into consideration in the formula

Credits and Thanks

BlueScope for betatesting
 
Lol even after some hours the rmxp.org is back, here comes Trickster/SS again with another amazing script... ^^ Looks nice, although i haven´t tried the demo. It reminds me on a feature on RM2k3 (i guess), where some characters can´t be controlled by the player.

Nice, simply nice. Just let a lazy person to download the demo, check it and post something more constructive ^^
 
GASP!
The script also comes with an AutoBattle command which just runs the algorithm and chooses the action for you.
Oh... now Lord KNOWS that people have been wondering if an AutoBattle feature would ever be written!

With all the routines written... think we'll soon have the ultimate Strategic Battle system?
 
And eventually a fully working Tactical Battle System!

Oh, this is great for making a battle just like in FF7 when Cloud and Seph were in SOLDIER!

Great script!
 
Linkin_T;106517":8pu2z7bc said:
Lol even after some hours the rmxp.org is back, here comes Trickster/SS again with another amazing script... ^^ Looks nice, although i haven´t tried the demo. It reminds me on a feature on RM2k3 (i guess), where some characters can´t be controlled by the player.

Nice, simply nice. Just let a lazy person to download the demo, check it and post something more constructive ^^

Yes, and thanks

DerVVulfman;106624":8pu2z7bc said:
GASP!Oh... now Lord KNOWS that people have been wondering if an AutoBattle feature would ever be written!

With all the routines written... think we'll soon have the ultimate Strategic Battle system?

Well Seph has been working on one as well, I can't wait until Seph finishes his version

~Atlaswing~;106625":8pu2z7bc said:
And eventually a fully working Tactical Battle System!

Oh, this is great for making a battle just like in FF7 when Cloud and Seph were in SOLDIER!

Great script!

Thanks, but how can you say "Great script!" when this isn't even finished :P

Well I posted the script, for comments and open betatesting I would really appreciate the comments/suggestions, but if you don't want to I understand :)
 

creiz

Member

Tested. and works very well. it does really makes a difference if you edit the setup for characters. at least for me. maybe someday we'll have an in-game menu for people who play the game edit their chars?
 
@Trickster: I bet I told you more than I can now remember already XD But for the record: Nice script, I'll see if I'll use it... ^_^
(Sidenote: Yay, I'm actually credited somewhere! :D )

creiz;106665 said:
Tested. and works very well. it does really makes a difference if you edit the setup for characters. at least for me. maybe someday we'll have an in-game menu for people who play the game edit their chars?
The way the actions are chosen, it's obvious that you won't notice every single change you do... there actually IS a change, though, if you record the actions taken... (I don't think Ruby makes up own codes after the game has been started XD )

@Linkin_T: I spent about an hour to testplay this and was of 1% help, so apprechiate it and download this :P
 
BlueScope;106780 said:
@Trickster: I bet I told you more than I can now remember already XD But for the record: Nice script, I'll see if I'll use it... ^_^
(Sidenote: Yay, I'm actually credited somewhere! :D )

The way the actions are chosen, it's obvious that you won't notice every single change you do... there actually IS a change, though, if you record the actions taken... (I don't think Ruby makes up own codes after the game has been started XD )

@Linkin_T: I spent about an hour to testplay this and was of 1% help, so apprechiate it and download this :P

Thanks

creiz":3nk4no35 said:
maybe someday we'll have an in-game menu for people who play the game edit their chars?

I am planning on adding an menu so it can be changed
 

creiz

Member

BlueScope;106780 said:
The way the actions are chosen, it's obvious that you won't notice every single change you do... there actually IS a change, though, if you record the actions taken... (I don't think Ruby makes up own codes after the game has been started XD )

that's exactly what I said, homie. I don't generally make grammatical errors, at least not for the does/doesn't. lol, it understandable, sometimes the brain see something that it isn't.

And by the way, the changes are perceptible. I set one of my chars to 15 cowardice, and he defended like there's nothing else.

I set it to 0 and he went all-out like a madman who thinks there's no tomorrow.

again, great job.

The only thing i may complain(of course, eh?) is the lack of RTAB support. scripts like these should be universal since it's primary need (heh).
 
creiz;107270":2f8n2itu said:
that's exactly what I said, homie. I don't generally make grammatical errors, at least not for the does/doesn't. lol, it understandable, sometimes the brain see something that it isn't.

And by the way, the changes are perceptible. I set one of my chars to 15 cowardice, and he defended like there's nothing else.

I set it to 0 and he went all-out like a madman who thinks there's no tomorrow.

again, great job.

Thanks

creiz;107270":2f8n2itu said:
The only thing i may complain(of course, eh?) is the lack of RTAB support. scripts like these should be universal since it's primary need (heh).

No, Just No. Please take your compliants to the Script Requests section. (Let's keep RTAB out of this topic please... kthx)
 
What you should do is to make an edit like for example in your demo one of your partners uses an item to give you a barrier and could you make it so when all of your allies have barrier that partner doesn't use it anymore and another thing could you make a type of ai that a certian actor can even attack your party with a type of skill or effect like berserk or transform into something berserked. These could be good things to be done on your script and maybe a function to make the auto battle in your commands not show by simply make in your script if you want it type true or else false. Thanks if you do these edits i'm going to use it and good work!
 
Trickster":1j91jqa9 said:
Thanks
...
Thanks
...
Thanks
...
Thanks
...
Trickster is so categoric... xD

I downloaded it and spent some hour testing the demo. No bugs or errors at all, except that it´s a bit annoying the fact that the characters uses more items than skills. In 5 rounds they spend 4 just using items, and most of them are pointless lol... Maybe it´s just me but it´s something i noticed.

Other than that the script is working well.
 
Reaper*;107327 said:
What you should do is to make an edit like for example in your demo one of your partners uses an item to give you a barrier and could you make it so when all of your allies have barrier that partner doesn't use it anymore and another thing could you make a type of ai that a certian actor can even attack your party with a type of skill or effect like berserk or transform into something berserked. These could be good things to be done on your script and maybe a function to make the auto battle in your commands not show by simply make in your script if you want it type true or else false. Thanks if you do these edits i'm going to use it and good work!

Your paragraph is kind of hard for me to read and comprehend, could you use proper grammar and sentence structure or just rephrase all of that for me, Thanks

Linkin_T;107544 said:
Trickster is so categoric... xD

I downloaded it and spent some hour testing the demo. No bugs or errors at all, except that it´s a bit annoying the fact that the characters uses more items than skills. In 5 rounds they spend 4 just using items, and most of them are pointless lol... Maybe it´s just me but it´s something i noticed.

Other than that the script is working well.

Yeah thanks for mocking me (Oh no I said thanks again XD)

Well you could either decrease the value of item_using or increase the value of skill_casting, but well here is a quick summay of whcih skill/item they use

There are five types
-----------------------------------
offensive -- Attack Skills, and Items
supportive -- Supportive and/or Passive Effects
healing -- Healing Hp/Sp or Curing States
status -- Gives Bad States
strategic -- What works best

The Base Values are as follows
----------------------------------
offensiveness is just aggressiveness
supportive is just supportiveness
healing is just cautiousness
status is the average of strategist, supportive, and aggressiveness
strategic is the average of strategist and intelligence


What Influences the base values
------------------------------------------
offensive -
Skills: Just having offensive skills
Items: Just having offensive items
supportive -
Skills: Turn 1, Skills having state which guards against any element the enemy can use
Items: Turn 1, Item having state which guards against any element the enemy can use
healing -
Skills: Critical Party, Hp Under A Certain Percent, Having Healing Skills
Items: Critical Party, Hp Under A Certain Percent, Having Healing Items
status -
Skills: Having Skills with states that are effective (Percent)
Items: Having Items with states that are effective (Percent)
strategic -
Skills: Having Skills that are effective against the enemy
Items: Having Items that are effective against the enemy

while doing these calculations if they doing have any of that type then obviously they can't do that type of action and therefore it will set the value for that action to 0 (not used)
 
1-You should make an edit in your script so when all your party members have barrier on them the player/s with the ai stop using it.

2-Can you make a type of ai that can attack your allies too like when they have state like berserk or tramsform into a monster berserked like in breath of fire 3 rei transforms into a were tiger and can attack your party members too.

3-Can you make an edit in your script so if you want the autobattle in your commands leave it true else false.

Are like that better?
 
~Atlaswing~;106625 said:
And eventually a fully working Tactical Battle System!

Oh, this is great for making a battle just like in FF7 when Cloud and Seph were in SOLDIER!

Great script!

MY EYES!!! THE SPOILERS!!!

{yes I haven't completed FF7 yet}

Anywho the script is very nice an auto battle is something that can be very useful with certain characters.

~UY~
 

fuso

Member

Could you post the source or at least the relevant parts or a possibly informal explanation of the details of the algorithm?
 
Sure Do note that this is jsut the first version

Code:
class Game_AllyAI
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    @actor = actor
    clear
  end
  #--------------------------------------------------------------------------
  # * Attack Action Value
  #--------------------------------------------------------------------------
  def attack_action
    return @aggressiveness
  end
  #--------------------------------------------------------------------------
  # * Magic Action Value
  #--------------------------------------------------------------------------
  def magic_action
    return @actor.skills == 0 ? 0 : @magic_casting
  end
  #--------------------------------------------------------------------------
  # * Item Action Value
  #--------------------------------------------------------------------------
  def item_action
    return @item_using
  end
  #--------------------------------------------------------------------------
  # * Defend Action Value
  #--------------------------------------------------------------------------
  def defend_action
    return @defensiveness
  end
  #--------------------------------------------------------------------------
  # * Wait Action Value
  #--------------------------------------------------------------------------
  def wait_action
    return (@laziness + @cowardice) / 2
  end
  #--------------------------------------------------------------------------
  # * Attacking Intelligence Value
  #--------------------------------------------------------------------------
  def attack_intelligence
    int = (1.5 * @intelligence + 1.5 * @strategist - @aggressiveness).to_i
    return [int, 50].min
  end
  #--------------------------------------------------------------------------
  # * Magic Offense Value
  #--------------------------------------------------------------------------
  def magic_offense
    return @aggressiveness
  end
  #--------------------------------------------------------------------------
  # * Magic Support Value
  #--------------------------------------------------------------------------
  def magic_support  
    return @supportive
  end
  #--------------------------------------------------------------------------
  # * Magic Healing Value
  #--------------------------------------------------------------------------
  def magic_healing
    return @cautiousness
  end
  #--------------------------------------------------------------------------
  # * Magic Status Value
  #--------------------------------------------------------------------------
  def magic_status
    return (@strategist + @supportive + @aggressiveness) / 3
  end
  #--------------------------------------------------------------------------
  # * Magic Strategy Value
  #--------------------------------------------------------------------------
  def magic_strategy
    return (@strategist + @intelligence) / 2
  end
  #--------------------------------------------------------------------------
  # * Magic Heal Percentage
  #--------------------------------------------------------------------------
  def magic_heal_percent
    return ((@supportive / 2 + @cautiousness)/1.5 * 5).to_i
  end
  #--------------------------------------------------------------------------
  # * Magic Heal Multiplier
  #--------------------------------------------------------------------------
  def magic_heal_multiplier
    return (@supportive/2.5 + @cautiousness/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Magic Strategy Effective Rate
  #--------------------------------------------------------------------------
  def magic_strategy_effective
    return (2 * @strategist + 3 * @intelligence) / 20
  end
  #--------------------------------------------------------------------------
  # * Magic Status Multiplier
  #--------------------------------------------------------------------------
  def magic_status_multiplier
    return (@strategist/2.5 + @supportive/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Magic Strategy Multiplier
  #--------------------------------------------------------------------------
  def magic_strategy_multiplier
    return (@strategist/2.5 + @intelligence/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Item Offense Value
  #--------------------------------------------------------------------------
  def item_offense
    return 5 * @aggressiveness / 8 + @intelligence / 8 + @strategist / 4
  end
  #--------------------------------------------------------------------------
  # * Item Support Value
  #--------------------------------------------------------------------------
  def item_support  
    return 5 * @supportive / 8 + 3 * @intelligence / 8
  end
  #--------------------------------------------------------------------------
  # * Item Healing Value
  #--------------------------------------------------------------------------
  def item_healing
    return 5 * @cautiousness / 8 + @intelligence / 8 + @strategist / 4
  end
  #--------------------------------------------------------------------------
  # * Item Status Value
  #--------------------------------------------------------------------------
  def item_status
    return (@strategist + @supportive + @intelligence) / 3
  end
  #--------------------------------------------------------------------------
  # * Item Strategy Value
  #--------------------------------------------------------------------------
  def item_strategy
    return (@strategist + @intelligence) / 2
  end
  #--------------------------------------------------------------------------
  # * Item Heal Percentage
  #--------------------------------------------------------------------------
  def item_heal_percent
    return ((@supportive / 2 + @cautiousness)/1.5 * 5).to_i
  end
  #--------------------------------------------------------------------------
  # * Item Heal Multiplier
  #--------------------------------------------------------------------------
  def item_heal_multiplier
    return (@supportive/2.5 + @cautiousness/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Item Strategy Effective Rate
  #--------------------------------------------------------------------------
  def item_strategy_effective
    return (3 * @strategist + 2 * @intelligence) / 20
  end
  #--------------------------------------------------------------------------
  # * Item Status Multiplier
  #--------------------------------------------------------------------------
  def item_status_multiplier
    return (@strategist/2.5 + @supportive/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Item Strategy Multiplier
  #--------------------------------------------------------------------------
  def item_strategy_multiplier
    return (@strategist/2.5 + @intelligence/1.875).to_i + 1
  end
  #--------------------------------------------------------------------------
  # * Clear
  #--------------------------------------------------------------------------
  def clear
    @aggressiveness   = @actor.aggressiveness
    @magic_casting    = @actor.magic_casting
    @item_using       = @actor.item_using
    @supportive       = @actor.supportive
    @defensiveness    = @actor.defensiveness
    @intelligence     = @actor.intelligence
    @cautiousness     = @actor.cautiousness
    @laziness         = @actor.laziness
    @cowardice        = @actor.cowardice
    @strategist       = @actor.strategist
    @action_attack    = attack_action
    @action_magic     = magic_action
    @action_item      = item_action
    @action_defend    = defend_action
    @action_wait      = wait_action
    @magic_attack     = 0
    @magic_support    = 0
    @magic_heal       = 0
    @magic_status     = 0
    @magic_strategist = 0
    @item_attack      = 0
    @item_support     = 0
    @item_heal        = 0
    @item_status      = 0
    @item_strategist  = 0
    # Initialize Useable Skill Array
    @useable = []
  end
  #--------------------------------------------------------------------------
  # * Make Action
  #--------------------------------------------------------------------------
  def make_action
    # Clear All Instance Variables
    clear
    # Initialize Actions Array
    actions = []
    # Attack Influences
    attack_influences
    # Magic Influences
    magic_influences
    # Item Influences
    item_influences
    # Defend Influences
    defend_influences
    # Wait Influences
    wait_influences
    # Push Action Numbers onto actions array
    @action_attack.times { actions << 0 }
    @action_magic.times  { actions << 1 }
    @action_item.times   { actions << 2 }
    @action_defend.times { actions << 3 }
    @action_wait.times   { actions << 4 }
    # Generate a random value
    action = actions[rand(actions.size)]
    # Branch By Action Number
    case action
    when 0
      make_action_attack
    when 1
      make_action_magic
    when 2
      make_action_item
    when 3
      make_action_defend
    when 4
      make_action_wait
    end
  end
  #--------------------------------------------------------------------------
  # * Attack Influences
  #--------------------------------------------------------------------------
  def attack_influences
    # Initialize Counter
    number = 0
    # Get Attack Power
    atk = @actor.atk
    # Run Through Each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if non existant
      next if not enemy.exist?
      # Get pdef * Intelligence Rating
      pdef = enemy.pdef * attack_intelligence / 50.0
      # If actor thinks that can at least do some damage add one
      number += 1 if atk > pdef / 2
    end
    # Add To Instance Variable
    @action_attack = @action_attack * number == 0 ? 0 : @action_attack + number
  end
  #--------------------------------------------------------------------------
  # * Magic Influences
  #--------------------------------------------------------------------------
  def magic_influences
    # Initialize Counter
    number = 0
    # Initialize sp Array
    sp = []
    # Run Through Each Skill
    @actor.skills.each {|skill_id| sp << $data_skills[skill_id].sp_cost}
    # If at least one member is in critical condition
    if $game_party.critical?
      # If knows at least one healing skill that can be used
      @actor.skills.each do |skill_id|
        # If skill is healing and can use the skill
        if $data_skills[skill_id].is_healing? && @actor.skill_can_use?(skill_id)
          # Heavy influence for magic
          @action_magic = 20
          # Break
          break
        end
      end
    end
    # If Sp is less than the minimum then fail
    @action_magic = 0 if @actor.sp < sp.min
  end
  #--------------------------------------------------------------------------
  # * Item Influences
  #--------------------------------------------------------------------------
  def item_influences
    # Initialize Counter
    number = 0
    # Run Through each available item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If can be used in battle increase number
      number += 1 if [0,1].include?($data_items[item_id].occasion)
    end
    # If at least one member is in critical condition
    if $game_party.critical?
      # If knows at least one healing skill that can be used
      $game_party.items.each do |item_id, amount|
        # Skip if amount is 0 or nil
        next if amount.to_i == 0
        # If skill is healing and can use the item
        if $data_items[item_id].is_healing? && $game_party.item_can_use?(item_id)
          # Heavy influence for item
          @action_item = 20
          # Break
          break
        end
      end
    end
    # If no usable items then fail
    @action_item = 0 if number == 0
  end
  #--------------------------------------------------------------------------
  # * Defend Influences
  #--------------------------------------------------------------------------
  def defend_influences
  end
  #--------------------------------------------------------------------------
  # * Wait Influences
  #--------------------------------------------------------------------------
  def wait_influences
  end
  #--------------------------------------------------------------------------
  # * Make Action Attack
  #--------------------------------------------------------------------------
  def make_action_attack
    # Initialize Random Array
    random = []
    # Get Attack Power
    atk = @actor.atk
    # Run Through Each enemy
    $game_troop.enemies.each_with_index do |enemy, index|
      # Skip if non existant
      next if not enemy.exist?
      # Get pdef * Intelligence Rating
      pdef = enemy.pdef * attack_intelligence / 50.0
      # If actor thinks that can at least do some damage add one
      random << index if atk > pdef / 2
    end
    # Set Target Index
    @actor.current_action.target_index = random[rand(random.size)]
    # Set Action
    @actor.current_action.kind = 0
    @actor.current_action.basic = 0
  end
  #--------------------------------------------------------------------------
  # * Make Action Magic
  #--------------------------------------------------------------------------
  def make_action_magic
    # Initialize Action Array
    actions = []
    @magic_attack     = magic_offense
    @magic_support    = magic_support
    @magic_heal       = magic_healing
    @magic_status     = magic_status
    @magic_strategist = magic_strategy
    # Attack Influences
    magic_influences_attack
    # Support Influences
    magic_influences_support
    # Healing Influences
    magic_influences_healing
    # Status Influences
    magic_influences_status
    # Strategy Influences
    magic_influences_strategy
    # Push Action Numbers onto actions array
    @magic_attack.times       { actions << 0 }
    @magic_support.times      { actions << 1 }
    @magic_heal.times         { actions << 2 }
    @magic_status.times       { actions << 3 }
    @magic_strategist.times   { actions << 4 }
    # Generate a random value
    action = actions[rand(actions.size)]
    # Branch By Action Number
    case action
    when 0
      make_magic_action_attack
    when 1
      make_magic_action_support
    when 2
      make_magic_action_healing
    when 3
      make_magic_action_status
    when 4
      make_magic_action_strategist
    end
    # Make Skill Choice
    make_skill_choice
    # If skill then make action
    if @actor.current_action.skill_id != 0
      @actor.current_action.kind = 1
      @actor.current_action.basic = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Make Action Item
  #--------------------------------------------------------------------------
  def make_action_item
    # Initialize Action Array
    actions = []
    @item_attack     = item_offense
    @item_support    = item_support
    @item_heal       = item_healing
    @item_status     = item_status
    @item_strategist = item_strategy
    # Attack Influences
    item_influences_attack
    # Support Influences
    item_influences_support
    # Healing Influences
    item_influences_healing
    # Status Influences
    item_influences_status
    # Strategy Influences
    item_influences_strategy
    # Push Action Numbers onto actions array
    @item_attack.times       { actions << 0 }
    @item_support.times      { actions << 1 }
    @item_heal.times         { actions << 2 }
    @item_status.times       { actions << 3 }
    @item_strategist.times   { actions << 4 }
    # Generate a random value
    action = actions[rand(actions.size)]
    # Branch By Action Number
    case action
    when 0
      make_item_action_attack
    when 1
      make_item_action_support
    when 2
      make_item_action_healing
    when 3
      make_item_action_status
    when 4
      make_item_action_strategist
    end
    # Make Item Choice
    make_item_choice
    # If using an item set action to item
    if @actor.current_action.item_id != 0
      @actor.current_action.kind = 2
      @actor.current_action.basic = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Make Action Defend
  #--------------------------------------------------------------------------
  def make_action_defend
    @actor.current_action.kind = 0
    @actor.current_action.basic = 1
  end
  #--------------------------------------------------------------------------
  # * Make Action Wait
  #--------------------------------------------------------------------------
  def make_action_wait
    @actor.current_action.kind = 0
    @actor.current_action.basic = 3
  end
  #--------------------------------------------------------------------------
  # * Magic Influences Attack
  #--------------------------------------------------------------------------
  def magic_influences_attack
    # Initialize Number Counter
    number = 0
    # Run Through each actor skill
    @actor.skills.each do |skill_id|
      # If is an attack skill
      if $data_skills[skill_id].is_offensive?
        # Increase Counter
        number += 1
      end
    end
    # Increase magic attack modifier by amount
    @magic_attack += (number / @actor.skills.size.to_f * 4).ceil
    # If no attack skills then fail
    @magic_attack = number == 0 ? 0 : @magic_attack
  end
  #--------------------------------------------------------------------------
  # * Magic Influences Support
  #--------------------------------------------------------------------------
  def magic_influences_support
    # Initialize Number Counter
    number = 0
    # Support Skills May be used on first turn
    @magic_support += 1 if $game_temp.battle_turn == 0
    # Initialize Elements and States Array
    elements, states = [], []
    # Run Trough Each Enemy gathering there elements
    $game_troop.enemies.each {|enemy| elements += enemy.elements}
    # Remove Duplicates
    elements.uniq!
    # Run Through all Helpful States
    Ally_AI::Helpful_States.each do |state_id|
      # If State has protection against an Element
      if $data_states[state_id].guard_element_set.includes_any?(*elements)
        # Add State
        states << state_id
      end
    end
    # Run Through each actor skill
    @actor.skills.each do |skill_id|
      # If Has any of the states
      if $data_skills[skill_id].plus_state_set.includes_any?(*states)
        # Increase Counter
        number += 1
      end
    end
    # Increase magic support modifier by amount
    @magic_support += (number / @actor.skills.size.to_f * 4).ceil
    # If no support skills then fail
    @magic_support = number == 0 ? 0 : @magic_support
  end
  #--------------------------------------------------------------------------
  # * Magic Influences Healing
  #--------------------------------------------------------------------------
  def magic_influences_healing
    # Initialize Number Counter
    number, healthy = 0, $game_party.actors.size
    # Healing modifiers
    $game_party.actors.each do |actor|
      # Skip if non existing
      if not actor.exist?
        # Not included
        healthy -= 1
        # Skip
        next 
      end
      # Increase Healing influence if less than heal percent
      if (actor.hp * 100.0 / actor.maxhp).to_i <= magic_heal_percent
        @magic_heal += 1
      else
        # Is Healthy
        healthy -= 1
      end
    end
    # If game party is in critical state increase chances of using a skill
    @magic_heal += 3 if $game_party.critical?
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # Increase by 1 if healing skill
      number += 1 if $data_skills[skill_id].is_healing?
    end
    # Increase magic heal modifier by amount
    @magic_heal += (number / @actor.skills.size.to_f * 2).ceil
    # If no Healing Skills then can't use a healing skill
    @magic_heal = number == 0 ? 0 : @magic_heal
    # If all are healty then don't use a healing skill
    @magic_heal = healthy == 0 ? 0 : @magic_heal
  end
  #--------------------------------------------------------------------------
  # * Magic Influences Status
  #--------------------------------------------------------------------------
  def magic_influences_status
    # Initialize Number Counter
    number = 0
    # Initialize Weak States Hash
    weak_states = {}
    # Run Through Each Enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing
      next if not enemy.exist?
      # Run Through each Harmful state
      Ally_AI::Harmful_States.each do |state_id|
        # Get State Effectiveness Value
        effective = enemy.state_effectiveness(state_id)
        # Push if effective enough
        weak_states[state_id] = effective if effective > magic_strategy_effective
      end
    end
    # Run Thorugh each actor skill
    @actor.skills.each do |skill_id|
      # If Skill has any of the states
      if $data_skills[skill_id].plus_state_set.includes_any?(*weak_states.keys)
        # Increase Number
        number += 1
      end
    end
    # Correction if no weak states
    number = 0 if weak_states.keys.size == 0
    # Increase magic status modifier by amount
    @magic_status  += Integer(number / @actor.skills.size.to_f * 4)
    # If no Status Skills then can't us a status skill
    @magic_status  = number == 0 ? 0 : @magic_status 
  end
  #--------------------------------------------------------------------------
  # * Magic Influences Strategy
  #--------------------------------------------------------------------------
  def magic_influences_strategy
    # Initialize Weak Elements Array
    weak_elements = {}
    # Initialize Number Counter
    number = 0
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing enemy
      next if not enemy.exist?
      # Run Through Real Elements
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # If Greater Than magic effectives value
        if effective > magic_strategy_effective
          # Add to weak elements hash
          weak_elements[element_id] = effective
        end
      end
    end
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # If Skills Element Set includes any element in weak elements
      if $data_skills[skill_id].element_set.includes_any?(*weak_elements.keys)
        # Increase Counter
        number += 1
      end
    end
    # Increase magic strategist modifier by amount
    @magic_strategist += (number / @actor.skills.size.to_f * 4).ceil
    # Set to 0 if conditions not met (no strategical skills)
    @magic_strategist = number == 0 ? 0 : @magic_strategist
  end
  #--------------------------------------------------------------------------
  # * Make Magic Action Attack
  #--------------------------------------------------------------------------
  def make_magic_action_attack
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # If is an attack skill Push Skill Id onto list
      @useable << skill_id if $data_skills[skill_id].is_offensive?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Magic Action Support
  #--------------------------------------------------------------------------
  def make_magic_action_support
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # If is a support skill Push Skill Id onto list
      @useable << skill_id if $data_skills[skill_id].is_supporting?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Magic Action Healing
  #--------------------------------------------------------------------------
  def make_magic_action_healing
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # If is a healing skill Push Skill Id onto list
      @useable << skill_id if $data_skills[skill_id].is_healing?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Magic Action Status
  #--------------------------------------------------------------------------
  def make_magic_action_status
    # Run Through each skill
    @actor.skills.each do |skill_id|
      # If is a status skill Push skill onto list
      @useable << skill_id if $data_skills[skill_id].is_status?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Magic Action Strategist
  #--------------------------------------------------------------------------
  def make_magic_action_strategist
    # Initialize elements
    elements = []
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing enemy
      next if not enemy.exist?
      # Run Through Real Elements
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # If Greater Than magic effectives value
        if effective > magic_strategy_effective
          # Add to elements
          elements << element_id
        end
      end
    end
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing
      next if not enemy.exist?
      # Run Through each element
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # Push if effective enough
        elements << element_id if effective > magic_strategy_effective
      end
    end
    # Remove Duplicates
    elements.uniq!
    # Run Through Each Skill
    @actor.skills.each do |skill_id|
      # Push onto useable list if is strategic with respect to elements
      @useable << skill_id if $data_skills[skill_id].is_strategic?(*elements)
    end
  end
  #--------------------------------------------------------------------------
  # * Item Influences Attack
  #--------------------------------------------------------------------------
  def item_influences_attack
    # Initialize Number Counter
    number = 0
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If is an attack item
      if $data_items[item_id].is_offensive?
        # Increase Counter
        number += 1
      end
    end
    # Increase item attack modifier by amount
    @item_attack += number
    # If no attack items then fail
    @item_attack = number == 0 ? 0 : @item_attack
  end
  #--------------------------------------------------------------------------
  # * Item Influences Support
  #--------------------------------------------------------------------------
  def item_influences_support
    # Initialize Number Counter
    number = 0
    # Support Items May be used on first turn
    @item_support += 1 if $game_temp.battle_turn == 0
    # Initialize Elements and States Array
    elements, states = [], []
    # Run Trough Each Enemy gathering there elements
    $game_troop.enemies.each {|enemy| elements += enemy.elements}
    # Remove Duplicates
    elements.uniq!
    # Run Through all Helpful States
    Ally_AI::Helpful_States.each do |state_id|
      # If State has protection against an Element
      if $data_states[state_id].guard_element_set.includes_any?(*elements)
        # Add State
        states << state_id
      end
    end
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If Has any of the states
      if $data_items[item_id].plus_state_set.includes_any?(*states)
        # Increase Counter
        number += 1
      end
    end
    # Increase item support modifier by amount
    @item_support += number
    # If no support items then fail
    @item_support = number == 0 ? 0 : @item_support
  end
  #--------------------------------------------------------------------------
  # * Item Influences Healing
  #--------------------------------------------------------------------------
  def item_influences_healing
    # Initialize Number Counter
    number, healthy = 0, $game_party.actors.size
    # Healing modifiers
    $game_party.actors.each do |actor|
      # Skip if non existing
      if not actor.exist?
        # Not included
        healthy -= 1
        # Skip
        next 
      end
      # Increase Healing influence if less than heal percent
      if (actor.hp * 100.0 / actor.maxhp).to_i <= item_heal_percent
        @item_heal += 1
      else
        # Is Healthy
        healthy -= 1
      end
    end
    # If game party is in critical state increase chances of using a skill
    @item_heal += 3 if $game_party.critical?
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # Increase by 1 if healing skill
      number += 1 if $data_items[item_id].is_healing?
    end
    # Increase item heal modifier by amount
    @item_heal += number
    # If no Healing items then can't use a healing item
    @item_heal = number == 0 ? 0 : @item_heal
    # If all are healty then don't use a healing item
    @item_heal = healthy == 0 ? 0 : @item_heal
  end
  #--------------------------------------------------------------------------
  # * Item Influences Status
  #--------------------------------------------------------------------------
  def item_influences_status
    # Initialize Number Counter
    number = 0
    # Initialize Weak States Hash
    weak_states = {}
    # Run Through Each Enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing
      next if not enemy.exist?
      # Run Through each Harmful state
      Ally_AI::Harmful_States.each do |state_id|
        # Get State Effectiveness Value
        effective = enemy.state_effectiveness(state_id)
        # Push if effective enough
        weak_states[state_id] = effective if effective > item_strategy_effective
      end
    end
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If Item has any of the states
      if $data_items[item_id].plus_state_set.includes_any?(*weak_states.keys)
        # Increase Number
        number += 1
      end
    end
    # Correction if no weak states
    number = 0 if weak_states.keys.size == 0
    # Increase item status modifier by amount
    @item_status += number
    # If no Status Items then can't us3 a status item
    @item_status = number == 0 ? 0 : @item_status 
  end
  #--------------------------------------------------------------------------
  # * Item Influences Strategy
  #--------------------------------------------------------------------------
  def item_influences_strategy
    # Initialize Weak Elements Array
    weak_elements = {}
    # Initialize Number Counter
    number = 0
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing enemy
      next if not enemy.exist?
      # Run Through Real Elements
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # If Greater Than magic effectives value
        if effective > item_strategy_effective
          # Add to weak elements hash
          weak_elements[element_id] = effective
        end
      end
    end
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If Items Element Set includes any element in weak elements
      if $data_items[item_id].element_set.includes_any?(*weak_elements.keys)
        # Increase Counter
        number += 1
      end
    end
    # Increase item strategist modifier by amount
    @item_strategist += number
    # Set to 0 if conditions not met (no strategical items)
    @item_strategist = number == 0 ? 0 : @item_strategist
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Attack
  #--------------------------------------------------------------------------
  def make_item_action_attack
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If is an attack item Push Item Id onto list
      @useable << item_id if $data_items[item_id].is_offensive?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Support
  #--------------------------------------------------------------------------
  def make_item_action_support
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If is a support item Push Item Id onto list
      @useable << item_id if $data_items[item_id].is_supporting?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Healing
  #--------------------------------------------------------------------------
  def make_item_action_healing
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If is a healing item Push Item Id onto list
      @useable << item_id if $data_items[item_id].is_healing?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Status
  #--------------------------------------------------------------------------
  def make_item_action_status
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # If is a status item Push item onto list
      @useable << item_id if $data_items[item_id].is_status?
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Strategist
  #--------------------------------------------------------------------------
  def make_item_action_strategist
    # Initialize elements
    elements = []
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing enemy
      next if not enemy.exist?
      # Run Through Real Elements
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # If Greater Than magic effectives value
        if effective > magic_strategy_effective
          # Add to elements
          elements << element_id
        end
      end
    end
    # Run Through each enemy
    $game_troop.enemies.each do |enemy|
      # Skip if not existing
      next if not enemy.exist?
      # Run Through each element
      Ally_AI::Real_Elements.each do |element_id|
        # Get Effectiveness
        effective = enemy.element_effectiveness(element_id)
        # Push if effective enough
        elements << element_id if effective > magic_strategy_effective
      end
    end
    # Remove Duplicates
    elements.uniq!
    # Run Through each item
    $game_party.items.each do |item_id, amount|
      # Skip if amount is nil or 0
      next if amount.to_i == 0
      # Push onto useable list if is strategic with respect to elements
      @useable << item_id if $data_items[item_id].is_strategic?(*elements)
    end
  end
  #--------------------------------------------------------------------------
  # * Make Skill Choice
  #--------------------------------------------------------------------------
  def make_skill_choice
    # Get Laziness
    chance_lazy = rand(@laziness+1)
    # Get Maximum Mp want to use
    max_mp_used = (20 - chance_lazy).to_f / 20 * @actor.sp
    # Setup Local Useable
    useable = []
    # Run Through Useable Skills
    @useable.each do |skill_id|
      # Push if sp cost is less than max mp want to use
      useable << skill_id if $data_skills[skill_id].sp_cost <= max_mp_used
    end
    # Return if size is 0
    return if useable.size == 0
    # Get Skill Id
    skill_id = useable[rand(useable.size)]
    # Get Random Skill
    @actor.current_action.skill_id = skill_id
    # If not Targets All
    if not $data_skills[skill_id].targets_all?
      # Make Target Choice
      make_magic_target_choice
    end
  end
  #--------------------------------------------------------------------------
  # * Make Magic Target Choice
  #--------------------------------------------------------------------------
  def make_magic_target_choice
    # Get Skill
    skill = $data_skills[@actor.current_action.skill_id]
    # Get Scope
    scope = skill.scope
    # Setup Possible Targets
    possible_targets = []
    # Branch By Scope
    case scope
    when 1
      # Setup States Element Effeienct Targets and Elements Arrays
      states, elem_effiency, targets = [], [], []
      # Run Through each enemy
      $game_troop.enemies.each_with_index do |enemy, index|
        # Skip if non-existant
        next if not enemy.exist?
        # Setup Local Block Variable elements
        elements = []
        # If skill is a status skill
        if skill.is_status?
          # Initialize Enemy Status Points
          enemy_status = 0
          # Run Through each state
          skill.plus_state_set.each do |state_id|
            # Add State Effectiveness
            enemy_status += enemy.state_effectiveness(state_id)
          end
          # Set Index to Status Points
          states[index] = enemy_status
        end
        # Run Through each real element
        Ally_AI::Real_Elements.each do |element_id|
          # Get Element Effectiveness for enemy
          effective = enemy.element_effectiveness(element_id)
          # Add element id if effective
          elements << element_id if effective > magic_strategy_effective
        end
        # If skill is strategic with respect to elements
        if skill.is_strategic?(*elements)
          # Set Local Variable Enemy Element
          enemy_element = 0
          # Run Through each element_id
          skill.element_set.each do |element_id|
            # Add Effectiveness
            enemy_element += enemy.element_effectiveness(element_id)
          end
          # Add Element Effiency
          elem_effiency[index] = enemy_element
        end
        # If Skill is attacking
        if skill.is_offensive?
          # Just Push the index
          targets << index
        end
      end 
      # Add to Possible Targets
      magic_status_multiplier.times do
        possible_targets += states.find_index(states.max)
      end
      magic_strategy_multiplier.times do
        possible_targets += elem_effiency.find_index(elem_effiency.max)
      end
      possible_targets += targets
    when 3
      # Setup Local Hp amount
      hp_amount = Array.new($game_party.actors.size) {0}
      # Setup Minus States Array (set all indexes to 0)
      minus_states = Array.new($game_party.actors.size) {0}
      # Setup Status Array (set all indexes to 0)
      status = Array.new($game_party.actors.size) {0}
      # Run Through Each Actor
      $game_party.actors.each_with_index do |actor, index|
        # If Skill Is Healing
        if skill.is_healing?
          # If power is less than 0 (healing hp) and actor exists
          if skill.power < 0 and actor.exist?
            # Get Percentage
            percentage = (actor.hp * 100.0 / actor.maxhp).to_i
            # Push Percentage of hp left
            hp_amount[index] = 100 - percentage
            # Set to 0 if 
            hp_amount[index] = 0 if percentage > magic_heal_percent
          end
          # Get Remove Harmful States
          remove_states = skill.minus_state_set & Ally_AI::Harmful_States
          # Run Through States Removed
          remove_states.each do |state_id|
            # Get State
            state = $data_states[state_id]
            # Skip if doesn't have state
            next if not actor.state?(state_id)
            # If has bad state increase by 1
            minus_states[index] += 1 
            # If bad state restriction > 0 increase by 1
            minus_states[index] += 1 if state.restriction > 0
            # If Slip Damage increase by 1
            minus_states[index] += 1 if state.slip_damage
            # If zero hp increase by 2
            minus_states[index] += 2 if state.zero_hp
          end
        end
        # Skip if not exists
        next if not actor.exist?
        # If skill is supporting
        if skill.is_supporting?
          # Get Skill Helpful States
          helpful = skill.plus_state_set & Ally_AI::Helpful_States
          # Run Through each actor with index
          $game_party.actors.each_with_index do |actor, index|
            # Run Through Each Helpful State
            helpful.each do |state_id|
              # Increase if actor doesn't have state
              status[index] += 1 if not actor.state?(state_id)
            end
          end
        end
      end
      # If not all zeros
      if hp_amount.sum != 0
        # Get Hp Amounts
        rating = hp_amount
        # Get Percentage By / by sum
        rating.collect! {|rate| rate.to_f / hp_amount.sum}
        # Increase Ratings by heal Multiplier rating
        rating.collect! {|rate| rate * magic_heal_multiplier}
        # Run Through adding indexes and their rating
        rating.each_with_index do |rate, index|
          # Push onto Possible Targets
          possible_targets += Array.new(rate) {index}
        end
      end
      # Run Through adding indexes and their rating
       minus_states.each_with_index do |state_rate, index|
        # Push onto Possible Targets
        possible_targets += Array.new(state_rate) {index}
      end
      # Run Through adding indexes and their rating
       status.each_with_index do |status, index|
        # Push onto Possible Targets
        possible_targets += Array.new(status) {index}
      end
    when 5
      # Run Through all Actors
      $game_party.actors.each_with_index do |actor, index|
        # Push index if non existant
        possible_targets << index if not actor.exist?
      end
    when 7
      # Push itself
      possible_targets << @actor.index
    end
    target_index = possible_targets[rand(possible_targets.size)]
    @actor.current_action.target_index = target_index
  end
  #--------------------------------------------------------------------------
  # * Make Item Choice
  #--------------------------------------------------------------------------
  def make_item_choice
    # Get Item Id
    item_id = @useable[rand(@useable.size)]
    # Set Random Item
    @actor.current_action.item_id = item_id
    # If not Targets All
    if not $data_items[item_id].targets_all?
      # Make Target Choice
      make_item_target_choice
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Target Choice
  #--------------------------------------------------------------------------
  def make_item_target_choice
    # Get Item
    item = $data_items[@actor.current_action.item_id]
    # Get Scope
    scope = item.scope
    # Setup Possible Targets
    possible_targets = []
    # Branch By Scope
    case scope
    when 1
      # Setup States Element Effeienct Targets and Elements Arrays
      states, elem_effiency, targets = [], [], []
      # Run Through each enemy
      $game_troop.enemies.each_with_index do |enemy, index|
        # Skip if non-existant
        next if not enemy.exist?
        # Setup Local Block Variable elements
        elements = []
        # If skill is a status skill
        if item.is_status?
          # Initialize Enemy Status Points
          enemy_status = 0
          # Run Through each state
          item.plus_state_set.each do |state_id|
            # Add State Effectiveness
            enemy_status += enemy.state_effectiveness(state_id)
          end
          # Set Index to Status Points
          states[index] = enemy_status
        end
        # Run Through each real element
        Ally_AI::Real_Elements.each do |element_id|
          # Get Element Effectiveness for enemy
          effective = enemy.element_effectiveness(element_id)
          # Add element id if effective
          elements << element_id if effective > magic_strategy_effective
        end
        # If item is strategic with respect to elements
        if item.is_strategic?(*elements)
          # Set Local Variable Enemy Element
          enemy_element = 0
          # Run Through each element_id
          item.element_set.each do |element_id|
            # Add Effectiveness
            enemy_element += enemy.element_effectiveness(element_id)
          end
          # Add Element Effiency
          elem_effiency[index] = enemy_element
        end
        # If Item is attacking
        if item.is_offensive?
          # Just Push the index
          targets << index
        end
      end 
      # Add to Possible Targets
      item_status_multiplier.times do
        possible_targets += states.find_index(states.max)
      end
      item_strategy_multiplier.times do
        possible_targets += elem_effiency.find_index(elem_effiency.max)
      end
      possible_targets += targets
    when 3
      # Setup Local Hp amount
      hp_amount = Array.new($game_party.actors.size) {0}
      # Setup Local Sp amount
      sp_amount = Array.new($game_party.actors.size) {0}
      # Setup Minus States Array (set all indexes to 0)
      minus_states = Array.new($game_party.actors.size) {0}
      # Setup Status Array (set all indexes to 0)
      status = Array.new($game_party.actors.size) {0}
      # Run Through Each Actor
      $game_party.actors.each_with_index do |actor, index|
        # If Item Is Healing
        if item.is_healing?
          # If item recover rates is > than 0 (healing hp) and actor exists
          if item.recover_hp_rate > 0 || item.recover_hp > 0 and actor.exist?
            # Get Percentage
            percentage = (actor.hp * 100.0 / actor.maxhp).to_i
            # Push Percentage of hp left
            hp_amount[index] = 100 - percentage
            # Set to 0 if 
            hp_amount[index] = 0 if percentage > item_heal_percent
          end
          # If item recover rates is > than 0 (healing sp)
          if item.recover_sp_rate > 0 || item.recover_sp > 0 
            # Get Percentage
            percentage = (actor.sp * 100.0 / actor.maxsp).to_i
            # Push Percentage of hp left
            sp_amount[index] = 100 - percentage
            # Set to 0 if 
            sp_amount[index] = 0 if percentage <= item_heal_percent
          end
          # Get Remove Harmful States
          remove_states = item.minus_state_set & Ally_AI::Harmful_States
          # Run Through States Removed
          remove_states.each do |state_id|
            # Get State
            state = $data_states[state_id]
            # Skip if doesn't have state
            next if not actor.state?(state_id)
            # If has bad state increase by 1
            minus_states[index] += 1
            # If bad state restriction > 0 increase by 1
            minus_states[index] += 1 if state.restriction > 0
            # If Slip Damage increase by 1
            minus_states[index] += 1 if state.slip_damage
            # If zero hp increase by 2
            minus_states[index] += 2 if state.zero_hp
          end
        end
        # Skip if not exists
        next if not actor.exist?
        # If item is supporting
        if item.is_supporting?
          # Get Skill Helpful States
          helpful = item.plus_state_set & Ally_AI::Helpful_States
          # Run Through each actor with index
          $game_party.actors.each_with_index do |actor, index|
            # Run Through Each Helpful State
            helpful.each do |state_id|
              # Increase if actor doesn't have state
              status[index] += 1 if not actor.state?(state_id)
            end
          end
        end
      end
      # If not all zeros
      if hp_amount.sum != 0
        # Get Hp Amounts
        rating = hp_amount
        # Get Percentage By / by sum
        rating.collect! {|rate| rate.to_f / hp_amount.sum}
        # Increase Ratings by heal Multiplier rating
        rating.collect! {|rate| rate * item_heal_multiplier}
        # Run Through adding indexes and their rating
        rating.each_with_index do |rate, index|
          # Push onto Possible Targets
          possible_targets += Array.new(rate) {index}
        end
      end
      # If not all zeros
      if sp_amount.sum != 0
        # Get Ratings
        rating = sp_amount
        # Get Percentage By / by sum
        rating.collect! {|rate| rate.to_f / sp_amount.sum}
        # Increase Ratings by heal Multiplier rating
        rating.collect! {|rate| rate * item_heal_multiplier}
        # Run Through adding indexes and their rating
        rating.each_with_index do |rate, index|
          # Push onto Possible Targets
          possible_targets += Array.new(rate) {index}
        end
      end
      # Run Through adding indexes and their rating
       minus_states.each_with_index do |state_rate, index|
        # Push onto Possible Targets
        possible_targets += Array.new(state_rate) {index}
      end
      # Run Through adding indexes and their rating
       status.each_with_index do |status, index|
        # Push onto Possible Targets
        possible_targets += Array.new(status) {index}
      end
    when 5
      # Run Through all Actors
      $game_party.actors.each_with_index do |actor, index|
        # Push index if non existant
        possible_targets << index if not actor.exist?
      end
    when 7
      # Push itself
      possible_targets << @actor.index
    end
    target_index = possible_targets[rand(possible_targets.size)]
    @actor.current_action.target_index = target_index
  end
end
 
Reaper*;107866 said:
1-You should make an edit in your script so when all your party members have barrier on them the player/s with the ai stop using it.

2-Can you make a type of ai that can attack your allies too like when they have state like berserk or tramsform into a monster berserked like in breath of fire 3 rei transforms into a were tiger and can attack your party members too.

3-Can you make an edit in your script so if you want the autobattle in your commands leave it true else false.

Are like that better?

Its not "You should" its "I suggest" :P

1) That may be one of the hiccups in the formula, thanks for spotting that
2) Hmm, I'll think about it
3) Thats an easy edit, but the commands the actors has is not the focus of this script

SephirothSpawn;108557 said:
Very Very Very Very Very Very Nice.

I am jealous. :(

Well I'm jealous of your Test Bed WHICH YOU SHOULD BE WORKING ON Come on 70+ Scripts compared to my 20-40ish amount :(. on a side note are you still working on your autobattle system
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top