I noticed the AI will recast a buff over and over again on a target that already has said buff. I am looking for a script that makes the AI check if the target has the buff already, and if it does, do NOT recast. I found a few scripts online that seem like they do what I want, but they don't work.
Here is one:
http://rpgmaker.net/scripts/253/code/
There is also this one by fomar:
This one makes it so it will focus on a target that doesn't have the buff, BUT if all targets have the buff, it will recast on a random target. I want it to just not cast the spell and cast something else.
Here is one:
http://rpgmaker.net/scripts/253/code/
There is also this one by fomar:
This one makes it so it will focus on a target that doesn't have the buff, BUT if all targets have the buff, it will recast on a random target. I want it to just not cast the spell and cast something else.
Code:
=beginSmarter Enemy AIby Fomar0153Version 1.0----------------------Notes----------------------Script makes enemies heal the most injured personand you can set it up so they don't buff/debuff a targetwho is already buffed/debuffed over a target who isn't.----------------------Instructions----------------------Use this notetag on the skills:<state_ai x>and it will prioritise targets without state x----------------------Known bugs----------------------None=endclass Game_Action #-------------------------------------------------------------------------- # * Targets for Opponents #-------------------------------------------------------------------------- alias ai_targets_for_opponents targets_for_opponents def targets_for_opponents if [email protected]_a?(RPG::Skill) or (@item.object.is_a?(RPG::Skill) and @item.object.state_ai == 0) @subject.is_a?(Game_Actor) or !(item.for_friend? and item.for_one?) return ai_targets_for_opponents end t = opponents_unit.alive_members t = t.delete_if { |a| a.state?(@item.object.state_ai) } return [opponents_unit.alive_members.sample] if t.size == 0 [t.sample] end #-------------------------------------------------------------------------- # * Targets for Friends #-------------------------------------------------------------------------- alias ai_targets_for_friends targets_for_friends def targets_for_friends return [subject] if item.for_user? if [email protected]_a?(RPG::Skill) or @subject.is_a?(Game_Actor) or !(item.for_friend? and item.for_one?) return ai_targets_for_friends end if @item.object.state_ai == 0 t = friends_unit.alive_members.shuffle.sort { |a,b| a.hp_rate <=> b.hp_rate } [t[0]] else t = friends_unit.alive_members t = t.delete_if { |a| a.state?(@item.object.state_ai) } return [friends_unit.alive_members.sample] if t.size == 0 [t.sample] end endendclass RPG::Skill def state_ai if @state_ai.nil? if @note =~ /<state_ai (.*)>/i @state_ai = $1.to_i else @state_ai = 0 end end @state_ai endend

