Hello, I'm new here. And relatively new to rmvx and have been fine up until now.
I'm trying to get an event to always be in front of the player while being able to be activated with the action button. So that when the player presses space at any point they then transferred an inside spaceship scene err map.
I'm doing it with a spaceship sprite as the main character. Also when the player exits the inside spaceship map, then the player is transferred back exactly where the player was when the player entered the spaceship map. ie, without losing were the player/ship and the event to enter the internal ship map was.
hope that makes sense.
thanks.
Well I got something close working, but it's too touchy. I modified some scripts and bah, it gets in front of the player but if you hold down the key it takes off. I've never scripted before, so. dunno show you what i got and maybe someone with scripting skills can help?
Note: do not use this if you don't know how to do scripting, err dont know how to reverse what you did.
#ok in game_player
#I added
attr_reader :player_direction # the direction the player is facing
attr_reader :player_move_active # the player is pressing a key for movement
#then I modified
#--------------------------------------------------------------------------
# * Processing of Movement via input from the Directional Buttons
#--------------------------------------------------------------------------
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
@player_direction = 0
@player_move_active = 0
case Input.dir4
when 2; move_down;@player_direction = 1;@player_move_active = 1
when 4; move_left;@player_direction = 4;@player_move_active = 1
when 6; move_right;@player_direction = 2;@player_move_active = 1
when 8; move_up;@player_direction = 3;@player_move_active = 1
end
end
#and added these 2 methods
#--------------------------------------------------------------------------
# * Get the direction
#--------------------------------------------------------------------------
def pdirection
return @player_direction
end
def player_movement_active
return @player_move_active
end
#then in game_character
#i added
attr_accessor :lastdirection # last movement the player did
#and added this method
#--------------------------------------------------------------------------
# * Move infront Player
#--------------------------------------------------------------------------
def infront_of_player
nd = $game_player.pdirection
#if nd != @olddirection
if ($game_player.player_movement_active == 1)
if(nd == 1 and @lastdirection == 3)
move_down
move_down
move_down
elsif (nd == 1 and @lastdirection == 2)
move_down
move_down
move_left
elsif (nd == 1 and @lastdirection == 4)
move_down
move_down
move_right
elsif(nd == 2 and @lastdirection == 4)
move_right
move_right
move_right
elsif(nd == 2 and @lastdirection == 1)
move_right
move_right
move_up
elsif (nd == 2 and @lastdirection == 3)
move_right
move_right
move_down
elsif (nd == 3 and @lastdirection == 1)
move_up
move_up
move_up
elsif (nd == 3 and @lastdirection == 2)
move_up
move_up
move_left
elsif(nd == 3 and @lastdirection == 4)
move_up
move_up
move_right
elsif (nd == 4 and @lastdirection == 1)
move_left
move_left
move_up
elsif (nd == 4 and @lastdirection == 2)
move_left
move_left
move_left
elsif (nd == 4 and @lastdirection == 3)
move_up
move_up
move_right
elsif (nd == 1 and (@lastdirection == 1 or @lastdirection == 0))
move_down
elsif (nd == 2 and @lastdirection == 0)
move_right
move_right
move_up
elsif (nd == 3 and @lastdirection == 0)
move_up
move_up
move_up
elsif (nd == 4 and @lastdirection == 0)
move_right
move_right
move_up
elsif (nd == 2 and @lastdirection == 2 )
move_right
elsif (nd == 3 and @lastdirection == 3 )
move_up
elsif (nd == 4 and @lastdirection == 4 )
move_left
end
@lastdirection = nd
end
end
I put the event right below the player's start point so the player is starting out facing the event. Set the event's movement to custom and added the movement script 'infront_of_player'. I also had to crank up the events movement speed and frequency to even get the above to work just kind of. tapping the key for movement quickly does work.
uh, just make a common event set at parallel process with a conditional branch in it checking if the player is pressing the [space] bar. If yes, then go to the airship. If not, then nothing happens.
to keep track of the player position, just set it up so that before the character teleports, you set 3 variables. One is equal to the player's x map position, one is equal to the player's y map position and the third one is equal to the map ID the player is on. Then whenever you want to teleport back to that exact spot, make a teleport event using those variables.
@ grafikal -
I support your statement
wow, ok yep that would work too. I think I over thought it. well cool!
Thanks
lol, np