Kirri

Imagining Things
Veteran
Joined
Dec 14, 2019
Messages
103
Reaction score
263
First Language
Malay
Primarily Uses
RMVXA
Hello there,
Is it possible to make it so that when the player dashes, it can go through event BUT cannot go through impassable tile?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,718
Reaction score
15,846
First Language
English
Primarily Uses
RMMV
ALL events? What about events that have a sprite from the tileset?
 

Kirri

Imagining Things
Veteran
Joined
Dec 14, 2019
Messages
103
Reaction score
263
First Language
Malay
Primarily Uses
RMVXA
ALL events? What about events that have a sprite from the tileset?
Hmm... yea, I want it to not pass through those kinds of events too if possible.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
Try this. Thoughts @Shaz ?
Ruby:
class Game_Player < Game_Character
  def passable?(x, y, d)
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    return false unless $game_map.valid?(x2, y2)
    return true if @through || debug_through?
    id = $game_map.event_id_xy(x2,y2)
    evpass = false
    if id != 0
      evpass = $game_map.events[id].tile_id == 0 ? true : false
    end
    return true if dash? && evpass && $game_map.passable?(x2, y2, d)
    return false unless map_passable?(x, y, d)
    return false unless map_passable?(x2, y2, reverse_dir(d))
    return false if collide_with_characters?(x2, y2)
    return true
  end
end
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,718
Reaction score
15,846
First Language
English
Primarily Uses
RMMV
I think putting this in Game_CharacterBase might allow events to go through other events if the player is dashing?

Would also have to cater for the possibility of an event (without a tile sprite) being on an impassable tile. Maybe put the dash test below the two map_passable tests?

Everything else seems good, but I'm a bit tired atm to follow it all properly.

Also, no need to define events in Game_Map because there's already an attr_reader for it in the class.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
Good point, I didn't think about the parent tree. I usually end up placing things where they were originally found until I clue in.
It was weird because through my tests to get this whenever I mentioned $game_map.events[id].tile_id it gave me a no method error on tile_id for nil, nil class. But now it works fine. Must have been the way I originally had it before getting to this solution.

You're right about the event on an impassible tile. The player steps into the tile, then can't move.
*Fixed
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Character selection in games be like
Special Tractor Operation! :kaojoy:
Current status screens for Shadows of the Earth: The Vrila'an Legend. Need to do something about the color scheme lol
Captura de pantalla (259).pngCaptura de pantalla (260).png
My first serious victim in game hacking - Pawnbarian.
Diana Path 2.png
I love these two design wise lol... The high school principal and the captain of the women's wrestling team. they team up as bosses to save the school's accreditation.

Forum statistics

Threads
122,074
Messages
1,146,312
Members
160,365
Latest member
ErichZann
Top