interactive moving events 'above character'

Discussion in 'RPG Maker VX Ace' started by gsuk, May 15, 2018.

Thread Status:
Not open for further replies.
  1. gsuk

    gsuk Veteran Veteran

    Messages:
    101
    Likes Received:
    9
    Location:
    Prague
    First Language:
    English
    Primarily Uses:
    RMVXA
    hi,

    so in my game, the monsters you encounter are events (not random encounters) - and they are land, sea or air-based. So, for birds, for example, I want them to be able to fly over the scenery (e.g. trees), but still engage in battle with the character on contact. (some move randomly, some towards the char, but that's not really important)

    If I set the event to 'above character', and 'through', they fly as I want them to, but the 'Event touch' doesn't trigger very reliably.
    If I set the event to 'same as character', and 'through', they end up flying behind certain parts of the scenery and over others.

    Without through, they just don't fly over anything at all.

    Is there a way to do this? Am I missing something?

    Thanks in advance.
     
    Last edited: May 15, 2018
    #1
  2. GGZiron

    GGZiron Veteran Veteran

    Messages:
    55
    Likes Received:
    10
    Location:
    Bulgaria
    First Language:
    Bulgarian
    Primarily Uses:
    RMVXA
    Try adding this snippet in your project.
    Code:
    class Game_CharacterBase
     
    #======================New method==========================================
      def above_priority?
        @priority_type == 2
      end
    #=========================================================================
    
    #=====================Original method edit================================
        def move_straight(d, turn_ok = true)
        @move_succeed = passable?(@x, @y, d)
        if @move_succeed
          set_direction(d)
          @x = $game_map.round_x_with_direction(@x, d)
          @y = $game_map.round_y_with_direction(@y, d)
          @real_x = $game_map.x_with_direction(@x, reverse_dir(d))
          @real_y = $game_map.y_with_direction(@y, reverse_dir(d))
          increase_steps
          check_event_trigger_touch(@x, @y) if above_priority?
        elsif turn_ok
          set_direction(d)
          check_event_trigger_touch_front
        end
      end
    #===========================================================================
    
    end
    
    class Game_Event < Game_Character
     
    #=====================Original method edit================================
      def check_event_trigger_touch(x, y)
        return if $game_map.interpreter.running?
        if @trigger == 2 && $game_player.pos?(x, y)
          start if !jumping? &&   (normal_priority? || above_priority? )
        end
      end
    #===========================================================================
    end  
    Seems the default engine checks for event touch only with normal priority events, which is why I edited it a little. And for being a "Through" event, I altered it so it checks for touch event even in succeseful movement, as long the moving event is above player priority. Hope it helps.
     
    #2
    gsuk likes this.
  3. gsuk

    gsuk Veteran Veteran

    Messages:
    101
    Likes Received:
    9
    Location:
    Prague
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hey. Thanks for the reply. It looks great.

    I'm not so hot when it comes to scripts, so can you tell me where i should put this? It looks like it's more than just a copy/paste job :)
     
    #3
  4. GGZiron

    GGZiron Veteran Veteran

    Messages:
    55
    Likes Received:
    10
    Location:
    Bulgaria
    First Language:
    Bulgarian
    Primarily Uses:
    RMVXA
    It is just copy and paste job :). It is in Tools > Script editor, under ▼ Materials, above ▼ Main Process.
    Copy paste it there, then try again. The event must be above player priority, "event touch" trigger, and "Through" enabled so the event(your flyer monster) is able to fly over other events and the player.
     
    #4
  5. gsuk

    gsuk Veteran Veteran

    Messages:
    101
    Likes Received:
    9
    Location:
    Prague
    First Language:
    English
    Primarily Uses:
    RMVXA
    The 'through' is still causing me problems. Without it, it works perfectly with 'above character' selected, but when i put 'through' on, i still find it hard to make contact with the event - the event literally goes 'through' me when i approach it. after a few tries, i can make contact, but it's not ideal :(
     
    #5
  6. GGZiron

    GGZiron Veteran Veteran

    Messages:
    55
    Likes Received:
    10
    Location:
    Bulgaria
    First Language:
    Bulgarian
    Primarily Uses:
    RMVXA
    Wait, did you added my snippet?
    It won't work if you don't.
     
    #6
  7. gsuk

    gsuk Veteran Veteran

    Messages:
    101
    Likes Received:
    9
    Location:
    Prague
    First Language:
    English
    Primarily Uses:
    RMVXA
    yes, I added it :) My comments were about the game after I added the snippet.
     
    #7
  8. GGZiron

    GGZiron Veteran Veteran

    Messages:
    55
    Likes Received:
    10
    Location:
    Bulgaria
    First Language:
    Bulgarian
    Primarily Uses:
    RMVXA
    That's weird. For me it works perfectly. Every single touch activates the event's active page.
    Edit: Is your game with enabled diagonal movement? Or other script?
     
    Last edited: May 16, 2018
    #8
  9. gsuk

    gsuk Veteran Veteran

    Messages:
    101
    Likes Received:
    9
    Location:
    Prague
    First Language:
    English
    Primarily Uses:
    RMVXA
    I think I've fixed it now.

    Thanks so much for your help - that was awesome :)
     
    #9
  10. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    4,006
    Likes Received:
    3,525
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    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.

     
    #10
Thread Status:
Not open for further replies.

Share This Page