Skip to content

Instantly share code, notes, and snippets.

@kl
Created March 1, 2012 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kl/1953684 to your computer and use it in GitHub Desktop.
Save kl/1953684 to your computer and use it in GitHub Desktop.
"Turn movement" for VX Ace - events move only when the player moves
module Kal
module TurnMove
# Enable or disable turn movement.
ENABLE = true
# If you want to use a switch to enable turn movement.
SWITCH = nil
# Only events that have the following comment string as a comment
# on their first page are affected. Set to nil or false if you don't
# want to use this option.
COMMENT = "turn-move"
end
end
class Game_Event
alias_method :update_self_movement_turnmove_kal, :update_self_movement
def update_self_movement
return if is_turnmove_kal? && !$game_player.moving?
update_self_movement_turnmove_kal
end
def is_turnmove_kal?
return false unless Kal::TurnMove::ENABLE
switch = Kal::TurnMove::SWITCH
return false if switch && !$game_switches[switch]
comment = Kal::TurnMove::COMMENT
return false if comment && !has_comment_turnmove_kal?
true
end
def has_comment_turnmove_kal?
comments = @event.pages.first.list.select do |command|
command.code == 108 || command.code == 408
end
comments.any? { |c| c.parameters.first.include?(Kal::TurnMove::COMMENT) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment