Enemy AI

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
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.

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 !@item.object.is_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 !@item.object.is_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
 
Last edited by a moderator:

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
564
Reaction score
275
First Language
German
Primarily Uses
Hi,

If you already tried other script it would be nice to know which ones you tried. Especially since you said they were not working as intended (it would be pointless searching for- or creating other scripts that do exactly what the scripts you found already did and probably won't work either for the exact same reason).

*Removed messed code...*

Wouldn't have worked even without the spelling error, Sorry.
 
Last edited by a moderator:

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
I added those lines to the bottom of fomar's script and I got this error when trying to load a battle test.

Untitled.png
 

Heretic86

Veteran
Veteran
Joined
Nov 30, 2014
Messages
240
Reaction score
167
First Language
Engrish
Primarily Uses
This is a Script that I wrote for XP, and I have never tested it to see if it works on VX/A, but it may work.

#=============================================================================## Unlimited Battle Page Conditions# Authors: Heretic# Version 1.1# Monday, January 20th, 2014##-----------------------------------------------------------------------------## --- OVERVIEW ---## This script will allow you to add an Unlimited Number of Page Conditions# for Battle Events by using Comments as a Condition on each Battle Page## --- IMPORTANT! ---# --- IMPORTANT! ---# --- IMPORTANT! ---## The Conditions that you put in to the Comment MUST be able to evaluate# to true / false!## What this means is that a Condition of var = 1 will run, but not evaluate# to true, so it wont ever be recognized as a valid condition. By placing# a Condition of "if var == 1" will return true, which makes it valid when# the proper conditions are met.## --- USAGE ---## Create a Condition by making a Comment ANYWHERE on a Battle Event Page# with "condition:" followed by your Scripted Condition in the Comment.## Example #1: ## @>Comment: condition: $foo == $bar## NOTE: Pay attention! I left off the word "if" from the Condition. It # works exactly the same way as Conditional Branch -> Script### Comment Conditions will run Eval for ALL of the contents for each Comment# all at once. This allows you to have a Multi Line Condition.## Example #2: ## @>Comment: condition: ($foo == $bar AND# $lorem == $ipsum)## NOTE: Parenthesis () are not required! You could also use && in place of# the word AND. If you Nest Conditions, you may need to use Parenthesis# ($foo == $bar AND $lorem == $ipsum) OR $game_party.actors[0].hp == 0### Comments run as Scripts just like a Script Event, so you can put anything# into the Script. Loops, Iterations, Create Variables, Self Switches, etc.## Example #3 ## @>Comment: condition: result = false# for actor in $game_party.actors# result = true if actor.weapon_id == 12# end# result == true### Each Comment Condition you add will add another Condition to check before# the Battle Event Page can be run. This allows you to add as many Conditions# as you want. THERE IS NO LIMIT. Each Comment Condition is considered as# its own Condition.## Example #4: ## @>Comment: condition: $game_party.actors[0].hp == $game_party.actors[0].maxhp# @>Comment: condition: $game_party.actors[0].id == 2## In the above example, BOTH Conditions MUST BE MET for the Battle Event Page# to be considered Valid and thus run.### You can use OR Statements inside of a single Comment Condition allowing for# greater flexibility of Battle Page Conditions.## Examle #5:## @>Comment: condition: $foo == $bar OR $lorem == $ipsum### ANY Sript Logic can be used provided it fits in the comment. Its all # evaluated the same way.## --- BATTLE EVENTING ---## Battle Eventing has a Menu for a few things already. Such as checking to# make sure a certain Switch is on before running the Battle Event Page. You# can now use a Comment Condition to check if a certain Switch is OFF before# running a Battle Event Page.## Battle Event also uses what is called SPAN.## SPAN controls when and how many times to run a Battle Event Page.## Span: Battle - Page runs ONCE per the entire Battle# Turn: Page runs ONCE per Turn, even if conditions are still met.# Moment: Runs when Conditions are met, and continues to run as long as# those conditions are met.## Comment Conditions are EXTREMELY USEFUL for allowing a Span Moment Page# to STOP RUNNING. It allows you to run the Page once. Like a specific# enemy has a State of "Immune to Fire", run some dialogue once, then# use some variable to set that the page has run already. You could use# a Switch, or even any other variable like @this_page_ran = true, and set# that as a Condition.## Example #6## @>Comment: condition: if $game_troop.enemies[0].states.include?(12)# @this_new_var_for_page_ran = true# else# unless @this_new_var_for_page_ran# @this_new_var_for_page_ran = false# end# end# @>Comment: condition: if @this_new_var_for_page_ran != true# @>Text: "Don't cast Fire on him! He is now Immune to Fire!"## --- COMMAND LIST ---## I'd like to make this as easy as possible for people to use. So to do that# these list of Commands should make adding Comment Conditions easier.## Example of Command:## - item_in_inventory?(item_id)# # @>Comment condition: # If Party has a Potion in their Inventory# if item_in_inventory(1)### Command List# - item_in_inventory?(item_id)### --- CHANGE LOG ---## Version 1.0: Monday, January 20th, 2014# - Initial Release## Version 1.1: Wednesday, Jauary 22nd, 2014# - Altered Logic: Evaulations MUST return TRUE to be considered valid# * Necessary because For Loops returned Arrays which caused incorrect Evals# If TRUE is not returned now, then it will be considered Invalid##-----------------------------------------------------------------------------class Scene_Battle #-------------------------------------------------------------------------- # * Battle Event Setup # # - Replacement for default XP Battle System setup_battle_event # - Any Script Conflicts would most likely come from this method #-------------------------------------------------------------------------- def setup_battle_event # If battle event is running if $game_system.battle_interpreter.running? return end # Search for all battle event pages for index in 0...$data_troops[@troop_id].pages.size # Get event pages page = $data_troops[@troop_id].pages[index] # Make event conditions possible for reference with c c = page.condition # New Code for checking extra Conditions in Comments of Battle Page page_condition_valid = has_battle_page_condition?(page) # This code is mostly default with the addition of "page_condition_valid" # Go to next page if no conditions are appointed unless c.turn_valid or c.enemy_valid or c.actor_valid or c.switch_valid or page_condition_valid next end # Default code # Go to next page if action has been completed if $game_temp.battle_event_flags[index] next end # Confirm turn conditions if c.turn_valid n = $game_temp.battle_turn a = c.turn_a b = c.turn_b if (b == 0 and n != a) or (b > 0 and (n < 1 or n < a or n % b != a % ) next end end # Confirm enemy conditions if c.enemy_valid enemy = $game_troop.enemies[c.enemy_index] if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp next end end # Confirm actor conditions if c.actor_valid actor = $game_actors[c.actor_id] if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp next end end # Confirm switch conditions if c.switch_valid if $game_switches[c.switch_id] == false next end end # This small block is also all that was added to the Default code # Confirm Page Condition (if Additional Page Condition exists) if page_condition_valid # If running the extra Page Condition returns false (which is default) if eval_page_conditions(page) == false # Go to next Battle Event Page if one exists and skip processing this next end end # The rest of the code in this method is Default # Set up event $game_system.battle_interpreter.setup(page.list, 0) # If this page span is [battle] or [turn] if page.span <= 1 # Set action completed flag $game_temp.battle_event_flags[index] = true end return end end #-------------------------------------------------------------------------- # * Has Page Condition (Comment Conditions I.E. "condition: (var1 == var2) # page : Battle Event Page # # This checks for the existence of any Page Conditions. It returns # true if it finds at least one condition, then stops. If any conditions # are in Comments, then it uses another method to check for ALL of the # conditions on the page passed in via the argument. # # This is NEW CODE and should not cause any Script Conflicts. # # Version 1.1 - Changed name for higher degree of compatability. #-------------------------------------------------------------------------- def has_battle_page_condition?(page) # For each Battle Event Command on this Battle Page for command in page.list # If Command is First Line of a Comment if command.code == 108 # Check each Commment if it has "condition:" as String command.parameters[0].gsub(/^condition:(.*)/i){$1} # found a Battle Condition in a Comment return true if $1 != nil end end # Default - No Valid Battle Page Conditions in Comment Commands found return false end #-------------------------------------------------------------------------- # * Eval Page Conditions # - Finds ALL Page Conditions in Comments, then Evaluates them # # NOTE: Conditions MUST be able to return a Value # $foo = "Bar" will not return anything, thus evals to nil (false) # $foo == "Bar" will return either True or False # # This code will check to enusre ALL of the Comment Conditions on a # Battle Event Page are met. If you have Two Conditions, both must # eval to True for an Event Page to be considered "valid". Each Comment # Condition is considered as a Separate Condition. Everything in the # Comment Box is evaluated all at once, so you can create temporary # variables, Loops, OR statements, etc as long as it is all contained # in ONE Comment. IE "if $foo == $bar OR actor_id == 2". Complex # scripts may adversely affect performance. # # This is NEW CODE and should not cause any Script Conflicts. # #-------------------------------------------------------------------------- def eval_page_conditions(page) # For each Battle Event Command on this Battle Page for i in 0...page.list.size # Get Command command = page.list # If Command is First Line of a Comment if command.code == 108 # Check each Commment if it has "condition:" as String command.parameters[0].gsub(/^condition:(.*)/i){$1} # If Battle Condition in a Comment if $1 != nil # Remember the Condition condition = $1 # Check for more lines in the Comment to Eval all at once while (page.list[i + 1] and page.list[i + 1].code == 408) # Advance Counter i += 1 # Add Next Line of Comment (code 408) to Condition to eval condition += "\n" + page.list.parameters[0] end # Run the Script (Improper Script Calls may Crash here) result = eval(condition) # Evaluate Page Conditions for EACH Comment if result == true # Remains True as long as ALL Comment Conditions are met passed = true else # If Any Conditions in Comments Eval to False then Page is False return false end end end end # If All Comment Conditions on this Page are met, this variable will exist return true if passed # Default return false end #--------------------------------------------------------------------------# # ** Custom Commands for Easy Checks for Conditional Switches # # # # ALL METHODS MUST RETURN TRUE OR FALSE # #--------------------------------------------------------------------------# #-------------------------------------------------------------------------- # * Item In Inventory # item_id : Item Id from Database # # Example: 1 is a Potion # # If Party has a Potion in the Inventory # item_in_inventory?(1) # # 2 is a High Potion # # If Party has a High Potion in the Inventory # item_in_inventory?(2) # # This is an Example Script. It could be accomplished by copying and # pasting the one "return true if ..." line of code. I provided this # because it makes it easy for us to script easier condition checks # for others that may use this script. #-------------------------------------------------------------------------- def item_in_inventory?(item_id) # If Item is in Inventry, return True return true if $game_party.item_number(item_id) > 0 # Default return false endend

This should help you out. It just needs a Page Condition where $game_troop.enemies[id].states.include?(state_id)

Id will be a Number, start at 0 for your first enemy, not 1

States will be the ID of your Buff.

It would look something like this:

Comment: condition: $game_troop.enemies[1].states.include?(12)

This may be a bit different for VXA (if this script above works), but also due to the ability to evaluate your Script as a Page Condition every single time, you can put in literally ANY condition in there.

If it doesnt work for VX/A, I dont own VXA so I wont be able to modify this script to be compatible, but someone will be able to do so, and you have my permission to modify the above script to be made compatible with VXA as so long as I am properly accredited as the original creator.
 

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
You can try this one too maybe?

https://mrtrivelvx.wordpress.com/
Yes this one I've looked into as well. This has what I want, I just don't know the commands to use. Can you direct me to a command list?

This is a Script that I wrote for XP, and I have never tested it to see if it works on VX/A, but it may work.

#=============================================================================## Unlimited Battle Page Conditions# Authors: Heretic# Version 1.1# Monday, January 20th, 2014##-----------------------------------------------------------------------------## --- OVERVIEW ---## This script will allow you to add an Unlimited Number of Page Conditions# for Battle Events by using Comments as a Condition on each Battle Page## --- IMPORTANT! ---# --- IMPORTANT! ---# --- IMPORTANT! ---## The Conditions that you put in to the Comment MUST be able to evaluate# to true / false!## What this means is that a Condition of var = 1 will run, but not evaluate# to true, so it wont ever be recognized as a valid condition. By placing# a Condition of "if var == 1" will return true, which makes it valid when# the proper conditions are met.## --- USAGE ---## Create a Condition by making a Comment ANYWHERE on a Battle Event Page# with "condition:" followed by your Scripted Condition in the Comment.## Example #1: ## @>Comment: condition: $foo == $bar## NOTE: Pay attention! I left off the word "if" from the Condition. It # works exactly the same way as Conditional Branch -> Script### Comment Conditions will run Eval for ALL of the contents for each Comment# all at once. This allows you to have a Multi Line Condition.## Example #2: ## @>Comment: condition: ($foo == $bar AND# $lorem == $ipsum)## NOTE: Parenthesis () are not required! You could also use && in place of# the word AND. If you Nest Conditions, you may need to use Parenthesis# ($foo == $bar AND $lorem == $ipsum) OR $game_party.actors[0].hp == 0### Comments run as Scripts just like a Script Event, so you can put anything# into the Script. Loops, Iterations, Create Variables, Self Switches, etc.## Example #3 ## @>Comment: condition: result = false# for actor in $game_party.actors# result = true if actor.weapon_id == 12# end# result == true### Each Comment Condition you add will add another Condition to check before# the Battle Event Page can be run. This allows you to add as many Conditions# as you want. THERE IS NO LIMIT. Each Comment Condition is considered as# its own Condition.## Example #4: ## @>Comment: condition: $game_party.actors[0].hp == $game_party.actors[0].maxhp# @>Comment: condition: $game_party.actors[0].id == 2## In the above example, BOTH Conditions MUST BE MET for the Battle Event Page# to be considered Valid and thus run.### You can use OR Statements inside of a single Comment Condition allowing for# greater flexibility of Battle Page Conditions.## Examle #5:## @>Comment: condition: $foo == $bar OR $lorem == $ipsum### ANY Sript Logic can be used provided it fits in the comment. Its all # evaluated the same way.## --- BATTLE EVENTING ---## Battle Eventing has a Menu for a few things already. Such as checking to# make sure a certain Switch is on before running the Battle Event Page. You# can now use a Comment Condition to check if a certain Switch is OFF before# running a Battle Event Page.## Battle Event also uses what is called SPAN.## SPAN controls when and how many times to run a Battle Event Page.## Span: Battle - Page runs ONCE per the entire Battle# Turn: Page runs ONCE per Turn, even if conditions are still met.# Moment: Runs when Conditions are met, and continues to run as long as# those conditions are met.## Comment Conditions are EXTREMELY USEFUL for allowing a Span Moment Page# to STOP RUNNING. It allows you to run the Page once. Like a specific# enemy has a State of "Immune to Fire", run some dialogue once, then# use some variable to set that the page has run already. You could use# a Switch, or even any other variable like @this_page_ran = true, and set# that as a Condition.## Example #6## @>Comment: condition: if $game_troop.enemies[0].states.include?(12)# @this_new_var_for_page_ran = true# else# unless @this_new_var_for_page_ran# @this_new_var_for_page_ran = false# end# end# @>Comment: condition: if @this_new_var_for_page_ran != true# @>Text: "Don't cast Fire on him! He is now Immune to Fire!"## --- COMMAND LIST ---## I'd like to make this as easy as possible for people to use. So to do that# these list of Commands should make adding Comment Conditions easier.## Example of Command:## - item_in_inventory?(item_id)# # @>Comment condition: # If Party has a Potion in their Inventory# if item_in_inventory(1)### Command List# - item_in_inventory?(item_id)### --- CHANGE LOG ---## Version 1.0: Monday, January 20th, 2014# - Initial Release## Version 1.1: Wednesday, Jauary 22nd, 2014# - Altered Logic: Evaulations MUST return TRUE to be considered valid# * Necessary because For Loops returned Arrays which caused incorrect Evals# If TRUE is not returned now, then it will be considered Invalid##-----------------------------------------------------------------------------class Scene_Battle #-------------------------------------------------------------------------- # * Battle Event Setup # # - Replacement for default XP Battle System setup_battle_event # - Any Script Conflicts would most likely come from this method #-------------------------------------------------------------------------- def setup_battle_event # If battle event is running if $game_system.battle_interpreter.running? return end # Search for all battle event pages for index in 0...$data_troops[@troop_id].pages.size # Get event pages page = $data_troops[@troop_id].pages[index] # Make event conditions possible for reference with c c = page.condition # New Code for checking extra Conditions in Comments of Battle Page page_condition_valid = has_battle_page_condition?(page) # This code is mostly default with the addition of "page_condition_valid" # Go to next page if no conditions are appointed unless c.turn_valid or c.enemy_valid or c.actor_valid or c.switch_valid or page_condition_valid next end # Default code # Go to next page if action has been completed if $game_temp.battle_event_flags[index] next end # Confirm turn conditions if c.turn_valid n = $game_temp.battle_turn a = c.turn_a b = c.turn_b if (b == 0 and n != a) or (b > 0 and (n < 1 or n < a or n % b != a % ) next end end # Confirm enemy conditions if c.enemy_valid enemy = $game_troop.enemies[c.enemy_index] if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp next end end # Confirm actor conditions if c.actor_valid actor = $game_actors[c.actor_id] if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp next end end # Confirm switch conditions if c.switch_valid if $game_switches[c.switch_id] == false next end end # This small block is also all that was added to the Default code # Confirm Page Condition (if Additional Page Condition exists) if page_condition_valid # If running the extra Page Condition returns false (which is default) if eval_page_conditions(page) == false # Go to next Battle Event Page if one exists and skip processing this next end end # The rest of the code in this method is Default # Set up event $game_system.battle_interpreter.setup(page.list, 0) # If this page span is [battle] or [turn] if page.span <= 1 # Set action completed flag $game_temp.battle_event_flags[index] = true end return end end #-------------------------------------------------------------------------- # * Has Page Condition (Comment Conditions I.E. "condition: (var1 == var2) # page : Battle Event Page # # This checks for the existence of any Page Conditions. It returns # true if it finds at least one condition, then stops. If any conditions # are in Comments, then it uses another method to check for ALL of the # conditions on the page passed in via the argument. # # This is NEW CODE and should not cause any Script Conflicts. # # Version 1.1 - Changed name for higher degree of compatability. #-------------------------------------------------------------------------- def has_battle_page_condition?(page) # For each Battle Event Command on this Battle Page for command in page.list # If Command is First Line of a Comment if command.code == 108 # Check each Commment if it has "condition:" as String command.parameters[0].gsub(/^condition:(.*)/i){$1} # found a Battle Condition in a Comment return true if $1 != nil end end # Default - No Valid Battle Page Conditions in Comment Commands found return false end #-------------------------------------------------------------------------- # * Eval Page Conditions # - Finds ALL Page Conditions in Comments, then Evaluates them # # NOTE: Conditions MUST be able to return a Value # $foo = "Bar" will not return anything, thus evals to nil (false) # $foo == "Bar" will return either True or False # # This code will check to enusre ALL of the Comment Conditions on a # Battle Event Page are met. If you have Two Conditions, both must # eval to True for an Event Page to be considered "valid". Each Comment # Condition is considered as a Separate Condition. Everything in the # Comment Box is evaluated all at once, so you can create temporary # variables, Loops, OR statements, etc as long as it is all contained # in ONE Comment. IE "if $foo == $bar OR actor_id == 2". Complex # scripts may adversely affect performance. # # This is NEW CODE and should not cause any Script Conflicts. # #-------------------------------------------------------------------------- def eval_page_conditions(page) # For each Battle Event Command on this Battle Page for i in 0...page.list.size # Get Command command = page.list # If Command is First Line of a Comment if command.code == 108 # Check each Commment if it has "condition:" as String command.parameters[0].gsub(/^condition:(.*)/i){$1} # If Battle Condition in a Comment if $1 != nil # Remember the Condition condition = $1 # Check for more lines in the Comment to Eval all at once while (page.list[i + 1] and page.list[i + 1].code == 408) # Advance Counter i += 1 # Add Next Line of Comment (code 408) to Condition to eval condition += "\n" + page.list.parameters[0] end # Run the Script (Improper Script Calls may Crash here) result = eval(condition) # Evaluate Page Conditions for EACH Comment if result == true # Remains True as long as ALL Comment Conditions are met passed = true else # If Any Conditions in Comments Eval to False then Page is False return false end end end end # If All Comment Conditions on this Page are met, this variable will exist return true if passed # Default return false end #--------------------------------------------------------------------------# # ** Custom Commands for Easy Checks for Conditional Switches # # # # ALL METHODS MUST RETURN TRUE OR FALSE # #--------------------------------------------------------------------------# #-------------------------------------------------------------------------- # * Item In Inventory # item_id : Item Id from Database # # Example: 1 is a Potion # # If Party has a Potion in the Inventory # item_in_inventory?(1) # # 2 is a High Potion # # If Party has a High Potion in the Inventory # item_in_inventory?(2) # # This is an Example Script. It could be accomplished by copying and # pasting the one "return true if ..." line of code. I provided this # because it makes it easy for us to script easier condition checks # for others that may use this script. #-------------------------------------------------------------------------- def item_in_inventory?(item_id) # If Item is in Inventry, return True return true if $game_party.item_number(item_id) > 0 # Default return false endend


This should help you out. It just needs a Page Condition where $game_troop.enemies[id].states.include?(state_id)

Id will be a Number, start at 0 for your first enemy, not 1

States will be the ID of your Buff.

It would look something like this:

Comment: condition: $game_troop.enemies[1].states.include?(12)

This may be a bit different for VXA (if this script above works), but also due to the ability to evaluate your Script as a Page Condition every single time, you can put in literally ANY condition in there.

If it doesnt work for VX/A, I dont own VXA so I wont be able to modify this script to be compatible, but someone will be able to do so, and you have my permission to modify the above script to be made compatible with VXA as so long as I am properly accredited as the original creator.

I don't really understand this. I tried to add this to a comment:

#  @>Comment:  condition:  if $game_troop.enemies[0].states.include?(12)

#                            @this_new_var_for_page_ran = true

#                          else

#                            unless @this_new_var_for_page_ran

#                              @this_new_var_for_page_ran = false

#                            end

#                          end

#  @>Comment:  condition:  if @this_new_var_for_page_ran != true

#  @>Text:  "Don't cast Fire on him!  He is now Immune to Fire!"

 

Refer to SS to see that the second end is cut off. I guess there is a max amount of lines you can do in a comment.

Untitled.png
 
Last edited by a moderator:

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
Still need assistance.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
Yes this one I've looked into as well. This has what I want, I just don't know the commands to use. Can you direct me to a command list?
I like the script suggested by Archeia as well, but it doesn't use command lists - it requires some scripting knowledge to set conditions and tables for the engine to choose a command. If you don't have at least some basic programming knowledge, that can't be explained in a few sentences.
------------------------------------------------


Artificial Intelligence is one of the most complex themes in programming, and NO ONE as of yet has gotten even near anything resembling a true AI.


Even the "simple" functions (only simple compared to full AI works) that are usually called an AI in game programming are not easy.


I've checked several AI scripts in the last months. I like the one from Mr. Trivel, as suggested by Archeia best so far, but even that requires me to put in one or two hours of learning it before I think I can use it - and I'm a professional programmer (equivalent of a master's degree in computer sciences).


If you don't have basic scripting knowledge, that one will be difficult to use for you.


If you really want to use a good AI, you'll either have to find a scripter to work with you on your database and the script AI settings, or you'll have to put in a few weeks of learning to get the basic understanding of scripting yourself.


Sorry, but that's the problem with any topic on AIs...
 
Last edited by a moderator:

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
I like the script suggested by Archeia as well, but it doesn't use command lists - it requires some scripting knowledge to set conditions and tables for the engine to choose a command. If you don't have at least some basic programming knowledge, that can't be explained in a few sentences.

------------------------------------------------

Artificial Intelligence is one of the most complex themes in programming, and NO ONE as of yet has gotten even near anything resembling a true AI.

Even the "simple" functions (only simple compared to full AI works) that are usually called an AI in game programming are not easy.

I've checked several AI scripts in the last months. I like the one from Mr. Trivel, as suggested by Archeia best so far, but even that requires me to put in one or two hours of learning it before I think I can use it - and I'm a professional programmer (equivalent of a master's degree in computer sciences).

If you don't have basic scripting knowledge, that one will be difficult to use for you.

If you really want to use a good AI, you'll either have to find a scripter to work with you on your database and the script AI settings, or you'll have to put in a few weeks of learning to get the basic understanding of scripting yourself.

Sorry, but that's the problem with any topic on AIs...
Ya I like that one as well, but I don't understand it. I have a associates in programming, but I don't understand/know Ruby yet. It's complicated on setting it up.

if you want more control, but also more things to config, you can try to use my Ruby Enemy Action Selection script... https://lescripts.wordpress.com/rgss3/ruby-enemy-acts/
Thanks. I like this, it's easy to setup conditions for skills. Can you direct me to a page where I can see ALL of the conditions I can put in? IE if self.hp > 50. The self.hp part. 
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
There's no page for that because the conditions that you can use are anything that is a valid RGSS3 line... So you will need to learn what things you can use from RGSS3...
 
Last edited by a moderator:

Zero0018

Apprentice
Member
Joined
Dec 24, 2014
Messages
133
Reaction score
1
First Language
English
Primarily Uses
There's no page for that because the conditions that you can use are anything that is a valid RGSS3 line... So you will need to learn what things you can use from RGSS3...
Ok. Where can I get a list of what's valid?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Learn RGSS3... There's no list because what's valid or not is basically a matter of logic... It's like asking which is a valid RGSS3 (or any other programming language) code... Which as long as the syntax is correct and your logic flow is correct, it will be valid.

For simple battler based mechanics, you will simply be using their parameters (.atk, .def, .hp and so on), for others, you would probably be checking the default scripts or any custom script that you add which have things that you could use as conditions.

So ultimately, you'd want to learn RGSS3 and how to write RGSS3 codes
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
Artificial Intelligence is one of the most complex themes in programming, and NO ONE as of yet has gotten even near anything resembling a true AI.

Even the "simple" functions (only simple compared to full AI works) that are usually called an AI in game programming are not easy.
For game developers having the appearance of AI is way more important than what you actually have under the hood. AI in gaming usually affects the gameplay in a very direct manner.

I highly suggest to read up on understanding Pac-Man ghost behavior. It illustrates my point nicely.

Should you be interested in AI for game development I can recommend the following site: http://aigamedev.com/

*hugs*

 - Zeriab
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
534
First Language
English
Primarily Uses
N/A
I highly suggest to read up on understanding Pac-Man ghost behavior. It illustrates my point nicely.
Reading this makes me wonder how to program the behavior of enemies on the map

I mean more then jus "Approch Player", "Random", set path or... uh, i think it's avoid player, but i'm not certain
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,574
Latest member
nikisknight
Top