how do i script so that you need to press 2 buttons before an action is done?
the part i'm modifying:
[spoiler]
if Input.repeat?(Input::RIGHT) && !@commander.target_all && !@all
if @target_actors
cursor_up if $back_attack
cursor_down unless $back_attack
else
cursor_down if $back_attack
cursor_up unless $back_attack
end
[/spoiler]
Input::RIGHT doesn't work for as far as i know it should be just Input::R but it's already used for an other action
so i need it to be so that you need to press a button at the same time:
like you hold a button and then you press one other to do the action .
i hope you get what i'm asking, plz let me know if there are questions.
the script it self:
[spoiler]
=begin
================================================================================
Targetting Extended v 1.1
by CrimsonSeas
================================================================================
This is a script I made to extend targettting capabilities.
Features:
+Target any allies or enemies with any action. You can choose to blow your team
mate or heal your enemies by pressing L/R button at target selection.
+Press shift at target selection to change single target skills and items to
target all.
+Define which skills both feature apply or not apply to.
+Cursors!! Multiple cursors over all targets when targeting multiple targets
+Can also divide damage among all targets when switching from single to all target
================================================================================
Compatibility
================================================================================
I think there may be many issues around this. I'll list rewrites and aliases of
default and Tankentai scripts.
Rewrites:
+Game_Battler
-make_attack_targets
-make_obj_targets
+Sprite_Battler
-moving_anime
Aliases:
+Scene_Battle
-execute_action
+Game_Battler
-make_obj_damage_value
-calc_mp_cost
=================================================================================
CONFIG
================================================================================
=end
module TargetExt
#Defines whether you can attack ally or not.
ATTACK_ANY = true
#Defines skill IDs that the 'Target Any' feature doesn't apply.
NO_TARGET_ANY_S = []
#Defines item IDs that the 'Target Any' feature doesn't apply/
NO_TARGET_ANY_I = []#[2]
#Defines skill IDs that the 'Target All' feature apply.
TARGET_ALL_S = []#[59, 63]
#Defines item IDs that the 'Target All'feature apply.
TARGET_ALL_I = [1]
#Defines damage percentage when changing target from single to all
DAMAGE_PERCENT = 66
#Defines MP percentage when changing target from single to all
MP_PERCENT = 200
#Defines vocabulary to be used when targetting multiple targets.
#Format is: [String1, [StringParty, StringEnemies]]
#Text shown on help window when targetting party:
# String1 StringParty
#Text shown on help wondow when targetting enemies:
# String1 StringEnemies
TARGET_ALL_VOC = ["Target All", ["Allies", "Enemies"]]
#Show MP cost when 'Target All' feature is being used
SHOW_MP_ALTER = true
#Divides damage among all targets when switching from single target to all target
DAMAGE_DIVIDE = true
end
class Game_Battler
def target_all
if @target_all == nil
@target_all = false
end
return @target_all
end
def inverse_target
if @inverse_target == nil
@inverse_target = false
end
return @inverse_target
end
def target_all=(target_all)
@target_all = target_all
end
def inverse_target=(inverse_target)
@inverse_target = inverse_target
end
end
module RPG
class Skill
def all_available
return TargetExt::TARGET_ALL_S.include?(@id)
end
end
class Item
def all_available
return TargetExt::TARGET_ALL_I.include?(@id)
end
end
class UsableItem
def need_selection?
return !(@scope == 11 || @scope == 0)
end
end
end
class Scene_Battle
alias crmsn_end_target end_target_selection
def end_target_selection(*args)
if @cursor2 != nil
dispose_cursor_all
end
crmsn_end_target(*args)
end
def cursor_all_visible(value)
for cursor in @cursor2
cursor.visible = value
end
end
def dispose_cursor_all
return if @cursor2 == nil
for cursor in @cursor2
cursor.dispose
cursor = nil
end
@cursor2 = nil
end
alias targetext_execute_action execute_action
def execute_action
targetext_execute_action
@active_battler.target_all = false
@active_battler.inverse_target = false
end
end
class Game_BattleAction
def make_attack_targets
targets = []
if battler.confusion?
targets.push(friends_unit.random_target)
elsif battler.berserker?
targets.push(opponents_unit.random_target)
else
targets.push(opponents_unit.smooth_target(@target_index)) unless battler.inverse_target
targets.push(friends_unit.smooth_target(@target_index)) if battler.inverse_target
end
if battler.dual_attack # Chain attack
targets += targets
end
return targets.compact
end
#--------------------------------------------------------------------------
# * Create Skill or Item Targets
# obj : Skill or item
#--------------------------------------------------------------------------
def make_obj_targets(obj)
targets = []
if obj.for_opponent?
if obj.for_random?
if obj.for_one? # One random enemy
number_of_targets = 1
elsif obj.for_two? # Two random enemies
number_of_targets = 2
else # Three random enemies
number_of_targets = 3
end
number_of_targets.times do
targets.push(opponents_unit.random_target) unless battler.inverse_target
targets.push(friends_unit.random_target) if battler.inverse_target
end
elsif obj.dual? # One enemy, dual
targets.push(opponents_unit.smooth_target(@target_index)) unless battler.inverse_target
targets.push(friends_unit.smooth_target(@target_index)) if battler.inverse_target
targets += targets
elsif obj.for_one?
if obj.all_available && battler.target_all
targets += opponents_unit.existing_members unless battler.inverse_target
targets += friends_unit.existing_members if battler.inverse_target
else
targets.push(opponents_unit.smooth_target(@target_index)) unless battler.inverse_target
targets.push(friends_unit.smooth_target(@target_index)) if battler.inverse_target
end
else # All enemies
targets += opponents_unit.existing_members unless battler.inverse_target
targets += friends_unit.existing_members if battler.inverse_target
end
elsif obj.for_user? # User
targets.push(battler)
elsif obj.for_dead_friend?
if obj.for_one? # One ally (incapacitated)
targets.push(friends_unit.smooth_dead_target(@target_index)) unless battler.inverse_target
targets.push(opponents_unit.smooth_target(@target_index)) if battler.inverse_target
else # All allies (incapacitated)
targets += friends_unit.dead_members unless battler.inverse_target
targets += opponents_unit.existing_members if battler.inverse_target
end
elsif obj.for_friend?
if obj.for_one? # One ally
if obj.all_available && battler.target_all
targets += friends_unit.existing_members unless battler.inverse_target
targets += opponents_unit.existing_members if battler.inverse_target
else
targets.push(friends_unit.smooth_target(@target_index)) unless battler.inverse_target
targets.push(opponents_unit.smooth_target(@target_index)) if battler.inverse_target
end
else # All allies
targets += friends_unit.existing_members unless battler.inverse_target
targets += opponents_unit.existing_members if battler.inverse_target
end
end
return targets.compact
end
end
class Sprite_Battler
def moving_anime
# ???‰???,??ƒ‹?ƒ??›??—?Œ?‹???,,?,‹??,‰?ˆ??œŸ?Œ–
@move_anime.action_reset if @anime_moving
@anime_moving = true
# ?ƒ??ƒƒ?,??,??,??ƒƒ?,????,??ƒ‹?ƒ??€???™??"??ƒ???
mirror = false
mirror = true if $back_attack
# ?,??ƒ‹?ƒ?ID
id = @active_action[1]
# ??
target = @active_action[2]
x = y = mem = 0
# ???Œ?˜?"???ˆ
if target == 0
# ?,??ƒ??,??ƒƒ?ƒˆ?Œ??????,,??ˆ?€??‡????‰?›
if @target_battler == nil
x = self.x
y = self.y
else
# ?,??ƒ??,??ƒƒ?ƒˆ?Œ????ˆ?€??‡????‰?›
if @target_battler[0] == nil
x = self.x
y = self.y
else
# ?œ€?ˆ???...????,,?,‹?,??ƒ??,??ƒƒ?ƒˆ?????š
x = @target_battler[0].position_x
y = @target_battler[0].position_y
end
end
# ???Œ?•????ƒ???ˆ
elsif target == 1
# ?‡???Œ?,??,??,??ƒ????ˆ??,??ƒ??ƒŸ?ƒ????ƒ?,'?ˆ?—
if (@battler.is_a?(Game_Actor) && !@battler.inverse_target)
for target in $game_troop.members
bitmap = Cache.battler(target.battler_name, target.battler_hue)
ox = bitmap.width/2
oy = bitmap.height/2
x += target.position_x + ox
y += target.position_y + oy
mem += 1
end
x /= mem
y /= mem
# ?‡???Œ?,??ƒ??ƒŸ?ƒ????ˆ??,??,??,??ƒ????ƒ?,'?ˆ?—
else
for target in $game_party.members
ox = 16
oy = 16
x += target.position_x + ox
y += target.position_y + oy
mem += 1
end
x /= mem
y /= mem
end
# ???Œ?'??–????ƒ???ˆ
elsif target == 2
# ?‡???Œ?,??,??,??ƒ????ˆ??,??,??,??ƒ????ƒ?,'?ˆ?—
if @battler.is_a?(Game_Actor)
for target in $game_party.members
x += target.position_x
y += target.position_y
mem += 1
end
x = x / mem
y = y / mem
# ?‡???Œ?,??ƒ??ƒŸ?ƒ????ˆ??,??ƒ??ƒŸ?ƒ????ƒ?,'?ˆ?—
else
for target in $game_troop.members
x += target.position_x
y += target.position_y
mem += 1
end
x = x / mem
y = y / mem
end
# ???Œ?‡?????ˆ
else
x = self.x
y = self.y
end
# ?–‹?‹??????•?
plus_x = @active_action[6]
plus_y = @active_action[7]
# ?,??ƒ??ƒŸ?ƒ??X??,'?€†?
plus_x *= -1 if @battler.is_a?(Game_Enemy)
# ?œ€?,?š,,???‹•??›??,'?—?‡?
distanse_x = x - self.x - plus_x
distanse_y = y - self.y - plus_y
# ?›??—?,??,??ƒ—
type = @active_action[3]
# ?€Ÿ?
speed = @active_action[4]
# ?Œ?"
orbit = @active_action[5]
# ?‡???Œ?–‹?‹????,‰
if @active_action[8] == 0
@move_anime.base_x = self.x + plus_x
@move_anime.base_y = self.y + plus_y
# ???Œ?–‹?‹????,‰
elsif @active_action[8] == 1
@move_anime.base_x = x + plus_x
@move_anime.base_y = y + plus_y
# ??›??,'???
distanse_y = distanse_y * -1
distanse_x = distanse_x * -1
# ?‹•?‹?•??,,??,‰
else
@move_anime.base_x = x
@move_anime.base_y = y
distanse_x = distanse_y = 0
end
# ??™??,??,??,??ƒ??ƒ???—???™????—??,,
if @active_action[10] == ""
weapon = ""
# ?,??ƒ‹?ƒ???—?,??ƒ??ƒŸ?ƒ????™????—??,,
elsif @anime_flug != true
weapon = ""
# ??™??,??,??,??ƒ??ƒ??Œ?,?,‹??ˆ
else
# ?›??™??™??,??ƒ??ƒ•?,??ƒƒ?,??Œ?Œ‡?š?•?,Œ??,,?,‹?‹?ƒ??,??ƒƒ?,?
if @battler.is_a?(Game_Actor)
battler = $game_party.members[@battler.index]
weapon_id = battler.weapon_id
else
battler = $game_troop.members[@battler.index]
weapon_id = battler.weapon
end
# ?,??,??ƒ??"??ƒ??ˆ??"??‹??™??"??ƒ??ˆ??"??‹?ˆ??ˆ?
weapon_act = N01::ANIME[@active_action[10]].dup if @active_action[10] != ""
# ??™??"??ƒ??ˆ??"????‰‹???'?,Œ?
if weapon_id != 0 && weapon_act.size == 3
weapon_file = $data_weapons[weapon_id].flying_graphic
# ?ˆ??"??ƒ??Œ?Œ‡?š?•?,Œ??,,??'?,Œ??—??˜???™??,??ƒ??ƒ•?,??ƒƒ?,??,'?–?—
if weapon_file == ""
weapon_name = $data_weapons[weapon_id].graphic
icon_weapon = false
# ?•?,‰??Œ‡?š?Œ??'?,Œ??,??,??,??ƒ??,??ƒ??ƒ•?,??ƒƒ?,??,'?ˆ??"?
if weapon_name == ""
weapon_name = $data_weapons[weapon_id].icon_index
icon_weapon = true
end
# ?Œ‡?š?•?,Œ??,,?,Œ????,??ƒ??ƒ•?,??ƒƒ?,???,'?–?—
else
icon_weapon = false
weapon_name = weapon_file
end
# ??™??,??,??,??ƒ??ƒ??ƒ...??,'?–?—
weapon = @active_action[10]
# ??™??"??ƒ??ˆ??"????‰‹??,‰???—??,,
elsif weapon_act.size == 3
weapon = ""
# ?,??,??ƒ??"??ƒ??ˆ??"?
elsif weapon_act != nil && @battler.action.skill != nil
icon_weapon = false
weapon_name = $data_skills[@battler.action.skill.id].flying_graphic
weapon = @active_action[10]
end
end
# Z??™?,'??š
@move_anime.z = 1
@move_anime.z = 1000 if @active_action[9]
# ??Š??ƒ...??,'?...???,??ƒ‹?ƒ??›??—?,??ƒ—?ƒ??,??ƒˆ??€??,‹
@move_anime.anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,weapon_name,icon_weapon)
end
end
class Game_Battler
alias targetext_make_obj_dmg make_obj_damage_value
def make_obj_damage_value(user, obj)
targetext_make_obj_dmg(user, obj)
if user.target_all && obj.all_available
if @hp_damage != 0
@hp_damage *= TargetExt::DAMAGE_PERCENT
@hp_damage /= 100
@hp_damage /= user.action.make_targets.size if TargetExt::DAMAGE_DIVIDE && user.target_all
end
if @mp_damage != 0
@mp_damage *= TargetExt::DAMAGE_PERCENT
@mp_damage /= 100
@mp_damage /= user.make_targets.size if TargetExt::DAMAGE_DIVIDE && user.target_all
end
end
end
alias targetext_calc_mp_cost calc_mp_cost
def calc_mp_cost(skill)
cost = targetext_calc_mp_cost(skill)
if self.target_all && skill.all_available
cost *= TargetExt::MP_PERCENT
cost /= 100
end
return cost
end
end
[/spoiler]
part 2
[spoiler]=begin
################################################################################
Targetting Extended for Tankentai ATB v1.1
by CrimsonSeas
###############################################################################
Use this with the base script to enable Targetting Extended
This Tankentai ATB adds to the rewrites list of the base script
Rewrites:
+Scene_Battle
-start_target_actor_selection
-update_target
+Window_Help
-set_text_n02add
################################################################################
=end
class Scene_Battle
def start_target_selection(actor = false)
$in_target = true
$in_command = $in_select = false
if @commander.action.kind == 1
obj = @commander.action.skill
elsif @commander.action.kind == 2
obj = @commander.action.item
end
case obj
when nil
@target_any = TargetExt::ATTACK_ANY
when RPG::Skill
@target_any = !TargetExt::NO_TARGET_ANY_S.include?(@commander.action.skill.id)
when RPG::Item
@target_any = !TargetExt::NO_TARGET_ANY_I.include?(@commander.action.item.id)
end
@all = false
@all = [2, 4, 5, 6, 8, 10].include?(obj.scope) || obj.extension.include?("TARGETALL") if obj != nil
@target_actors = actor
@target_members = $game_party.members if @target_actors && !obj.extension.include?("TARGETALL")
@target_members = $game_troop.members unless @target_actors && ! obj.extension.include?("TARGETALL")
@target_members = $game_troop.members + $game_party.members if obj != nil && obj.extension.include?("TARGETALL")
# ????,??,??ƒ??ƒ‰?,??,'?ˆ?™
@actor_command_window.active = false
@skill_window.visible = false if @skill_window != nil
@item_window.visible = false if @item_window != nil
# ?˜?œ??—??,,?,‹?,??ƒ??,??ƒƒ?ƒˆ??œ€?,,?•????Ž?,,???,'?œ€?ˆ???Œ‡?™?,ˆ?†?
@index = 0
@max_index = @target_members.size - 1
# ?,??,??,??ƒ???ˆ??—˜??ƒ??€...??,,?,??ƒ??,??ƒƒ?ƒˆ???,‹?,ˆ?†??,??ƒ??ƒŸ?ƒ?? ?Œ??ˆ?
unless @target_actors
@target_members.size.times do
break if @target_members[@index].exist?
@index += 1
end
end
# ?,??ƒ??,??ƒ??,??ƒƒ?ƒˆ
@cursor.visible = true unless @all
@cursor.visible = false if @all
if @all
make_cursor_all
end
@cursor.set(@target_members[@index]) unless @all
@help_window.visible = false if @help_window != nil
@help_window2 = Window_Help.new if @help_window2 == nil
@help_window2.set_text_n02add(@target_members[@index]) unless @all
if @all
string1 = TargetExt::TARGET_ALL_VOC[0]
string2 = actor ? TargetExt::TARGET_ALL_VOC[1][0] : TargetExt::TARGET_ALL_VOC[1][1]
string1 += " " + string2 unless obj.extension.include?("TARGETALL")
@help_window2.set_text(string1, 1)
end
end
def update_target
# ?,??ƒž?ƒ??ƒ‰?...??Š›???,‹?Š??...‹?????,Œ??,??ƒ??ƒ??,??ƒ?
if @cursor2 != nil
if !@target_actors && (@all || @commander.target_all) && @cursor2.size != $game_troop.existing_members.size
dispose_cursor_all
make_cursor_all
end
for cursor in @cursor2
cursor.update if cursor.visible
end
end
return reset_command unless commanding?
return end_target_selection(cansel = true) if $game_troop.all_dead?
if @index >= @target_members.size
@index = 0
end
cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist? && !@commander.target_all && !@all
if Input.trigger?(Input::B)
Input.update
@commander.target_all = false
@commander.inverse_target = false
Sound.play_cancel
end_target_selection(cansel = true)
dispose_cursor_all if @cursor2 != nil
elsif Input.trigger?(Input::C)
Input.update
Sound.play_decision
@commander.action.target_index = @index unless @commander.target_all || @all
end_target_selection
end_skill_selection
end_item_selection
@actor_command_window.active = false
dispose_cursor_all if @cursor2 != nil
next_actor
end
if Input.repeat?(Input::Y) && !@commander.target_all && !@all #(Input::LEFT)
if @target_actors
cursor_down if $back_attack
cursor_up unless $back_attack
else
cursor_up if $back_attack
cursor_down unless $back_attack
end
end
if Input.repeat?(Input::Z) && !@commander.target_all && !@all #(Input::RIGHT)
if @target_actors
cursor_up if $back_attack
cursor_down unless $back_attack
else
cursor_down if $back_attack
cursor_up unless $back_attack
end
end
if @commander != nil && @commander.action.kind == 1
obj = @commander.action.skill
elsif @commader != nil && @commander.action.kind == 2
obj = @commander.action.item
end
if Input.trigger?(Input::X) && !@all && obj != nil #X=A
if obj.all_available
Sound.play_cursor
if @commander.target_all
@commander.target_all = false
@cursor.visible = true
dispose_cursor_all if @cursor2 != nil
@help_window2.set_text_n02add(@target_members[@index])
else
@commander.target_all = true
@cursor.visible = false
make_cursor_all if @cursor2 == nil
cursor_all_visible(true)
string1 = TargetExt::TARGET_ALL_VOC[0]
string2 = @target_actors ? TargetExt::TARGET_ALL_VOC[1][0] : TargetExt::TARGET_ALL_VOC[1][1]
string1 += " " + string2 unless obj.extension.include?("TARGETALL")
if TargetExt::SHOW_MP_ALTER && @commander.target_all && obj.is_a?(RPG::Skill)
cost = @commander.calc_mp_cost(obj)
string1 += ": " + cost.to_s + Vocab::mp
end
@help_window2.set_text(string1 , 1)
end
end
end
if (Input.trigger?(Input::L) || Input.trigger?(Input::R)) && @target_any
if @target_actors
@target_actors = false
@target_members = $game_troop.members
else
@target_actors = true
@target_members = $game_party.members
end
@index = 0 if @index >= @target_members.size
unless @target_actors
@target_members.size.times do
break if @target_members[@index].exist?
@index += 1
end
end
if @commander.inverse_target
@commander.inverse_target = false
else
@commander.inverse_target = true
end
if @cursor2 != nil
dispose_cursor_all
make_cursor_all
cursor_all_visible(!@cursor.visible)
end
if @commander.target_all || @all
string1 = TargetExt::TARGET_ALL_VOC[0]
string2 = @target_actors ? TargetExt::TARGET_ALL_VOC[1][0] : TargetExt::TARGET_ALL_VOC[1][1]
strings = string1 + " " + string2
if TargetExt::SHOW_MP_ALTER && @commander.target_all && obj.is_a?(RPG::Skill)
cost = @commander.calc_mp_cost(obj)
strings += ": " + cost.to_s + Vocab::mp
end
@help_window2.set_text(strings , 1)
end
@cursor.set_battler_start(@target_members[@index]) if @cursor.visible
@cursor.set(@target_members[@index])
@cursor.visible = !@all && !@commander.target_all
@help_window2.set_text_n02add(@target_members[@index]) if !@commander.target_all && !@all
end
cursor_up if Input.repeat?(Input::UP) && !@commander.target_all && !@all
cursor_down if Input.repeat?(Input::DOWN) && !@commander.target_all && !@all
end
def make_cursor_all
@cursor2 = []
for i in 0...@target_members.size
next if @target_members == $game_troop.members && !@target_members.exist?
@cursor2 = Sprite_Cursor.new
@cursor2.set_area(@target_members == $game_party.members)
@cursor2.set(@target_members)
end
@cursor2.compact!
end
end
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ?—? ?ƒ†?,??,??ƒˆ??š
#--------------------------------------------------------------------------
def set_text_n02add(member)
return if member == nil
self.contents.clear
self.contents.font.color = normal_color
if !member.actor? && N02::ENEMY_NON_DISPLAY.include?(member.enemy_id)
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
elsif member.actor? && !N02::ACTOR_DISPLAY
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
end
if N02::WORD_STATE_DISPLAY && N02::HP_DISPLAY
self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
draw_actor_hp(member, 182, 0, 120)
text = "["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != "["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == "["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(315, 0, 195, WLH, text, 0)
elsif N02::WORD_STATE_DISPLAY
text = member.name + " ["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != member.name + " ["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == member.name + " ["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
elsif N02::HP_DISPLAY
self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
draw_actor_hp(member, 262, 0, 120)
end
@text = text
end
end
class Sprite_Cursor
def set_area(actor = true)
temp_x = 0
temp_y = 0
n = 0
unit = $game_party.existing_members if actor
unit = $game_troop.existing_members unless actor
for battler in unit
temp_x += battler.position_x
temp_y += battler.position_y
n += 1
end
self.x = temp_x / n
self.y = temp_y /n
end
def set_battler_start(battler)
self.x = battler.position_x
self.y = battler.position_y
end
end
[/spoiler]