[Script] "Exit Arrows" estilo Pokémon Esmeralda

Autor Original: Xavierux
Script por: Tustin2121

¿Qué son las "Exit Arrows"? Son las flechas que aparecen al acercarte a la salida de un determinado sitio, ya sea una casa o una cueva. Es decir, se utiliza sobre todo en mapas interiores. Esto ocurría en Pokémon Esmeralda (y posiblemente también en Rubí y Zafiro). ¿Cómo lo implementamos a nuestro fangame?

1. Abrimos el editor de scripts pulsando la tecla F11 o dando click en el icono de la tabla de nuestro proyecto.
2. Creamos un nuevo script encima de Main (click derecho sobre este y le damos a Insertar).
3. Pegamos el siguiente script:

Código:
################################################################################
# Simple Exit Arrows - by Tustin2121
#
# To use, set the graphic of your exit warp event to an arrow with
# the desired hue and name it "ExitArrow" (without the quotes).
#
# The below code will do the work of hiding and showing the arrow when needed.
################################################################################

class Game_Player < Game_Character
 # Run when the player turns.
 # The default version of this method is empty, so replacing it outright
 # like this is fine. You may want to double check, just in case, however.
 def pbCheckEventTriggerAfterTurning
   pxCheckExitArrows
 end
end

class Game_Character
 # Add accessors for some otherwise hidden options
 attr_accessor :step_anime
 attr_accessor :direction_fix
end

# Checks if the player is standing next to the exit arrow, facing it.
def pxCheckExitArrows(init=false)
 px = $game_player.x
 py = $game_player.y
 for event in $game_map.events.values
   next if !event.name[/^ExitArrow$/]
   case $game_player.direction
     when 2 #down
       event.transparent = !(px==event.x && py==event.y-1)
     when 8 #up
       event.transparent = !(px==event.x && py==event.y+1)
     when 4 #left
       event.transparent = !(px==event.x+1 && py==event.y)
     when 6 #right
       event.transparent = !(px==event.x-1 && py==event.y)
   end
   if init
     # This homogenizes the Exit Arrows to all act the same, that is
     # a slow flashing arrow. If you want to change the behavior,
     # change the values below.
     event.move_speed = 1
     event.walk_anime = false
     event.step_anime = true
     event.direction_fix = true
   end
 end
end

# Run on scene change, init them as well
Events.onMapSceneChange+=proc{|sender,e|
 pxCheckExitArrows(true)
}

# Run on every step taken
Events.onLeaveTile+=proc {|sender,e|
 pxCheckExitArrows
}

4. Aplicamos y aceptamos los cambios. A continuación, para hacer que se vean las flechas al acercarnos a una salida, tendremos que hacer lo siguiente:

  • -Insertar la siguiente imagen en nuestra carpeta Graphics/Characters (podéis usar otra):
  • [Imagen: latest?cb=20160418032221]
  • -Creamos un evento en el mapa que queramos y lo llamamos ExitArrow. También tenemos que marcar la opción Animación parado.-Asignamos un gráfico al evento, en este caso, la primera flecha blanca en la dirección que quieres que se muestre.

De esta forma, al acercarnos a dicho evento (que se presupone que será la salida), se mostrará la flecha blanca sucediéndose sus posteriores frames en la animación que recoge la imagen que habéis insertado.

Espero que os haya servido. ¡Un saludo!

Comentarios

  1. He usado el script y he visto que sólo se activa cuando estas mirando a la puerta, hay alguna forma de hacer que se active con estar delante aunque no lo estés mirando?

    ResponderEliminar
    Respuestas
    1. No lo he comprobado así que igual da error, pero prueba copiando cada parte de "when ... #dirección" debajo de todas las demás. Por ejemplo.

      when 2 #down
      event.transparent = !(px==event.x && py==event.y-1)
      event.transparent = !(px==event.x && py==event.y+1)
      event.transparent = !(px==event.x+1 && py==event.y)
      event.transparent = !(px==event.x-1 && py==event.y)

      Lo dicho, no estoy seguro si funcionará, pero prueba a ver.

      Eliminar
    2. He probado y no ha servido xD pero no te preocupes, ya trastearé a ver cómo hacerlo. Gracias!

      Eliminar
    3. Skyflyer podrias contactarme xfavor....

      Eliminar

Publicar un comentario