Hey, everyone. I've been trying to fix my visible encounters system in VX Ace and gotten this code:
class Game_Player # --------------------------------------------------------------------------- # Overwrite check event trigger there # --------------------------------------------------------------------------- def check_event_trigger_there(triggers) x2 = $game_map.round_x_with_direction(@x, @direction) y2 = $game_map.round_y_with_direction(@y, @direction) @ignore_char = true start_map_event(x2, y2, triggers, true) if passable?(x,y,@direction) @ignore_char = false return if $game_map.any_event_starting? return unless $game_map.counter?(x2, y2) x3 = $game_map.round_x_with_direction(x2, @direction) y3 = $game_map.round_y_with_direction(y2, @direction) start_map_event(x3, y3, triggers, true) end alias theo_evtrigger_collide_chars? collide_with_characters? def collide_with_characters?(x ,y) return false if @ignore_char theo_evtrigger_collide_chars?(x,y) end endBasically, what this does is to stop a player from accessing an event through tiles that are impassable, so that if, for example, a treasure chest is at the top of a cliff and the player can walk on a lower area to get to the tile to the left of it, that treasure chest cannot be opened.
On the other hand, when an event triggered by Event Touch tries to approach the player, it ignores this check and can activate regardless. Since I'm using a visible encounters system and make heavy use of multi-layered paths on my maps, it's a major problem when enemies can attack players from other levels of the area. Keep in mind that none of the events involved have Through enabled--where they are allowed to walk is limited as normal. I found this bug in my game and recreated it in a completely new project using the same script as above.
Event Touch triggers bypass this script check
● ARCHIVED · READ-ONLY
-
-
I have a fix for this, and I think I implemented it into either the Game_Event or the Game_Characterbase class. (might have been Game_Event.start now that I think about it)
I don't have it in front of me at the moment and I can't see that I've posted it anywhere here, so if I remember, I'll look for it when I get home this afternoon. -
Anything more on this? It would be a great help. As is, my game is pretty broken.
-
Alright ... I set mine up so you can add a comment to the event like this:
Comment: <same level>and the event will only start if the player is "logically" able to touch the event (they are not at different "levels" of elevation, or you could normally walk from the player's tile to the event's tile and back again).You will need the following script - place below other scripts:
class Game_Event < Game_Character alias shaz_elevation_game_event_start start def start return if empty? if @list.any?{|cmd| [108,408].include?(cmd.code) && cmd.parameters[0].to_s.downcase =~ /<same level>/} gx = $game_player.x gy = $game_player.y d = gx < x ? 4 : gx > x ? 6 : gy < y ? 8 : gy > y ? 2 : gx == x && gy == y ? 10 : 0 return if d == 0 || !map_passable?(x, y, d) || !map_passable?(gx, gy, 10-d) end shaz_elevation_game_event_start endendYou would only use this on events that have Action Button, Player Touch or Event Touch as triggers AND a priority of Same as Characters.I considered giving you a version that forces that behaviour for ALL events with those triggers, to save you having to go through and add the comment to every event (potentially multiple pages) that you want to act like this, but that would then mess up events that you DO want to trigger if they're on impassable tiles - like a sign stuck to a wall or an object sitting on a table/bench, for example.
If you think there are fewer of those types of events, you could just change @list.any? to !@list.any? and put the comment on those events you DO want to trigger even though you wouldn't normally be able to walk from the player's tile to the event's tile (and maybe change the text in the comment and in the script accordingly). -
Thanks a ton, Shaz. Needless to say you're going in the credits of my game for script help. This worked like a charm. =)
-
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.