08-30-2016, 03:35 AM
Hey, guys. Dunno if anyone scripting noticed, but the 'follow player' feature in all the RPGMaker systems include a bit of randomness. Make an event set to follow the player, and it randomly turns around or something.
Saying that as Ahzoh brought that up about Lycan. Might be something to look into... an alternate 'movement' option.
For example, RMXP's routine that makes events move to the player looks like this:
It includes a few mechanisms that make the event move randomly 18% of the time. If you want to make the events to only go straight to the player (this means you, Ahzoh), you may want to add this to your code instead. This removes all 'randomness' to any event moving to the player.
Saying that as Ahzoh brought that up about Lycan. Might be something to look into... an alternate 'movement' option.
For example, RMXP's routine that makes events move to the player looks like this:
Code:
def move_type_toward_player
# Get difference in player coordinates
sx = @x - $game_player.x
sy = @y - $game_player.y
# Get absolute value of difference
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
# If separated by 20 or more tiles matching up horizontally and vertically
if sx + sy >= 20
# Random
move_random
return
end
# Branch by random numbers 0-5
case rand(6)
when 0..3 # Approach player
move_toward_player
when 4 # random
move_random
when 5 # 1 step forward
move_forward
end
end
Code:
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Move Type : Approach
#--------------------------------------------------------------------------
def move_type_toward_player
move_toward_player
end
end