Alright, I'm using Vampyr's ABS, and I'm trying to make one slight tweak to it. In it, your party member's follow you (unless there's an enemy, which they then attack). I'm trying to make it so that, yes, they follow you, but upon pressing a specific button, they stop following you. Then, if you press said button again, they start to follow you once more.
#------------------------------------------------------------------------------
# Game Ally
#------------------------------------------------------------------------------
class Game_Ally < Game_Character
attr_reader :id
attr_accessor :map_id
attr_accessor :draw
attr_accessor :destroy
attr_accessor :command
def initialize(id)
super()
@id = id
@map_id = $game_map.map_id
@command = 0
@draw = false
@destroy = false
self.target = $game_player
self.original_move_speed = 4
refresh
end
def update
super
return if @destroy
if self.actor.dead? and !@dead
refresh
@dead = true
elsif !self.actor.dead? and @dead
refresh
@dead = false
end
if $game_player.in_vehicle? and !@in_vehicle and !self.actor.defending
refresh
@in_vehicle = true
elsif !$game_player.in_vehicle? and @in_vehicle
refresh
moveto($game_player.x, $game_player.y) unless self.actor.dead?
@in_vehicle = false
end
return if self.actor.nil? or self.actor.dead? or $game_player.in_vehicle?
self.actor.defending = (@command == 2 ? true : false)
make_action
auto_recovery
update_movement
end
def refresh
self.actor = $game_party.members[@id]
self.actor.piece = self
if $game_player.in_vehicle? and !self.actor.dead? and !self.actor.defending
@character_name = ""
elsif self.actor.dead?
if File.exists?("Graphics/Characters/$#{self.actor.name}_dead.png") and @map_id == $game_map.map_id
@character_name = "$#{self.actor.name}_dead"
@character_index = 0
else
@character_name = ""
end
elsif @map_id != $game_map.map_id
@character_name = ""
else
@character_name = self.actor.character_name
@character_index = self.actor.character_index
end
end
def make_action
return if $game_map.interpreter.running?
return if self.actor.dead?
case @command
when 0
if self.actor.weapons[0] != nil and self.actor.weapons[0].ranged? and self.weapon1_attack_time <= 0
weapon_range_attack
self.weapon1_attack_time = self.actor.weapons[0].delay
else
if self.actor.two_swords_style
if self.weapon1_attack_time <= 0 and rand(100) <= 50
normal_attack_right
self.weapon1_attack_time = self.actor.attack_speed
elsif self.weapon1_attack_time <= 0 and rand(100) > 50
normal_attack_left
self.weapon1_attack_time = self.actor.attack_speed
end
elsif self.weapon1_attack_time <= 0
normal_attack_right
self.weapon1_attack_time = self.actor.attack_speed
end
end
when 1
return if self.skill_attack_time > 0 or self.actor.skills == []
self.assigned_skill = self.actor.skills[rand(self.actor.skills.size)]
case self.assigned_skill.scope
when 1
if self.assigned_skill.ranged?
skill_attack_range
elsif self.assigned_skill.explosive?
skill_explode_range
else
skill_attack_normal
end
when 2
skill_attack_all
when 3...7
if self.assigned_skill.ranged?
skill_attack_range
elsif self.assigned_skill.explosive?
skill_explode_range
else
skill_attack_normal
end
end
when 3
for skill in self.actor.skills
self.assigned_skill = skill
case self.assigned_skill.scope
when 7...12
skill_recover
end
end
end
end
def normal_attack_right
for monster in $game_monsters.compact
next unless in_front?(self, monster)
next if monster.actor.dead?
jump(0, 0) if monster.flying
self.anime_attack = 20
self.right_attack_on = true
self.left_attack_on = false
monster.animation_id = self.actor.atk_animation_id
monster.actor.attack_effect(self.actor)
monster.jump(0,0)
monster.target = self
end
for event in $game_map.events.values
next unless event.in_battle
next unless in_front?(self, event)
next if event.actor.dead? or event.object
jump(0, 0) if event.flying
self.anime_attack = 20
self.right_attack_on = true
self.left_attack_on = false
event.animation_id = self.actor.atk_animation_id
next if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon.id or
event.kill_with_skill > 0 or event.kill_with_item > 0
event.actor.attack_effect(self.actor)
event.jump(0,0) unless event.puzzle
event.target = self
end
end
def weapon_range_attack
for monster in $game_monsters
next unless in_direction?(self, monster) and in_range?(self, monster, self.actor.weapons[0].range)
next if monster.actor.dead?
next if monster.flying and !jumping?
self.anime_attack = 20
select = rand(100)
self.right_attack_on = select >= 50
self.left_attack_on = select < 50
if $game_party.has_item?(select >= 50 ? self.actor.weapons[0].ammo1 : self.actor.weapons[0].ammo2)
$game_party.consume_item(select >= 50 ? self.actor.weapons[0].ammo1 : self.actor.weapons[0].ammo2)
$game_range.push(Game_Range.new(self, self.actor.weapons[0].graphic, self.actor.weapons[0].index, self.actor.weapons[0].move_speed, self.actor.weapons[0].range, (select >= 50 ? 1 : 2)))
end
self.weapon1_attack_time = self.actor.equips[0].delay
end
for event in $game_map.events.values
next unless event.in_battle
next unless in_direction?(self, event) and in_range?(self, event, self.actor.weapons[0].range)
next if event.actor.dead? or event.object
next if event.flying and !jumping?
self.anime_attack = 20
select = rand(100)
self.right_attack_on = select >= 50
self.left_attack_on = select < 50
if $game_party.has_item?(select >= 50 ? self.actor.weapons[0].ammo1 : self.actor.weapons[0].ammo2)
$game_party.consume_item(select >= 50 ? self.actor.weapons[0].ammo1 : self.actor.weapons[0].ammo2)
$game_range.push(Game_Range.new(self, self.actor.weapons[0].graphic, self.actor.weapons[0].index, self.actor.weapons[0].move_speed, self.actor.weapons[0].range, (select >= 50 ? 1 : 2)))
end
self.weapon1_attack_time = self.actor.equips[0].delay
end
end
def range_attack_right
return if @attack_weapon.ammo1 != nil and !$game_party.has_item?(@attack_weapon.ammo1)
$game_party.consume_item(@attack_weapon.ammo1) if @attack_weapon.ammo1 != nil
$game_range.push(Game_Range.new(self, @attack_weapon.graphic, @attack_weapon.index, @attack_weapon.move_speed, @attack_weapon.range, 1))
end
def normal_attack_left
for monster in $game_monsters.compact
next unless in_front?(self, monster)
next if monster.actor.dead?
jump(0, 0) if monster.flying
self.anime_attack = 20
self.right_attack_on = false
self.left_attack_on = true
monster.animation_id = self.actor.atk_animation_id2
monster.actor.attack_effect(self.actor)
monster.jump(0,0)
monster.target = self
end
for event in $game_map.events.values
next unless event.in_battle
next unless in_front?(self,event)
next if event.actor.dead? or event.object
jump(0, 0) if event.flying
self.anime_attack = 20
self.right_attack_on = false
self.left_attack_on = true
event.animation_id = self.actor.atk_animation_id2
next if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon_and_Shield.id or
event.kill_with_skill > 0 or event.kill_with_item > 0
event.actor.attack_effect(self.actor)
event.jump(0,0) unless event.puzzle
event.target = self
end
end
def range_attack_left
return if @attack_weapon_and_Shield.ammo2 != nil and !$game_party.has_item?(@attack_weapon_and_Shield.ammo2)
$game_party.consume_item(@attack_weapon_and_Shield.ammo2) if @attack_weapon_and_Shield.ammo2 != nil
$game_range.push(Game_Range.new(self, @attack_weapon_and_Shield.graphic, @attack_weapon_and_Shield.index, @attack_weapon_and_Shield.move_speed, @attack_weapon_and_Shield.range, 2))
end
def skill_attack_normal
for monster in $game_monsters.compact
next unless in_front?(self, monster)
next if monster.actor.dead?
jump(0, 0) if monster.flying
next if self.actor.mp < self.assigned_skill.mp_cost
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
monster.animation_id = self.assigned_skill.animation_id
self.skill_attack_time = self.assigned_skill.delay
monster.actor.skill_effect(self.actor, self.assigned_skill)
monster.jump(0,0)
monster.target = self
end
for event in $game_map.events.values
next unless event.in_battle
next unless in_front?(self,event)
next if event.actor.dead? or event.object
jump(0, 0) if event.flying
next if self.actor.mp < self.assigned_skill.mp_cost
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
event.animation_id = self.assigned_skill.animation_id
self.skill_attack_time = self.assigned_skill.delay
next if event.kill_with_weapon > 0 or event.kill_with_item > 0 or
event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id
event.actor.skill_effect(self.actor, self.assigned_skill)
event.jump(0,0) unless event.puzzle
event.target = self
end
end
def skill_attack_range
for monster in $game_monsters.compact
next if monster.actor.dead?
next if monster.flying and !jumping?
next unless in_direction?(self, monster) and in_range?(self, monster, self.assigned_skill.range)
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
next if self.actor.mp < self.assigned_skill.mp_cost
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
$game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3))
RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil
self.skill_attack_time = self.assigned_skill.delay
end
for event in $game_map.events.values
next unless event.in_battle
next if event.actor.dead? or event.object
next if event.flying and !jumping?
next unless in_direction?(self, event) and in_range?(self, event, self.assigned_skill.range)
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
next self.actor.mp < self.assigned_skill.mp_cost
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
$game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3))
RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil
self.skill_attack_time = self.assigned_skill.delay
end
end
def skill_attack_all
return unless self.actor.mp >= self.assigned_skill.mp_cost
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
for monster in $game_mosnters.compact
next if monster.actor.dead?
monster.animation_id = self.assigned_skill.animation_id
self.skill_attack_time = self.assigned_skill.delay
monster.actor.skill_effect(self.actor, self.assigned_skill)
monster.jump(0,0)
monster.target = self
end
for event in $game_map.events.values
next unless event.in_battle
next if event.actor.dead? or event.object
event.animation_id = self.assigned_skill.animation_id
self.skill_attack_time = self.assigned_skill.delay
next if event.kill_with_weapon > 0 or event.kill_with_item > 0 or
event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id
event.actor.skill_effect(self.actor, self.assigned_skill)
event.jump(0,0) unless event.puzzle
event.target = self
end
end
def skill_explode_range
for monster in $game_monsters.compact
next if monster.actor.dead?
next if monster.flying and !jumping?
next unless in_direction?(self, monster) and in_range?(self, monster, self.assigned_skill.range)
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
next if self.actor.mp < self.assigned_skill.mp_cost
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
$game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4))
RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil
self.skill_attack_time = self.assigned_skill.delay
end
for event in $game_map.events.values
next unless event.in_battle
next if event.actor.dead? or event.object
next if event.flying and !jumping?
next unless in_direction?(self, event) and in_range?(self, event, self.assigned_skill.range)
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
next if self.actor.mp < self.assigned_skill.mp_cost
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
$game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4))
RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil
self.skill_attack_time = self.assigned_skill.delay
end
end
def skill_recover
for person in $game_party.members
next unless person.hp <= (person.maxhp/4)
next if self.actor.mp < self.assigned_skill.mp_cost
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill)
$game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0
person.skill_effect(person, self.assigned_skill)
person.piece.animation_id = self.assigned_skill.animation_id
self.skill_attack_time = self.assigned_skill.delay
end
end
def auto_recovery
return unless self.actor.auto_hp_recover and self.recovery_time <= 0
self.message1 = self.assigned_skill.message1
self.message2 = self.assigned_skill.message2
self.actor.hp += (self.actor.maxhp*10/100)
self.recovery_time = 1800
end
def update_movement
return if $game_map.interpreter.running?
return if moving?
return if self.freeze or (self.anime_attack/2) > 0
if $game_player.dash? and self.target == $game_player
@move_speed = 5
else
@move_speed = self.original_move_speed
end
if @target.nil? or @command >= 2
self.target = $game_player
else
for monster in $game_monsters.compact
next if monster.actor.dead?
if in_range?(self, monster, 3) and !self.lock_target
self.target = monster
self.lock_target = true
elsif !self.lock_target
self.target = $game_player
end
end
for event in $game_map.events.values
if event.in_battle and in_range?(self, event, 3) and !self.lock_target
next if event.object or event.puzzle
self.target = event
self.lock_target = true
elsif !self.lock_target
self.target = $game_player
end
end
end
move_toward(self.target)
end
def perform_transfer(map_id, x, y, dir)
@map_id = map_id
set_direction(dir)
moveto(x, y)
move_random
self.target = $game_player
self.lock_target = false
end
def screen_z
return $game_player.screen_z-1
end
def in_vehicle?
return $game_player.in_vehicle?
end
end
I THINK this is the script that talks about their movement. If not, it might be...
#------------------------------------------------------------------------------
# Game Party
#------------------------------------------------------------------------------
class Game_Party < Game_Unit
alias vampyr_sbabs_gparty_setup_starting_members setup_starting_members
def setup_starting_members
vampyr_sbabs_gparty_setup_starting_members
for i in 1...@actors.size
next if @actors[i].nil?
$game_allies[i] = Game_Ally.new(i)
end
end
def add_actor(actor_id)
if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
@actors.push(actor_id)
$game_player.refresh
id = @actors.size-1
if @actors.size > 1 and $Vampyr_SBABS.use_sbabs
$game_allies[id] = Game_Ally.new(id)
$game_allies[id].moveto($game_player.x, $game_player.y)
$game_allies[id].move_random
end
end
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
def remove_actor(actor_id)
change_group_order if members[0].id == actor_id
@actors.delete(actor_id)
for ally in $game_allies.compact
next if ally.actor.id != actor_id
ally.destroy = true
$game_allies.delete(ally)
end
$game_player.refresh
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
def change_group_order
for ally in $game_allies.compact
next if ally.map_id == $game_map.map_id
return
end
return if members.size <= 1
actor = @actors[0]
@actors.delete(actor)
@actors.compact
if all_dead?
@actors.insert(0, actor)
return
end
@actors.push(actor)
for a in members.compact
if a.dead?
ally = a
@actors.delete(a.id)
@actors.push(a.id)
else
for i in $game_allies.compact
next if i.actor != a
ally = i
end
break
end
end
allies = []
for a in $game_allies.compact
allies.push(a)
end
allies.delete(ally)
allies.push($game_player)
allies.compact
for i in 1...members.size
next if members[i].nil?
next unless $Vampyr_SBABS.use_sbabs
$game_allies[i] = Game_Ally.new(i)
$game_allies[i].refresh
$game_allies[i].moveto(allies[i-1].x, allies[i-1].y)
if !allies[i-1].is_a?(Game_Player)
$game_allies[i].map_id = allies[i-1].map_id
else
$game_allies[i].map_id = $game_map.map_id
end
$game_allies[i].direction = allies[i-1].direction
end
$game_player.moveto(ally.x, ally.y) unless ally.nil?
$game_player.refresh
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
end
Alright, I'm using Vampyr's ABS, and I'm trying to make one slight tweak to it. In it, your party member's follow you (unless there's an enemy, which they then attack). I'm trying to make it so that, yes, they follow you, but upon pressing a specific button, they stop following you. Then, if you press said button again, they start to follow you once more.
I THINK this is the script that talks about their movement. If not, it might be...
...this one. Thanks in advance.
Share this post
Link to post
Share on other sites