Hi guys. Let me just say, I'm new here, but I've been trying to get this question answered for a few months and haven't found help anywhere. I've asked on multiple forums and nobody has managed to answer this. I'm hoping someone here is experienced enough to help with the problem.
Anyway, I'm working on a game using bits and pieces of different scripts. One of which is Vampyr's ABS. In it, your party member's follow you, and you can switch between which you control. I managed to make it so that the party members do not always follow you, but I am attempting to make a button to toggle whether they do or not. Here are some scripts I'm using:
This script gives is the one in Vampyr's ABS that has the party member's following you.
CODE
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
More specifically, this portion is the one that controls it:
CODE
move_toward(self.target)
Someone helped me by making a script to toggle whether they follow the player or not. This is the script: in it, pressing X is supposed to make the characters follow you.
CODE
class Game_Ally < Game_Character
Moving_Switch_Button = Input::X
alias __initialize_old__ initialize unless $@
def initialize(*args,&block)
__initialize_old__(*args,&block)
@moving_allowed = true
end
alias __update_old__ update unless $@
def update(*args,&block)
__update_old__(*args,&block)
@moving_allowed = !@moving_allowed if Input.trigger?(Moving_Switch_Button)
end
alias __move_toward__ move_toward unless $@
def move_toward(*args, &block)
return unless @moving_allowed
__move_toward__(*args, &block)
end
end
The problem is that no matter what I change "Input::X" to, it does nothing. I intend to use ALT as the toggle key in my script. No matter what I do, absolutely nothing happens upon pressing the key. I don't know what the problem is at all.
To help you guys help me, I'm providing my project here too:
DownloadThanks in advance for help. I've been waiting months to have this question answered. Let me know if you need additional information.