Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

BDR Event Counter v1.0

BDR Event Couter Version: 1.0 for RMVX
By: Fustel

Introduction
Well... did you ever notice those annoying cell door through wich you can speak to the prisonners behind, that you can open, and so on. In RPG Maker terms, they could be Event that sometimes act as Counter Tile (the one you can interact with Events placed behind), somotime don not.
I tried to imagine many solutions (creating an invisibl Counter Tile, calculating the second event position when activating the 'Counter' one, etc...), but to no avail. Or at least getting a confused thing...
So I had to to script the 'perfect' solution; ens then hers is another BRR script thing.

Features
  • Allow to interact to an evet through another one
  • The Counter flag is set/unset for each page of the event

Screenshots

Demo
http://www.mediafire.com/?t4o97l69afalr9m

Just try ecerything you can.
Notice that if to try to speak to the prisoner through the door while holding the key, he won't answer (page 2 of the door doesn't have the BDR_EVENT_COUNTER comment)

Script
Code:
#==============================================================================

# ** BDR Event Counter

#------------------------------------------------------------------------------

#  © Fustel, 2010

#  02/11/10

#  Version 1.0

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0 (02/11/10), Initial release

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#   - Place this script in the 'Materials' section

#   - To make en event a counter when a set page is active,

#       insert a comment in that page, containing the following line:

#         BDR_EVENT_COUTER

#------------------------------------------------------------------------------

# NOTES

#  - Only when the page with the tag is active will the event act as

#      a counter

#  - If the EventPage acts as a couter, its normal script is not run

#  - An EventPage acts as a couter if

#    - it contains the BDR_EVENT_COUTER comment

#    - both EventPages (the 'counter one and the one behind)

#        priority_tupe is set to 'same as character'

#    - both EventPages (the 'counter one and the one behind)

#        triggers is set to 'action button'

#=====================================================================

 

class Game_Event < Game_Character

  BDR_EVENT_COUTER  = "BDR_EVENT_COUTER"

 

  attr_reader :bdr_event_counter

 

  alias bdr_eventcounter_initialize initialize

  def initialize(map_id, event)

    @bdr_event_counter = false

    bdr_eventcounter_initialize(map_id, event)

  end

 

  alias bdr_eventcounter_setup setup

  def setup(new_page)

    bdr_eventcounter_setup( new_page)

    @bdr_event_counter = false

    if @page != nil

      for command in @page.list

        next unless [ 108, 408].include?( command.code)

        s = command.parameters[ 0].upcase.delete " "

        @bdr_event_counter = true if s == BDR_EVENT_COUTER.upcase

      end

    end

  end

end

 

class Game_Player < Game_Character

  alias bdr_eventcounter_check_event_trigger_there check_event_trigger_there

  def check_event_trigger_there(triggers)

    return false if $game_map.interpreter.running?

    result = false

    cnt = false

 

    front_x = $game_map.x_with_direction(@x, @direction)

    front_y = $game_map.y_with_direction(@y, @direction)

    front_front_x = $game_map.x_with_direction(front_x, @direction)

    front_front_y = $game_map.y_with_direction(front_y, @direction)

 

    for event in $game_map.events_xy(front_x, front_y)

      next if event == nil

      next unless event.priority_type == 1

      next unless event.trigger == 0

      next unless event.bdr_event_counter

      cnt = true

    end

 

    if cnt

      for event in $game_map.events_xy(front_front_x, front_front_y)

        next if event == nil

        next unless event.priority_type == 1

        next unless event.trigger == 0

        result = true

        event.start

      end

    end

 

    result = bdr_eventcounter_check_event_trigger_there(triggers) unless result

 

    return result

  end

end

Instructions
  • Copy the script in the 'Materials' section, below 'BDR Damage'
  • Insert a comment containg the following line in any page you want to act as a couter
    BDR_EVENT_COUNTER

FAQ

Compatibility
No issue known

Credits and Thanks
All done by myself

Author's Notes
  • Only when the page with the tag is active will the event act as a counter
  • If the EventPage acts as a couter, its normal script is not run
  • An EventPage acts as a couter if
    • it contains the BDR_EVENT_COUTER comment
    • both EventPages (the 'counter one and the one behind) priority_tupe is set to 'same as character'
    • both EventPages (the 'counter one and the one behind) triggers is set to 'action button'

And... do I have to say that 'f...' stands for 'funny' ?

Terms and Conditions
You may not use this in a commercial game without my explicit permission.
You may not post this script anywhere without my explict permission.
You must give me credit.
 
I like the idea, but wouldn't it be easier to event this with an invisible event? This is not criticism. I'm simply interested in knowing what are the script's strong points.
 
Did you ever try putting 2 events in the same location with the ditor. And even mhen you manage do do it (via a move event or something like that), which one is to be triggered ? Just a couple of questions that jumped into my mind...

Now the script exists, you just have to put your event, insert a comment, and write 'BDR_EVENT_COUNTER'. If you are too lazy, you can even copy/paste it ^^
 

mawk

Sponsor

in the case of a shopkeeper stationary behind a counter, this is easy to do with an invisible event on the counter itself (as you've both said), but having a periodically moving NPC behind an obstruction is tougher, and a lot more bulky in terms of eventing. this sounds like a pretty handy little fix! nice job, man.
 
In RMVX's A2 tileset, the farthest right tiles(usually the counters/desks/tables) all have a counter effect applied to them naturally. This effect is done within the Tilemap class and Game_Map class...
Code:
  def counter?(x, y)

    return false unless valid?(x, y)

    return @passages[@map.data[x, y, 0]] & 0x80 == 0x80

  end
...they are moved down 8 pixels, and anything event behind them will be activated if you 'talk' to the counter/table itself.

This makes that feature available to any event. Nice creation. I'll be using this.
 
Errr... I never tried scripting for RMXP. So I am not sur, but... just try the script as it is. It may work...or not. Just tell me.
 
About this XP request, I'm sorry, but as the Event class has neither a setup method nor a priority_type attribute, I don't think the script will work here. And I don't even know if the Map class has an event_xy method. But if this one exisit, then try removing the test on priority_type and renma setup ans its alis whith the proper method (perhpas initialize). The script, once imagined is very simple.

Good luck
 
FenixFyreX":2230tmt2 said:
In RMVX's A2 tileset, the farthest right tiles(usually the counters/desks/tables) all have a counter effect applied to them naturally. This effect is done within the Tilemap class and Game_Map class...
I'm pretty sure I've tried this... you definately beat me on that if it really works, I'll try it out when I get home O_o

@Twin: RMXP has a native support for this feature in the tileset editor, database. But yeah, I guess you need it for events ^^ Just saying.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top