Basically what I'm trying to do is execute a piece of code everytime the player is in a stopped state, ie. not moving. It doesn't matter what this code is, so for my current purposes let's just say it's a print function.
I've had two ideas so far, but both don't seem to work quite how I want it.
Firstly, in Game_Character.update:
if I add "print "blah" so it looks like this:
it should conceivably output a message dialog everytime the player stops. And it does... sorta. You see I get the dialog most times, but not every single time - if I did it would be perfect. Maybe it's because the stop_count resets right when the character stops, so if I let go of the key on the same frame when he stops, the branch is no longer executed?
My other method was in Game_Player.update, specifically this part:
If I modify it so something only executes when a direction is not being pressed (otherwise the dialog will come up every square that is walked) like so:
it works a treat - except that the code seems to get executed a frame or two too early, just before the sprite stops.
Any ideas?
(writing Scene_Map conditions are out of the question as that is a sloppy way to do it when most of the flags are already there - and besides, I've already got it working that way, but I am a perfectionist)
I've had two ideas so far, but both don't seem to work quite how I want it.
Firstly, in Game_Character.update:
Code:
if not @step_anime and @stop_count > 0
# Return to original pattern
@pattern = @original_pattern
# If stop animation is ON when moving
else
# Update pattern
@pattern = (@pattern + 1) % 4
end
Code:
if not @step_anime and @stop_count > 0
# Return to original pattern
@pattern = @original_pattern
print "blah"
# If stop animation is ON when moving
else
# Update pattern
@pattern = (@pattern + 1) % 4
end
My other method was in Game_Player.update, specifically this part:
Code:
# If not moving
unless moving?
# If player was moving last time
if last_moving
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
Code:
# If not moving
unless moving?
# If player was moving last time
if last_moving
if Input.dir4 == 0
print "blah"
end
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
Any ideas?
(writing Scene_Map conditions are out of the question as that is a sloppy way to do it when most of the flags are already there - and besides, I've already got it working that way, but I am a perfectionist)