Últimos temas
» [HPRPG] Harry Potter y la Piedra Filosofal
por xDiego Hoy a las 8:53 am

» Muz-taller: Charas
por Muzgar Ayer a las 6:24 pm

» (MAKER MV)Algunos aditamentos extras para el generador de charas ):
por Muzgar Ayer a las 5:39 pm

» [XP] Recopilación de charas con ropa moderna
por Muzgar Ayer a las 5:10 pm

» KyoDiscounts XP
por Muzgar Ayer a las 5:07 pm

» Nuevos cambios en el foro
por Muzgar Ayer a las 4:42 pm

» Chaos of Destiny - The Origin
por Ruben_modder Miér Dic 12, 2018 11:01 pm

» Necesito Bases de proyecto nuevo Maker MV
por Ruben_modder Miér Dic 12, 2018 2:23 pm

» necesito script para ver mi estado de EXP
por rapopero Miér Dic 12, 2018 7:46 am

» [Engine Vx Ace] Suelos Movedizos
por IvalteK_Dev Miér Dic 12, 2018 3:01 am

» [VX/Ace]PersonajesEscolares
por mdk3dd Mar Dic 11, 2018 3:30 pm

» Laminación [VXACE] [NUEVO LAVADO DE CARA!]
por Pocari Lun Dic 10, 2018 8:22 pm


(ACE) 2 Scripts para eventos

Ir abajo

(ACE) 2 Scripts para eventos

Mensaje por fatyguero el Vie Abr 03, 2015 4:29 pm

Pues que llevo unos dias haciendo un jueguito de futbol (seguramente ya habreis jugado mi pequeño engine) y como hacer colisionar eventos con eventos es muy dificil de hacer con engine, pues consegui este par de scripts que en union hacen que las opciones para eventos aumenten en gran medida:

Title: Custom Event Triggers Author: Hime:

Código:
=begin
#===============================================================================
 Title: Custom Event Triggers
 Author: Hime
 Date: Jan 28, 2015
--------------------------------------------------------------------------------
 ** Change log
 Jan 28, 2015
  - updated to support checking for event to event trigger on event move
 Oct 31, 2013
  - fixed bug where an event that had an event-to-event trigger could only be
    triggered when another event touches them, not when they touch another
    event. Still follows the same rules for the extended data
 Aug 22, 2013
  - fixed bug with event-to-event player triggering
 Apr 9, 2013
  - implemented parallel processing for all custom triggers
 Apr 8, 2013
  - added "region enter" trigger
  - added "region leave" trigger
 Apr 5, 2013
  - added "event_to_event" trigger
 Apr 4, 2013
  - added "timer_expire" trigger
  - Initial release
-------------------------------------------------------------------------------- 
 ** Terms of Use
 * Free to use in non-commercial projects
 * Contact me for commercial use
 * No real support. The script is provided as-is
 * Will do bug fixes, but no compatibility patches
 * Features may be requested but no guarantees, especially if it is non-trivial
 * Credits to Hime Works in your project
 * Preserve this header
--------------------------------------------------------------------------------
 ** Description
 
 This script provides additional event triggers.
 The built-in event triggers include
 
  Action Trigger
  Player Touch
  Event Touch
  Autorun
  Parallel Process
 
 This script provides additional triggers.
 
--------------------------------------------------------------------------------
 ** Installation
 
 Place this below Materials and above Main

--------------------------------------------------------------------------------
 ** Usage
 
 To specify a custom page trigger, create a comment of the form
 
  <page trigger: trigger_name>
 
 Where `trigger_name` is one of the available custom event triggers.
 
 -- Extended trigger data --
 
 This script adds "extended data" to the trigger.
 Certain triggers may use this data to determine how to run.
 
 The general format for extended trigger data is
 
  <page trigger: trigger_name ext_data>
 
 Where ext_data is any string. Check the reference to see what kinds of
 extended data may be required for each trigger.
 
 -- Parallel Triggers --
 
 All event pages using custom triggers can be set as parallel processes if
 you set the trigger to Parallel Process. However, the difference is that
 rather than running constantly, they will begin to run only when their
 activation condition is met. However, after they begin running they will
 continue to run until the page is changed.
 
--------------------------------------------------------------------------------
 ** Reference
 
 Here is a list of available triggers and their trigger timing. The timing
 indicates when the page will be checked.
 
 Name: Player_Leave
 Time: Triggered when the player steps off an event. Note that this means the
      event must have below-character priority.
  Ext: None
 
 Name: Timer_Expire
 Time: Triggered when the game timer expires (eg: it goes to zero)
  Ext: None

 Name: Event_To_Event
 Time: Triggered when an event comes into contact with another event (using the
      "event touch" rules)
  Ext: Takes a list of event ID's. Only the specified event ID's can trigger
      this event. When no ext data is specified, then any event can
      trigger this event. Use -1 if you want the player to trigger it as well
   
 Name: Region_Enter
 Time: Triggered when a player enters a particular region. Does not check if
      the player is already in the region
  Ext: Takes a list of region ID's
 
 Name: Region_Leave
 Time: Triggered when a player leaves a particular region
  Ext: Takes a list of region ID's
 
#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_CustomEventTriggers"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
  module Custom_Event_Triggers
   
#===============================================================================
# ** Rest of script
#===============================================================================
    Trigger_Table = {
      # default triggers
      :action_trigger    => 0,
      :player_touch      => 1,
      :event_touch      => 2,
      :autorun          => 3,
      :parallel_process  => 4,
     
      # custom triggers
      :player_leave      => 5,
      :timer_expire      => 6,
      :event_to_event    => 7,
      :region_enter      => 8,
      :region_leave      => 9
    }
   
    Regex = /<page[-_ ]trigger:\s*(\w+)\s*(.*)>/i
  end
end

#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
module RPG
  class Event::Page
   
    def parallel_process?
      return @old_trigger == 4
    end
   
    #---------------------------------------------------------------------------
    # Load any custom triggers, if necessary
    #---------------------------------------------------------------------------
    alias :th_custom_event_triggers_trigger :trigger
    def trigger
      parse_event_triggers unless @custom_event_triggers_checked
      th_custom_event_triggers_trigger
    end
   
    #---------------------------------------------------------------------------
    # Extended trigger data. Use depends on the trigger type
    #---------------------------------------------------------------------------
    def trigger_ext
      return @trigger_ext unless @trigger_ext.nil?
      parse_event_triggers unless @custom_event_triggers_checked
      return @trigger_ext
    end
   
    #---------------------------------------------------------------------------
    # Returns a symbol representing the trigger type. These are the keys in
    # the trigger table above
    #---------------------------------------------------------------------------
    def trigger_type
      return @trigger_type unless @trigger_type.nil?
      parse_event_triggers unless @custom_event_triggers_checked
      return @trigger_type
    end
   
    #---------------------------------------------------------------------------
    # Search for a page trigger comment
    #---------------------------------------------------------------------------
    def parse_event_triggers
      @old_trigger = @trigger
      @trigger_ext = ""
      @list.each do |cmd|
        if cmd.code == 108 && cmd.parameters[0] =~ TH::Custom_Event_Triggers::Regex
          @trigger_type = $1.downcase.to_sym
          @trigger = TH::Custom_Event_Triggers::Trigger_Table[@trigger_type]
          @trigger_ext = parse_extended_trigger($2)
        end
      end
      @custom_event_triggers_checked = true
    end
   
    #---------------------------------------------------------------------------
    # Parse the extended data according to the trigger type. Different triggers
    # may expect different input
    #---------------------------------------------------------------------------
    def parse_extended_trigger(data)
      case @trigger_type
      when :event_to_event, :region_enter, :region_leave
        @trigger_ext = data.split.map{|val| val.to_i}
      else
        @trigger_ext = data
      end
    end
  end
end

#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
class Game_Timer
 
  #-----------------------------------------------------------------------------
  # Check map events for any events that trigger on time expiry
  #-----------------------------------------------------------------------------
  alias :th_custom_event_triggers_on_expire :on_expire
  def on_expire
    th_custom_event_triggers_on_expire
    $game_map.events.each_value do |event|
      event.check_event_trigger_on_timer_expire([6])
    end
  end
end

#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
class Game_Player < Game_Character
 
  attr_reader :last_region_id
  attr_reader :last_x
  attr_reader :last_y
 
  alias :th_custom_event_triggers_update :update
  def update
    store_previous_position unless moving?
    th_custom_event_triggers_update
  end
 
  alias :th_custom_event_triggers_update_nonmoving :update_nonmoving
  def update_nonmoving(last_moving)
    th_custom_event_triggers_update_nonmoving(last_moving)
    return if $game_map.interpreter.running?
    if last_moving
      check_player_leave_event
      if @last_region_id != self.region_id
        check_player_region_enter_events
        check_player_region_leave_events
      end
    end
  end
 
  #-----------------------------------------------------------------------------
  # Check for events with event-to-event trigger as well, in case the player
  # also triggers it
  #-----------------------------------------------------------------------------
  alias :th_custom_event_triggers_check_event_trigger_touch :check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    th_custom_event_triggers_check_event_trigger_touch(x, y)
    return if $game_map.interpreter.running?
    check_event_to_event_touch(x, y, [7], true)
  end
 
  #-----------------------------------------------------------------------------
  # New. Keep track of most recent position
  #-----------------------------------------------------------------------------
  def store_previous_position
    @last_real_x = @real_x
    @last_real_y = @real_y
    @last_x = @x
    @last_y = @y
    @last_region_id = self.region_id
  end
 
  #-----------------------------------------------------------------------------
  # New. Determines if any events at the player's previous position should be
  # triggered
  #-----------------------------------------------------------------------------
  def check_player_leave_event
    check_event_trigger_before([5])
  end
 
  #-----------------------------------------------------------------------------
  # New. Check any events in the player's previous position
  #-----------------------------------------------------------------------------
  def check_event_trigger_before(triggers)
    start_map_event(@last_x, @last_y, triggers, false)
  end
 
  #-----------------------------------------------------------------------------
  # New. Check any events in the player's previous position
  #-----------------------------------------------------------------------------
  def check_player_region_enter_events
    $game_map.events.each_value do |event|
      event.check_event_trigger_on_region_enter
    end
  end
 
  def check_player_region_leave_events
    $game_map.events.each_value do |event|
      event.check_event_trigger_on_region_leave
    end
  end
 
  def check_event_to_event_touch(x, y, triggers, normal=false)
    $game_map.events_xy(x, y).each do |event|
      next unless event.trigger_in?(triggers) && event.normal_priority? == normal
      event.start if event.trigger_ext.empty? || event.trigger_ext.include?(-1)
    end
  end
end

class Game_Event < Game_Character
 
  alias :th_custom_event_triggers_start :start
  def start
    return if empty?
    if @page.parallel_process?
      @interpreter = Game_Interpreter.new
    else
      th_custom_event_triggers_start
    end
  end
 
  #-----------------------------------------------------------------------------
  # New. Returns the extended trigger data
  #-----------------------------------------------------------------------------
  def trigger_ext
    @page.nil? ? [] : @page.trigger_ext
  end
 
  #-----------------------------------------------------------------------------
  # Start an event if timer expires
  #-----------------------------------------------------------------------------
  def check_event_trigger_on_timer_expire(triggers)
    start if trigger_in?(triggers)
  end
 
  #-----------------------------------------------------------------------------
  # First check event touch with player, then event touch with event
  #-----------------------------------------------------------------------------
  alias :th_custom_event_triggers_check_event_trigger_touch :check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    th_custom_event_triggers_check_event_trigger_touch(x, y)   
    return if $game_map.interpreter.running? 
    check_event_to_event_touch(x, y, [7])
  end
 
  #-----------------------------------------------------------------------------
  # Check whether events coming into contact should trigger. If the current
  #-----------------------------------------------------------------------------
  def check_event_to_event_touch(x, y, triggers)
    events = $game_map.events_xy(x, y)
    canStart = trigger_in?(triggers)
    events.each do |event|
      return if event == self
      # start this event if the other event can trigger this event
      start if !@starting && canStart && (trigger_ext.empty? || trigger_ext.include?(event.id))
      next unless event.trigger_in?(triggers)
     
      # start the other event if this event can trigger the other event
      event.start if event.trigger_ext.empty? || event.trigger_ext.include?(@id)
    end
  end
 
  #-----------------------------------------------------------------------------
  # Check whether events should run due to player entering a region
  #-----------------------------------------------------------------------------
  def check_event_trigger_on_region_enter
    start if @trigger == 8 && trigger_ext.include?($game_player.region_id)
  end
 
  #-----------------------------------------------------------------------------
  # Check whether events should run due to player leaving a region
  #-----------------------------------------------------------------------------
  def check_event_trigger_on_region_leave
    start if @trigger == 9 && trigger_ext.include?($game_player.last_region_id)
  end
 
  alias :th_trigger_conditions_update :update
  def update
    last_real_x = @real_x
    last_real_y = @real_y
    last_moving = moving?
   
    th_trigger_conditions_update   
    update_nonmoving(last_moving) unless moving?
  end
 
  def update_nonmoving(last_moving)
    if last_moving
      check_event_to_event_touch(x, y, [7])
    end
  end
end


Breve explicacion:
Basicamente lo que hace este script es agregar mas opciones a las opciones de "Detonante" para los eventos,
Para activarlo basta con poner este comentario en la pagina del evento al principio de todo y antes de cualquier comando:
Código:
<page trigger: trigger_name ext_data>

Donde trigger_name es el comando a añadir de esta lista:
Donde ext_data es la informacion adicionarl referente a un evento en forma de ID, por ejemplo: # 1 hac referencia al evento con el ide 001 en el mapa.

Lista de nombres de detonantes:

player_leave: El detonante de inicio sera cuando el personaje se "Salga" de encima de un evento. Notese que el evento tiene que estar configurado como "Bajo el personaje" en este caso. No utiliza ext_data.

timer_expire: Detonante que activa los comandos cuando un contador que hayamos puesto llegue a 0. No nesecita ext_data

event_to_event: Detonante que activa los comandos cuando un evento "Colisiona" con otro evento. En este caso la ext_data seria el id del evento que lo "VA" a chocar, -1 es el personaje principal y 0 es el propio evento.

region_enter: El detonante se activara cuando el personaje entre en una determinada region. La ext_data sera la ID de la region en el programa.

region_leave: El detonante activara los comando cuando el personaje salga de una region en particular. La ext_data es lo mismo que el anterior.

Move Routes Author: Hime:

Código:
=begin
==============================================================================
 ** FP: Move Routes
 Author: Hime
 Date: Aug 17, 2012
------------------------------------------------------------------------------
 ** Change log
 Sep 3
  -added support for "compass-based" movement.
 Aug 17
  -fixed bug where custom move route causes freezing
 Jul 8
  -fixed bug where retrieving character on map was flawed
 May 17
  -Initial release
------------------------------------------------------------------------------
 Extends the move route system by providing more options.
 Acessible through move route scripts
 
 You can specify a sequence of move commands by typing a
 move-string
 
  moves("UDUDLRLR3R3R3L3L")
   
 U means up
 D means down
 L means left
 R means right.
 
 For diagonal movement, use the following
 Q is upper-left
 W is upper-right
 A is lower-left
 S is lower-right
 
 You can also specify some movement behavior.
 They all take an event ID corresponding to the
 event ID on the game map
 
  move_toward_event (event_id)
  move_from_event (event_id)
  turn_toward_event (event_id)
  turn_from_event (event_id)
 
 You can also play a balloon animation
 
  show_balloon(anim_id, event_id)
 
 0 is the event itself (can be omitted)
 -1 is the player
 other event ID's are events on the map
 
 Compass-based movement uses the compass directions to determine which
 direction to move. For example
 
  North direction = up
    move_north = up
    move_south = down
   
  North direction = left
    move_north = left
    move_south = right
   
 The following methods are available
 
  set_north(direction)
    -takes a numerical direction (2, 4, 6, 8) to specify the north dir
     
  move_north(count)
  move_south(count)
  move_west(count)
  move_east(count)
  turn_north
  turn_west
  turn_east
  turn_south
 
 Where `count` is the number of times you want to move in that direction
==============================================================================
=end
$imported = {} if $imported.nil?
$imported["FP_MoveRoutes"] = true
#==============================================================================
# ** Configuration.
#==============================================================================
module Feature_Plus
  module Move_Routes
   
    Move_String = /(\d*)([UDLRQWAS])/
  end
end
#==============================================================================
# ** Rest of the script.
#==============================================================================

class Game_Character < Game_CharacterBase
  include Feature_Plus::Move_Routes
 
  alias :fp_move_route_init_private_members :init_private_members
  def init_private_members
    fp_move_route_init_private_members
    @northDir = 8
    @jump_distance = 1
    @follow_distance = 0
  end
 
  def add_move(move_route, dir, num=1)
    num.times do |i|
      move_route.list.insert(move_route.list.size - 1, RPG::MoveCommand.new(dir))
    end
  end
 
  def get_character(id)
    if id < 0
      $game_player
    else
      $game_map.events[id > 0 ? id : @id]
    end
  end
 
  def show_animation(anim_id, event_id=0)
    character = get_character(event_id)
    return unless character   
    character.animation_id = anim_id
  end
 
  def show_balloon(anim_id, event_id=0)
    character = get_character(event_id)
    return unless character
    character.balloon_id = anim_id
  end
  #--------------------------------------------------------------------------
  # * Define move route using move string
  #--------------------------------------------------------------------------
  def moves(string)
    move_route = RPG::MoveRoute.new
    cmds = string.scan(Move_String)
    cmds.each do |cmd|
      num = cmd[0].empty? ? 1 : cmd[0].to_i rescue 1
      case cmd[1]
      when "U"; code = ROUTE_MOVE_UP
      when "D"; code = ROUTE_MOVE_DOWN
      when "L"; code = ROUTE_MOVE_LEFT
      when "R"; code = ROUTE_MOVE_RIGHT
      when "Q"; code = ROUTE_MOVE_UPPER_L
      when "W"; code = ROUTE_MOVE_UPPER_R
      when "A"; code = ROUTE_MOVE_LOWER_L
      when "S"; code = ROUTE_MOVE_LOWER_R
      end
      add_move(move_route, code, num)
    end
    # replace the script call
    @move_route.list.delete_at(@move_route_index)
    @move_route.list.insert(@move_route_index, *move_route.list[0...-1])
    @move_route_index -= 1
  end

  def move_pos(x, y)
    sx = distance_x_from(x)
    sy = distance_y_from(y)
    if sx.abs > 0
      move_straight(sx > 0 ? 4 : 6)
      move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy.abs != 0
    elsif sy.abs > 0
      move_straight(sy > 0 ? 8 : 2)
      move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx.abs != 0
    end
  end
 
  #--------------------------------------------------------------------------
  # * Convenience methods
  #--------------------------------------------------------------------------
  def move_down(count)
    count.times { move_straight(2)}
  end
 
  def move_left(count)
    count.times { move_straight(4)}
  end
 
  def move_right(count)
    count.times { move_straight(6)}
  end
 
  def move_up(count)
    count.times { move_straight(8)}
  end
 
  #--------------------------------------------------------------------------
  # * 4-dir compass-based movement, based on the which direction is "north".
  #--------------------------------------------------------------------------
 
  def set_north(direction)
    @northDir = direction
  end
 
  def move_north(count=1)
    case @northDir
    when 2
      move_down(count)
    when 4
      move_left(count)
    when 6
      move_right(count)
    when 8
      move_up(count)
    end
  end
 
  def move_west(count=1)
    case @northDir
    when 2
      move_right(count)
    when 4
      move_down(count)
    when 6
      move_up(count)
    when 8
      move_left(count)
    end
  end
 
  def move_east(count=1)
    case @northDir
    when 2
      move_left(count)
    when 4
      move_up(count)
    when 6
      move_down(count)
    when 8
      move_right(count)
    end
  end
 
  def move_south(count=1)
    case @northDir
    when 2
      move_up(count)
    when 4
      move_right(count)
    when 6
      move_left(count)
    when 8
      move_down(count)
    end
  end
 
  def turn_north
    case @northDir
    when 2
      set_direction(2)
    when 4
      set_direction(4)
    when 6
      set_direction(6)
    when 8
      set_direction(8)
    end
  end
 
  def turn_east
    case @northDir
    when 2
      set_direction(4)
    when 4
      set_direction(8)
    when 6
      set_direction(2)
    when 8
      set_direction(6)
    end
  end
 
  def turn_west
    case @northDir
    when 2
      set_direction(6)
    when 4
      set_direction(2)
    when 6
      set_direction(8)
    when 8
      set_direction(4)
    end
  end
 
  def turn_south
    case @northDir
    when 2
      set_direction(8)
    when 4
      set_direction(6)
    when 6
      set_direction(4)
    when 8
      set_direction(2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Move toward event, by event id
  #--------------------------------------------------------------------------
  def move_toward_event(event_id)
    event = get_character(event_id)
    move_toward_character(event)
  end
  #--------------------------------------------------------------------------
  # * Move away from event, by event id
  #--------------------------------------------------------------------------
  def move_from_event(event_id)
    event = get_character(event_id)
    move_away_from_character(event)
  end
  #--------------------------------------------------------------------------
  # * Turn toward event, by event id
  #--------------------------------------------------------------------------
  def turn_toward_event(event_id)
    event = get_character(event_id)
    turn_toward_character(event)
  end
  #--------------------------------------------------------------------------
  # * Turn away from event, by event id
  #--------------------------------------------------------------------------
  def turn_from_event(event_id)
    event = get_character(event_id)
    turn_away_from_character(event)
  end
 
  def mt_event(evt_id)
    move_toward_event(evt_id)
  end
 
  def mf_event(evt_id)
    move_from_event(evt_id)
  end
 
  def tt_event(evt_id)
    turn_toward_event(evt_id)
  end
 
  def tf_event(evt_id)
    turn_from_event(evt_id)
  end
end


Explicacion:
Este script añade mas opiones a las opciones de ruta de movimientos. Y se hacen mediante un "Script call" dentro de la ruta de movimiento para que sea mas sencilla de lo normal:

move(UDLR3U5D1LRLRLR) # esto seria una ruta via script.
D = abajo
U = arriba
R = derecha
L = izquierda
Numeros: cantidad de veces que ira para el lado definido antes.

Q = Arriba-izquierda
W = arriba-derecha
A = abajo-izquierda
S = abajo-derecha

Tambien se puede especificar movimientos nuevos tales como aproximarse a un evento y no solo al personaje:

move_toward_event (event_id) # mueve el evento hacia otro evento especifico
move_from_event (event_id) # mueve el evento desde un evento especifico
turn_toward_event (event_id) # mira a un evento especifico
turn_from_event (event_id) # mira al contrario de un evento especifico

Los demas comandos no los eh utilizado de momento por lo que no se exactamente como funcionan, pero creo que hacen que el evento siga una direccion automatica hasta llegar a un limite.


Y eso es todo, espero les sirva y se entienda mi explicacion ^^

Saluuuuuuuudos
avatar
fatyguero
PJ Principal
PJ Principal

Masculino
Argentina
RPG Maker : Ace
Mensajes : 341
Monedas : 377
Reputación : 94
Edad : 34
Localización : en el culo del mundo... digo el centro xD

Volver arriba Ir abajo

Re: (ACE) 2 Scripts para eventos

Mensaje por Er1ck_92 el Vie Abr 03, 2015 7:30 pm

Este script está genial para ampliar las posibilidades a la hora de hacer minijuegos! muy bueno! :D


_________________

MI JUEGO RPG MAKER VX ACE:

THE SCHOOL'S SURVIVORS 2
avatar
Er1ck_92
PJ Recurrente
PJ Recurrente

Argentina
RPG Maker : Ace
Mensajes : 87
Monedas : 150
Reputación : 5

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.