Hi everyone,
For my platform project, I use this cool script by NamKazt' and modified a little bit, but my programmation skils are bad.
With it, you can parameter gravity and speed of your character, roughness of ground, even deal damages if you fall...
But it need some improvements :
1 - Some events can be tagged as ladder you can use, it works in newly created project, but in my project there's an incompatibility I guess, making it inneficient (character hangs on event, but climbing is impossible as gravity let him fall). How can I resolve this ?
2 - I want my character to swim when I input directions (as normal moves in non-platform), and slowly drown when do nothing
3 - There is a tag for Flying event. But you have to tag in the name event. So, you could not change it, and make a walking bird suddenly to fly for example.
In fact, I need a parameter for events, stocked in some self variable, I can change as 0 = walking, 1 = flying, 2 = swimming, 3 = amphiby, 4 =all
This way I could make a fish to move free and stay in water, or a crocodile to swim or walk on ground
4 - Moving platforms. In fact I haven't checked others scripts that allow this, but I'm pretty sure there will be an incompatibility if other script on event's moves is used.
5 - Jumping events, as they can flee or follow the character, and not to be stopped by a ground leveling. Here again, if it is possible to parameter jump in some self variable of the event, as some events are enable to, or can jump very high...
Hope this script could help some of you
And hope some of you could add some improvements to help me ^^
Thanks guys
#==============================================================================
# ** NamKazt's Platform Move Systems
#------------------------------------------------------------------------------
# Version : 1.4.4
# * Features :
# +, Flatform Movement ( suck as Maplestory, Patapon ,...)
# +, Pixel per pixel movement
#------------------------------------------------------------------------------
# Future :
# +, Add action suck as throw or push event
#------------------------------------------------------------------------------
# Update 1.4.4 :
# +, Add Ladder ^^~
# you can add [Ladder] into name of event and set it through
# e.g : EV001[W100][H200][Ladder]
# +, Add Fly obj like a bird ^^~
# you can add [Fly] into name of event
# e.g : EV001[W100][H200][Fly]
# only event is fly obj, in move random mode is can move 8 direction
#------------------------------------------------------------------------------
# Update 1.4.3 :
# +, Add height of event
# e.g : EV001[W380][H200]
# for obj and for a gate ^^~
# +, fixbug event blow another event or player
#------------------------------------------------------------------------------
# Update 1.4.2 :
# +, Add width of event
# like : Event id 1 have name is EV001 and width of it's 380
# you must named it to EV001[W380]
# without it, game will crash!
# -> it'll improve smooth when you touch events with other size
# -> suck as a chest have width is 35, a dragon have width is 600
# +, Improve smooth by use real_x ( old is using x )
# +, Fixbug distance too long
#------------------------------------------------------------------------------
# Update 1.4.1 :
# +, Add block player if event not through
#------------------------------------------------------------------------------
# Thanks :
# HikiMoKi for the idea and base
# I just was developing the idea for XP
#==============================================================================
#gravity line 361
#speed/roughness line 656
# ! WARNING !
#the actual tile your character is y+1 (so, below) in map coordinates, be aware with terrain tag or passable
class Game_Character
attr_reader :xv # Trục x
attr_reader :yv # Trục y
attr_accessor :gravity # Nặng
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias pms_initialize initialize
def initialize
pms_initialize
@xv = 0
@yv = 0
@move_count = 0
@jump_flag = false
end
#--------------------------------------------------------------------------
# * Determine if Moving
#--------------------------------------------------------------------------
def moving?
# If logical coordinates differ from real coordinates,
# movement is occurring.
return @move_count > 0
end
#--------------------------------------------------------------------------
# * Determine if player on ladder
#--------------------------------------------------------------------------
def ladder?
# If logical coordinates differ from real coordinates,
# movement is occurring.
if self == $game_player and check_event_ladder_here([0])
return true
end
return false
end
#--------------------------------------------------------------------------
# * Check if on ladder
#--------------------------------------------------------------------------
def check_event_ladder_here(triggers)
# All event loops
for event in $game_map.events.values
@size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
if event.get_name.include? "[Ladder]"
# If event coordinates and triggers are consistent
if self.real_x >= (event.real_x - @size) and self.real_x <= (event.real_x + @size) and self.real_y > event.real_y - @height - 30 and self.real_y <= event.real_y + 5 and triggers.include?(event.trigger)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# * Determine if event is fly obj
#--------------------------------------------------------------------------
def isfly?
# If logical coordinates differ from real coordinates,
# movement is occurring.
if self != $game_player and self.get_name.include? "[Fly]"
return true
end
return false
end
#--------------------------------------------------------------------------
# * Touch
# mode :
# * 0 : Left or Right
# * 1 : Up or Down
#--------------------------------------------------------------------------
def touch?(mode = 0)
if mode == 0
if @xv > 0
check_event_trigger_touch(@x+1, @y)
else
check_event_trigger_touch(@x-1, @y)
end
else
if @xv > 0
check_event_trigger_touch(@x, @y+1)
else
check_event_trigger_touch(@x, @y-1)
end
end
end
def distance_x_from_player
sx = @x - $game_player.x
return sx
end
def distance_y_from_player
sy = @y - $game_player.y
return sy
end
def passable?(mode = 0)
if self != $game_player and self.get_name.include? "[Ladder]"
return false
end
left_x = @real_x +20>> 7 # 4 << 3
right_x = @real_x+100 >> 7 # 28 << 3
up_y = @real_y>> 7 # 2 << 3
down_y = @real_y +40>> 7 # 28 << 3
# Get new coordinates
if self != $game_player
if mode == 0
if @xv > 0
return false unless $game_map.passable?(right_x, up_y,6)
return false unless $game_map.passable?(right_x, down_y,6)
else
return false unless $game_map.passable?(left_x, up_y,4)
return false unless $game_map.passable?(left_x, down_y,4)
end
else
if @yv > 0
return false unless $game_map.passable?(left_x, down_y,2)
return false unless $game_map.passable?(right_x, down_y,2)
else
return false unless $game_map.passable?(left_x, up_y,8)
return false unless $game_map.passable?(right_x, up_y,8)
end
end
else
if ladder? && Input.press?(Input::DOWN)
return true
else
if mode == 0
if @xv > 0
return false unless $game_map.passable?(right_x, up_y,6)
return false unless $game_map.passable?(right_x, down_y,6)
else
return false unless $game_map.passable?(left_x, up_y,4)
return false unless $game_map.passable?(left_x, down_y,4)
end
else
if @yv > 0
return false unless $game_map.passable?(left_x, down_y,2)
return false unless $game_map.passable?(right_x, down_y,2)
else
return false unless $game_map.passable?(left_x, up_y,8)
return false unless $game_map.passable?(right_x, up_y,8)
end
end
end
end
if @through
return true
end
# Loop all events
for event in $game_map.events.values
new_x = (event.direction == 6 ? ((@real_x + 32 >> 7) + 1) : event.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
new_y = (event.direction == 2 ? ((@real_y + 16 >> 7) + 1) : event.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
# If event coordinates are consistent with move destination
if event.x == new_x and event.y == new_y
#If through is OFF
unless event.through
# If self is event
if self != $game_player
# impassable
return false
end
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
if(self != $game_player)
@width = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
@height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"
if self.real_y >= event.real_y - @height and
self.real_y <= event.real_y + 5 and
self.real_x >= event.real_x - @width and
self.real_x <= event.real_x + @width and
self != event
unless event.through and self.through
return false
end
end
end
@width = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
@height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"
if $game_player.real_y >= event.real_y - @height and
$game_player.real_y <= event.real_y + 125 and # height of player
$game_player.real_x >= event.real_x - @width and
$game_player.real_x <= event.real_x + @width
unless event.through
return false
end
end
end
new1_x = ($game_player.direction == 6 ? ((@real_x + 32 >> 7) + 1) : $game_player.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
new1_y = ($game_player.direction == 2 ? ((@real_y + 16 >> 7) + 1) : $game_player.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
if $game_player.x == new1_x and $game_player.y == new1_y
# If through is OFF
unless $game_player.through
# If your own graphic is the character
if @character_name != ""
# impassable
return false
end
end
end
return true
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_x
update_y
# Branch with jumping, moving, and stopping
if jumping?
update_jump
elsif moving?
@move_count -= 1
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
elsif ladder?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
else
update_stop
end
# If animation count exceeds maximum value
# * Maximum value is move speed * 1 taken from basic value 18
if @anime_count > 18 - @move_speed * 3
# If stop animation is OFF when stopping
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
# Clear animation count
@anime_count = 0
end
# If waiting
if @wait_count > 0
# Reduce wait count
@wait_count -= 1
return
end
# If move route is forced
if @move_route_forcing
# Custom move
move_type_custom
return
end
# When waiting for event execution or locked
if @starting or lock?
# Not moving by self
return
end
# If stop count exceeds a certain value (computed from move frequency)
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
# Branch by move type
case @move_type
when 1 # Random
move_type_random
when 2 # Approach
move_type_toward_player
when 3 # Custom
move_type_custom
end
end
end
#--------------------------------------------------------------------------
# ● Update X
#--------------------------------------------------------------------------
def update_x
if !@jump_flag && !moving?
@xv = 0
return
end
last_x = @real_x
@real_x += @xv
@x = @real_x >> 7
unless passable?(0)
@real_x = last_x
@x = @real_x>> 7
@xv = 0
touch?(0)
end
end
#--------------------------------------------------------------------------
# ● Update Y
#--------------------------------------------------------------------------
def update_y
# here you can parameter the gravity 1 (jump high) to 10 (no jump)
# or using a game variable (here 1, modify it if you want)
@gravity = 5 -$game_variables[1]
if @gravity<1
@gravity=1
end
if !ladder?
if !isfly?
if @gravity > 0
@yv += @gravity+1
@yv = 64 if @yv > 64
elsif !moving?
@yv = 0
return
end
last_y = @real_y
if @yv -$game_variables[16]*5 > 0
@real_y += @yv -$game_variables[16]*5
else
@real_y += @yv
end
#this calculates the heigth of the character's fall and stocks it in a game variable
#usefull if you want to deal some falling damages for example
if (self == $game_player)
$game_variables[19] = @real_y-last_y #change here the number of the variable you want
if $game_variables[19] > 63 #here, 63 is the limit to reach if i want to deal damages
$game_variables[18] +=1 #here i increase game variable (change number if you want) where damages are calculated
end
end
#
@y = @real_y >> 7
unless passable?(1)
@real_y = last_y
@y = @real_y >> 7
@jump_flag = false if @yv > 0
@yv = 0
touch?(1)
end
else
last_y = @real_y
@real_y += @yv
@y = @real_y >> 7
unless passable?(1)
@real_y = last_y
@y = @real_y >> 7
@jump_flag = false if @yv > 0
@yv = 0
touch?(1)
end
end
else
if Input.press?(Input::UP)
last_y = @real_y
@real_y -= 10;
@y = @real_y >> 7
elsif Input.press?(Input::DOWN)
turn_down
last_y = @real_y
@real_y += 10;
@y = @real_y >> 7
else
if @gravity > 0
@yv += @gravity+1
@yv = 64 if @yv > 64
elsif !moving?
@yv = 0
return
end
last_y = @real_y
@real_y += @yv
@y = @real_y >> 7
unless passable?(1)
@real_y = last_y
@y = @real_y >> 7
@jump_flag = false if @yv > 0
@yv = 0
touch?(1)
end
end
end
end
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
@stop_count = 0
d = 2 ** @move_speed
@yv = d
@move_count =128 / d
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
turn_left
d = 2 ** @move_speed
@xv = 0 - d
@move_count = 128 / d
increase_steps
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
turn_right
d = 2 ** @move_speed
@xv = d
@move_count = 200 / d
increase_steps
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
@stop_count = 0
d = 2 ** @move_speed
@yv = 0 - d
@move_count = 128 / d
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
# If no direction fix
unless @direction_fix
# Face down is facing right or up
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
# Update coordinates
d = 2 ** @move_speed
@xv = 0 - d
@yv = d
@move_count = 128/ d
# Increase steps
increase_steps
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face down if facing up
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
d = 2 ** @move_speed
@xv = d
@yv = d
@move_count = 128 / d
# Increase steps
increase_steps
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
# If no direction fix
unless @direction_fix
# Face left if facing right, and face up if facing down
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
# Update coordinates
d = 2 ** @move_speed
@xv = 0 - d
@yv = 0 - d
@move_count = 128 / d
# Increase steps
increase_steps
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face up if facing down
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
d = 2 ** @move_speed
@xv = d
@yv = 0 - d
@move_count = 128 / d
# Increase steps
increase_steps
end
#--------------------------------------------------------------------------
# * Move at Random
#--------------------------------------------------------------------------
def move_random
if !isfly?
@a = rand(1000)
if @a % 2 == 0
move_left(false)
else
move_right(false)
end
else
case rand(8)
when 0; move_left(false)
when 1; move_right(false)
when 2; move_up(false)
when 3; move_down(false)
when 4; move_lower_left
when 5; move_lower_right
when 6; move_upper_left
when 7; move_upper_right
end
end
end
#--------------------------------------------------------------------------
# * Move toward Player
#--------------------------------------------------------------------------
def move_toward_player
sx = distance_x_from_player
sx > 0 ? move_left : move_right
sy = distance_y_from_player
sy > 0 ? move_up : move_down
# プレイヤーの座標との差を求める
sx = @x - $game_player.x
sy = @y - $game_player.y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合
if abs_sx > abs_sy
# 左右方向を優先し、プレイヤーのいるほうへ移動
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# 縦の距離のほうが長い場合
else
# 上下方向を優先し、プレイヤーのいるほうへ移動
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
# * Move away from Player
#--------------------------------------------------------------------------
def move_away_from_player
sx = distance_x_from_player
sx > 0 ? move_right : move_left
end
#--------------------------------------------------------------------------
# * Jump
# Không cần nhập giá trị x và y ở RMXP
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
return if @jump_flag
@xv = 5*x_plus.to_i
@yv = -48*-y_plus.to_i
@jump_flag = true
@stop_count = 0
end
#--------------------------------------------------------------------------
# * Turn Towards Player
#--------------------------------------------------------------------------
def turn_toward_player
if @real_x < $game_player.real_x
turn_right
else
turn_left
end
end
end
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Passable Determinants
#--------------------------------------------------------------------------
def passable?(mode)
super(mode)
end
#you can parameter here the horizontal speed of your character
#modify in def move_left AND def move_right
# effective speed = direction*speed +basis -terrain_roughness
# speed is stocked in a game variable (here 7 modify it if you want) so you can add some dash effect
# basis is the number of pixel that character will at least step, five is good
# terrain roughness slows down speed and slide, stocked in a game variable (here 16 modify it if you want)
# roughness 0 for normal terrain, 2 for water, -10 for ice
# call this game variable in association with appropriate terrain_tag in tileset for example
# if you don't need speed to be variable, change @xv = the number you want
# and your character will walk always at same speed
def move_left(turn_ok = true)
turn_left
#modify here
@xv = 2*$game_variables[7] -5 +$game_variables[16]*2
@xv = @xv.to_i
@move_count = 1
end
def move_right(turn_ok = true)
turn_right
#modify here
@xv = 2*$game_variables[7] +5 -$game_variables[16]*2
@xv = @xv.to_i
@move_count = 1
end
def update_x
if !@jump_flag && !moving?
@xv = [@xv + 1, 0].min if @xv < 0
@xv = [@xv - 1, 0].max if @xv > 0
end
if !ladder?
last_x = @real_x
@real_x += @xv
@x = @real_x >> 7
unless passable?(0)
@real_x = last_x
@x = @real_x >> 7
@xv = 0
touch?(0)
end
else
if Input.press?(Input::UP) || Input.press?(Input::DOWN)
turn_up
last_x = @real_x
@x = @real_x >> 7
else
last_x = @real_x
@real_x += @xv
@x = @real_x >> 7
unless passable?(0)
@real_x = last_x
@x = @real_x>> 7
@xv = 0
touch?(0)
end
end
end
end
def move_jump(yv)
@yv = yv
@jump_flag = true
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# Move player in the direction the directional button is being pressed
if Input.press?(Input::LEFT)
move_left
elsif Input.press?(Input::RIGHT)
move_right
end
end
if Input.trigger?(Input::UP) && @jump_flag == false # Jump
move_jump(-48+$game_variables[16]*2)
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
# 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
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
@size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
# If event coordinates and triggers are consistent
if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and triggers.include?(event.trigger)
# If starting determinant is same position event (other than jumping)
if not event.jumping? and event.over_trigger?
event.start
result = true
return result
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# Calculate front event coordinates
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
@size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
# If event coordinates and triggers are consistent
if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
return result
end
end
end
# If fitting event is not found
if result == false
# If front tile is a counter
if $game_map.counter?(new_x, new_y)
# Calculate 1 tile inside coordinates
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
@size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
# If event coordinates and triggers are consistent
if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
return result
end
end
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
@size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"
@height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"
# If event coordinates and triggers are consistent
if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and [1,2].include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
return result
end
end
end
return result
end
end
class Game_Event < Game_Character
def get_name
return @event.name
end
end