+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Help with Computer controlled actors and AIBC (/thread-4723.html)
RE: Help with Computer controlled actors and AIBC - ZeroSum - 07-08-2013
Aah, I see. I tried that when I first read your new suggestion, but I wasn't sure thats what you meant.
Tested it some more now with the replaced code, in several script positions, but alas I get the same results.
AIBC makes use of an external BattleCommands file in the data folder of the RMXP project, could any tinkering there be of use?
BattleCommands
Code:
#This text is not parsed by the script
#Remember Here Are the Default Values
#
#id Must be declared
#name Must be declared
#name_set [[]]
#kind Must be declared
#type 0
#rating 10
#icon_name ''
#skill_id 0
#common_event_id 0
#animation_id 0
#weapon_ids []
#armor_ids []
#ammo {}
#ammo_refill {}
#skill_set ''
#skills []
#class_level {}
#actor_level {}
#description ''
#help_text ''
#special_learn 'false'
#hidden false
#script ''
#next_method phase3_next_actor
#
#
#
#
# 1) Id - Required
# The command's id
# syntax: Integer id
#
# 2) Name - Required
# The command's name
# Syntax: String name - name of the command (don't enclose in '' or "")
#
# 3) Name Set
# The command's other names
# How you define the names determines the priority of the name chosen
# example
# [['actor', {1 => 'Smile', 2 => 'Frown'}], ['class', {1 => 'Anger'}]]
# Now here are the heros
# Actor id 1 class 1 resulting name Smile
# Actor id 2 class 1 resulting name Frown
# Actor id 1 class 2 resulting name Anger
# Actor id 3 class 1 resulting name Anger
# Actor id 3 class 4 resulting name Default Name
# Actor id 2 class 2 Resulting name Frown
#
# parameters can include actor, class, weapon, shield, helmet, body, accessory, and level
# Syntax: A Hash setup like so {parameter => value}
#
# 3) Kind - Required
# The command's kind
# 0: Basic Action (see type) 1: Skill 2: Item
# Syntax: Integer kind - the commands kind
#
# 4) Type
# The command's type
# 0: Attack, 1: Defend 2: Escape (Enemies) 3: Do Nothing
# Syntax: Integer type - the commands type
#
# 5) Rating
# The command's rating higher rated commands will appear on the top
# if the ratings are the same then the id is compared and lower ids have higher priority
# Syntax: Integer rating - the command's rating
#
# 6) Icon Name
# The command's icon name from Graphics/Icons
# Syntax: String icon_name - the commands icon name
#
# 7) Skill Id
# The command's skill id
# Syntax: Integer skill_id - the skill id executed when using this command
#
# 8) Common Event Id
# The command's common event id
# Syntax: Integer common_event_id - the common event executed when using this command
#
# 9) Animation Id
# The command's animation id
# For custom commands set this to the animation id to be played when using the command
# Syntax: Integer animation id
#
# 10) Weapon Ids
# Weapon Ids that this command is tagged to must be an array
# Syntax: Array of Weapon ids
#
# 11) Armor Ids
# The armor ids same as weapon ids
# Syntax: Array of Armor ids
#
# 12) Skill Set
# The skill set for use in categorizing the skill list
# for example all fire skills will be skill.element_set.include?(1)
# You may also use this to work for items
# Syntax: String - condition evaluated
#
# 13) Skills - Advanced
# The usable skill list see Below for more stuff on this
#
# 14) Ammo
# Flag determining whether the command has ammo or not
# For Command Sp depending on a value then use {'sp' => maximum sp}
# For command Sp depending on an item then use {'item' => item_id}
# Syntax: Hash set up like above
#
# 15) Ammo Refill
# Flags determining when the commands sp refills (only for sp depending on an value)
# Current Flags are the following (add as many to the hash as you want):
# 'defend' => [amount, percentage] - Refills when defending
# 'wait' => [amount, percentage] - Refills when waiting
# 'full_heal' => [amount, percentage] - Refills with Recover All Event Command
# 'battle' => [amount, percentage] - Refills at the end of battle
# 'level_up' => [amount, percentage] - Refills at level up
# 'turns' => [amount, percentage, a, b, ...] - Refills on turn a, b, and on if defined
# 'turn' => [amount, percentage, a, b] - Refills on turn a + bx
# 'skill' => {id => [amount, percentage]} - Refills if skill id id was used (and successful)
# 'item' => {id => [amount, percentage]} - Refills if item id id was used (and successful)
# Syntax: Hash set up like above
#
#
# 16) Class Level
# The class level set must be a hash set up like this {class_id => level, class2_id =>level2, ...}
# Syntax: Hash
#
# 17) Actor Level
# The actor level set same as above except {actor_id => level, actor2_id => level2, ...}
# Syntax: Hash
#
# 18) Description
# The Description of the command
# Syntax: String - Description of the command (do not enclose in "" or '')
#
# 19) Help Text
# The Help Window Text Displayed when using the command
# Syntax: String - Help Widnow Text displayed (do not enclose in "" or '')
#
# 20) Special Learn
# The special condition must be a boolean expression
# for example if you want the Arshes to learn this in battle while he has less than 100 hp
# then the condition will be (actor.id == 1 and actor.hp <= 100)
# Syntax: String - script condition to be evaluated
#
# 21) Hidden
# if the command is hidden set this to true
# Syntax: Boolean - true if hidden false if not (Default is false)
#
# 22) Script - Advanced
# Enter a script here separating lines by using a semicolon ( ; )
# you may replace @active_battler with just actor
# example heal 100 sp when using the command is actor.sp += 100; actor.damage = -100; actor.damage_pop = true; @status_window.refresh
# Syntax: String - script condition to be evaluated
#
# 23) Next Method
# The next method called after selecting the command
# Syntax: String - next method to be evaluated
#
#
#The Skills Parameter
#You may enter a string, an array, or a hash here
#
#Array
#This array contains all of the skill ids the command can use great for if you want certain skills for a command
#
#String
#Example skill.element_set.include?(1) will make the command contain all fire skills
#the string holds a condition that is passed through each skill if true then the skill will be on the list
#
#Hash
#a bit more complicated but alot more powerful
# Integer value case 1 { skill.id => value, skill.id => value}
# in this case value is the minimum level required to use the skill
#
# Array for value case 2 {skill.id => [v1,v2]}
# in this case v1 is the minumum level required to use the skill and v2 is the actor id that can use the skill
#
# String for value case 3 {skill.id => "condition"}
# in this case the string condition is evaluated and if true then the skill can be used for more advanced effects
#--------------------------------------------------------------------------
# * Command Id 1 : Attack
# Description : Just the normal attack command, nothing else
#--------------------------------------------------------------------------
id 1
name Attack
kind 0
rating 4
next_method start_enemy_select
#--------------------------------------------------------------------------
# * Command Id 2 : Skill
# Description : Just the normal skill command, nothing else
#--------------------------------------------------------------------------
id 2
name Skill
kind 1
rating 5
next_method start_skill_select
#--------------------------------------------------------------------------
# * Command Id 3 : Defend
# Description : Just the normal defend command, nothing else
#--------------------------------------------------------------------------
id 3
name Defend
kind 0
type 1
rating 7
#--------------------------------------------------------------------------
# * Command Id 4 : Item
# Description : Just the normal item command, nothing else
#--------------------------------------------------------------------------
id 4
name Item
kind 2
next_method start_item_select
#--------------------------------------------------------------------------
# * Command Id 5 : Regenerate
# Description : This command regenerates some hp, It has help text and
# Displays an animation the type being set to 3 is there to
# do a "Do Nothing" Action
#--------------------------------------------------------------------------
id 5
name Regenerate
kind 0
type 3
rating 6
help_text Regenerate
animation_id 16
script hp = (actor.maxhp - actor.hp) / 15; actor.hp += hp; actor.damage = -hp; actor.damage_pop = true; @status_window.refresh
#--------------------------------------------------------------------------
# * Command Id 6 : Will
# Description : This command regenerates some sp, It has help text and
# Displays an animation the type being set to 3 is there to
# do a "Do Nothing" Action
#--------------------------------------------------------------------------
id 6
name Will
kind 0
type 3
help_text Will
animation_id 18
script sp = rand(actor.maxsp / 15 + 1) + 5; actor.sp += sp; actor.damage = -sp; actor.damage_pop = true; @status_window.refresh
#--------------------------------------------------------------------------
# * Command Id 7 : Holy
# Description : This command comes with the skills Light, Greater Light
# and Mass Light. Three uses only.
#--------------------------------------------------------------------------
id 7
name Holy
kind 1
skills {25 => 1, 26 => 2, 27 => 3}
ammo {'sp' => 3}
next_method start_skill_select
#--------------------------------------------------------------------------
# * Command Id 8 : Elemental
# Description : This command comes with all skills that have Fire,
# Water, or Thunder element. This also uses a method
# From the Method and class Library called includes_any?
# Which returns true if any of the values sent is included
# Six Uses, and refills one if you defend.
#--------------------------------------------------------------------------
id 8
name Elemental
kind 1
skills skill.element_set.includes_any?(1,3,4)
ammo {'sp' => 6}
ammo_refill {'defend' => [1,0]}
next_method start_skill_select
#--------------------------------------------------------------------------
# * Command Id 9 : Paralyze
# Description : This Command Comes with the item Ring of Thunder
# It calls the skill Mass Paralyze when used
#--------------------------------------------------------------------------
id 9
name Paralyze
kind 1
skill_id 44
armor_ids [31]
#--------------------------------------------------------------------------
# * Command Id 10 : Fire Starter
# Description : This Command Just Displays the Fire Skills the actor
# knows
#--------------------------------------------------------------------------
id 10
name Fire Starter
kind 1
skill_set skill.element_set.include?(1)
next_method start_skill_select
#--------------------------------------------------------------------------
# * Command Id 11 : Full Healing
# Description : This Command Appears Randomly in Gloria's Commands
# This command recovers all health and has a 10% chance
# of appearing
#--------------------------------------------------------------------------
id 11
name Full Healing
kind 0
type 3
special_learn actor.id == 7 && rand(100) < 10
script actor.recover_all
help_text Full Healing
animation_id 22
#--------------------------------------------------------------------------
# * Command Id 12 : Skill w/ Name Set
# Description : Just the normal skill command, nothing else
#--------------------------------------------------------------------------
id 12
name Skill
name_set [['actor', {8 => 'Magic'}], ['class', {1 => 'Techniques', 7 => 'Healing', 8 => 'Black Magic'}]]
kind 1
next_method start_skill_select
RE: Help with Computer controlled actors and AIBC - MechanicalPen - 07-11-2013
Well if that didn't work, I am stumped...
RE: Help with Computer controlled actors and AIBC - Ryaryu - 08-14-2013
I don't know if you've freed yourself from this error, but if not, then do this, please:
1. Save your Main script in a file (copy the text and paste in a separated file, save it).
2. Replace your Main script (in RMXP) for this code:
Code:
begin
$defaultfonttype = $fontface = $fontname = Font.default_name = "Arial"
$defaultfontsize = $fontsize = Font.default_size = 22
Graphics.freeze
$scene = Scene_Title.new
while $scene != nil
$scene.main
end
Graphics.transition(20)
rescue Errno::ENOENT
filename = $!.message.sub("Arquivo não encontrado - ", "")
print("O Arquivo #{filename} não foi encontrado.")
rescue StandardError => stderr
p "Your error message here. See Instructions for more details."
if $DEBUG
p stderr.message
end
time = Time.now
time = time.strftime("%a %d %b %Y, %X")
File.open("ErrorLog.rxdata","a+") do |fh|
fh.puts("Time: #{time}")
fh.puts("Error type: #{stderr.class}")
fh.puts("Class: #{$scene.class}")
fh.puts("Message: #{stderr.message}")
fh.puts("at")
for location in stderr.backtrace
section = location[/(?#Section)(\d)*(:)/]
section_err = section[0, section.length - 1]
script_name = $RGSS_SCRIPTS[section_err.to_i][1]
line_num = location[/(:)(\d)*(\Z|(:))/]
line_num_err = line_num[1, line_num.length - 1]
line_num_err = line_num_err[/(\d)*/]
method = location[/\s\W(\w)*\W/]
method = method[1, method.length - 1] unless method == nil
loc_err = script_name + ", line " + line_num_err +
(method == nil ? "" : ", at " + method)
fh.puts(" #{loc_err}")
end
fh.puts("--------------------")
end
end
3. Play your game until you get the mentioned error.
4. In your game's folder, there will be a file named ErrorLog.rxdata. Open it with a text editor, copy the contents and paste them here.
5. Restore your Main script.