CaistsaRpg
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[Script] sistema de teletransporte(KGC)

3 participantes

Ir abajo

[Script] sistema de teletransporte(KGC) Empty [Script] sistema de teletransporte(KGC)

Mensaje  jirachi Sáb Mar 29, 2008 10:55 pm

weno,este script,como dice el titulo,te teletransporta a un lugar por medio de una habilidad que en el script lo dice perfectamente,creas una nueva clase y pegas el script y luego lee las explicaciones,esta todo detallado en el script de como hacerlo para que funcione,hay va:

Código:

#==============================================================================
#  * Teletransportacion
#------------------------------------------------------------------------------
# - Script hecho por: KGC Software
# - Script traducido por: Lancelot
#------------------------------------------------------------------------------
#  * FUNCION:
#  - Te teletransportas a un lugar especifico mediante una magia.
#------------------------------------------------------------------------------
#  * COMO USARLO:
#  - Crea un nuevo atributo en la Base de Datos/Sistema y llamala
#    Teletransportacion
#  - Vete a la seccion "Habilidades" y crea una nueva habilidad, llamala como
#    quieras pero debes ponerle el atributo creado "Teletransportacion"
#  - Para teletransportarte debes saber a que lugar ir, y para eso debes usar el
#    Comando "Llamar Script" y en su interior denes poner lo siguiente:
#
#    add_teleport(name, id, x, y, Direc)
#
#  - Como podras darte cuenta en los parentecis debes poner el nombre y las
#    cordenadas:
#  - En "name" pones el nombre del lugar hacia donde quieres ir. Recuerda poner
#    las comillas Ej: "Playa".
#  - En "id" pones la ID del mapa.
#  - En "x" y "y" debes poner las cordenadas del lugar.(Te recomiendo que uses
#    el comando de eventos "teletransportar" hay te salen las cordenadas exactas
#    del lugar al que quieres ir).
#  - En "Direc" debes poner a que parte mira el personaje mediante numeros:
#    0 = Mira al mismo lugar que estaba antes
#    2 = Mira hacia Abajo
#    4 = Mira hacia la Izquierda
#    6 = Mira hacia la Derecha
#    8 = Mira hacia Arriba
#  - Ejemplo:
#        add_teleport("Montañas", 1, 8, 10, 8)
#------------------------------------------------------------------------------
#  * COMANDOS EXTRAS:
#    Todos estos deben ser usados con el comandos "Llamar Scripts"
#
#  - $game_system.teleport_permit = false : con esto no te permite
#    teletransportarte mas.
#
#  - $game_system.teleport_permit = true : esto permite volver a
#    teletransportarte.
#
#  - add_teleport_now_place = con esto agregas a la lista de
#    teletransportaciones el mapa en que estas ahora.
#
#  - delete_teleport(name) = con esto eliminas un mapa de la lista de
#    teletransportaciones, En "name" debes poner el nombre del mapa, NO la ID
#    del mapa.
#==============================================================================

module KGC
 # En las comillas le pones el sonido que se escuchara cuando te
 # teletransportes.
 TELEPORT_SE = RPG::AudioFile.new("018-Teleport01", 80)
end
$game_special_elements = {}
$imported = {}
$data_states = load_data("Data/States.rxdata")
$data_system = load_data("Data/System.rxdata")
$imported["Teleport"] = true

# Agrega el nombre del atributo
$game_special_elements["teleport"] = $data_system.elements.index("Teletransportacion")
#--------------------------------------------------------------------------
def add_teleport(name, id, x, y, dir = 2)
 for dest in $game_system.teleport_dest
  return if dest == nil || dest[0] == name
 end
 $game_system.teleport_dest.push([name, id, x, y, dir])
end
#--------------------------------------------------------------------------
def add_teleport_now_place
 place = [$game_map.map_name,
  $game_map.map_id,
  $game_player.x,
  $game_player.y,
  $game_player.direction]
 for dest in $game_system.teleport_dest
  return if dest == nil || dest[0] == place[0]
 end
 $game_system.teleport_dest.push(place)
end
#--------------------------------------------------------------------------
def delete_teleport(name)
 for dest in $game_system.teleport_dest
  next if dest == nil
  if dest[0] == name
    $game_system.teleport_dest.delete(dest)
    break
  end
 end
end

#==============================================================================
# * Game_Temp
#==============================================================================

class Game_Temp
 #--------------------------------------------------------------------------
 attr_accessor :teleport_calling       
 attr_accessor :teleport_item           
 attr_accessor :teleport_user         
 attr_accessor :teleport_cost_sp       
 #--------------------------------------------------------------------------
 alias initialize_KGC_Teleport initialize
 def initialize
  initialize_KGC_Teleport

  @teleport_item, @teleport_user = nil, nil
  @teleport_cost_sp, @teleport_calling = 0, false
 end
end

#==============================================================================
# * Game_System
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 attr_accessor :teleport_dest           
 attr_accessor :teleport_permit       
 #--------------------------------------------------------------------------
 alias initialize_KGC_Teleport initialize
 def initialize
  initialize_KGC_Teleport

  @teleport_dest, @teleport_permit = [], true
 end
end

#==============================================================================
# * Game_Map
#==============================================================================

class Game_Map
 #--------------------------------------------------------------------------
 def map_name
  mapinfo = load_data("Data/MapInfos.rxdata")
  return mapinfo[@map_id].name
 end
end

#==============================================================================
# * Window_Teleport
#==============================================================================

class Window_Teleport < Window_Selectable
 #--------------------------------------------------------------------------
 def initialize
  super(80, 80, 480, 320)
  @column_max = 2
  refresh
  self.back_opacity = 160
  self.visible = false
  self.index = 0
 end
 #--------------------------------------------------------------------------
 def dest
  return @data[self.index]
 end
 #--------------------------------------------------------------------------
 def refresh
  if self.contents != nil
    self.contents.dispose
    self.contents = nil
  end
  @data = []
  for dest in $game_system.teleport_dest
    next if dest == nil
    @data.push(dest)
  end
  @item_max = @data.size
  if @item_max > 0
    self.contents = Bitmap.new(width - 32, row_max * 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    for i in 0...@item_max
      draw_item(i)
    end
  end
 end
 #--------------------------------------------------------------------------
 def draw_item(index)
  dest = @data[index]
  x = 4 + index % 2 * 224
  y = index / 2 * 32
  self.contents.draw_text(x, y, 224, 32, dest[0], 0)
  self.contents.font.name = $fontface
  self.contents.font.size = $fontsize
 end
 #--------------------------------------------------------------------------
 def update_cursor_rect
  if @index < 0
    self.cursor_rect.empty
    return
  end
  row = @index / @column_max
  if row < self.top_row
    self.top_row = row
  end
  if row > self.top_row + (self.page_row_max - 1)
    self.top_row = row - (self.page_row_max - 1)
  end
  cursor_width = (self.width - 32) / @column_max
  x = @index % @column_max * cursor_width
  y = @index / @column_max * 32 - self.oy
  self.cursor_rect.set(x, y, cursor_width, 32)
 end
end

#==============================================================================
# * Scene_Map
#==============================================================================

class Scene_Map
 #--------------------------------------------------------------------------
 alias main_KGC_Teleport main
 def main
  @teleport_window = Window_Teleport.new
  main_KGC_Teleport
  @teleport_window.dispose
 end
 #--------------------------------------------------------------------------
 alias update_KGC_Teleport update
 def update
  update_KGC_Teleport
  unless $game_player.moving?
    if $game_temp.teleport_calling
      call_teleport
    end
  end
 end
 #--------------------------------------------------------------------------
 def call_teleport
  $game_temp.teleport_calling = false
  teleport_flag = false
  @teleport_window.refresh
  @teleport_window.opacity = 0
  @teleport_window.visible = true
  @teleport_window.active = true
  loop do
    @teleport_window.opacity += 16 if @teleport_window.opacity < 255
    @teleport_window.update
    Graphics.update
    Input.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      if $game_temp.teleport_item != nil
        item = $game_temp.teleport_item
        $game_party.gain_item(item.id, 1) if item.consumable
        $game_temp.teleport_item = nil
      elsif $game_temp.teleport_user != nil
        $game_temp.teleport_user.sp += $game_temp.teleport_cost_sp
        $game_temp.teleport_user = nil
        $game_temp.teleport_cost_sp = 0
      end
      Graphics.freeze
      break
    end
    if Input.trigger?(Input::C)
      dest = @teleport_window.dest
      if dest == nil
        $game_system.se_play($data_system.buzzer_se)
        next
      end
      $game_temp.player_new_map_id = dest[1]
      $game_temp.player_new_x = dest[2]
      $game_temp.player_new_y = dest[3]
      $game_temp.player_new_direction = dest[4]
      teleport_flag = true
      break
    end
  end
  @teleport_window.visible = false
  @teleport_window.active = false
  if teleport_flag
    $game_temp.player_transferring = true
    $game_temp.transition_processing = true
    Graphics.freeze
    if KGC::TELEPORT_SE.is_a?(RPG::AudioFile)
      $game_system.se_play(KGC::TELEPORT_SE)
    elsif KGC::TELEPORT_SE.is_a?(String)
      Audio.se_play("Audio/SE/" + KGC::TELEPORT_SE)
    end
    transfer_player
  else
    Graphics.transition
  end
 end
end

#==============================================================================
# * Scene_Item
#==============================================================================

class Scene_Item
 #--------------------------------------------------------------------------
 alias update_item_KGC_Teleport update_item
 def update_item
  if Input.trigger?(Input::C)
    @item = @item_window.item
    if @item != nil && @item.is_a?(RPG::Item) &&
        @item.element_set.include?($game_special_elements["teleport"])
      if $game_system.teleport_permit && @item.is_a?(RPG::Item) &&
          $game_party.item_can_use?(@item.id)
        $game_system.se_play(@item.menu_se)
        $game_party.lose_item(@item.id, 1) if @item.consumable
        $game_temp.teleport_item = @item
        $game_temp.teleport_calling = true
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      return
    end
  end
  update_item_KGC_Teleport
 end
end

#==============================================================================
# * Scene_Skill
#==============================================================================

class Scene_Skill
 #--------------------------------------------------------------------------
 alias update_skill_KGC_Teleport update_skill
 def update_skill
  if Input.trigger?(Input::C)
    @skill = @skill_window.skill
    if @skill != nil && @skill.element_set.include?($game_special_elements["teleport"])
      if @skill != nil && @actor.skill_can_use?(@skill.id) &&
          $game_system.teleport_permit
        $game_system.se_play(@skill.menu_se)
        @actor.sp -= @skill.sp_cost
        $game_temp.teleport_user = @actor
        $game_temp.teleport_cost_sp = @skill.sp_cost
        $game_temp.teleport_calling = true
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      return
    end
  end
  update_skill_KGC_Teleport
 end
end


Importante Debes tener el KGC_Module que esta en la recopilación de scripts para que funcione.
jirachi
jirachi
Hijo De Artemisa
Hijo De Artemisa

Cantidad de envíos : 55
Localización : perdido,si me encuentran avisenme.
Fecha de inscripción : 10/03/2008

Volver arriba Ir abajo

[Script] sistema de teletransporte(KGC) Empty Re: [Script] sistema de teletransporte(KGC)

Mensaje  encisam Dom Mar 30, 2008 3:57 pm

mmm, parece util aun que tambien ai otras formas,gracias por aportar jeje
encisam
encisam
Calificador
Calificador

Cantidad de envíos : 77
Edad : 30
Fecha de inscripción : 25/03/2008

Volver arriba Ir abajo

[Script] sistema de teletransporte(KGC) Empty Re: [Script] sistema de teletransporte(KGC)

Mensaje  PepDracko Dom Mar 30, 2008 9:32 pm

Holas!!

Esta bueno el script, lo usaré en algun proyecto.

PD desaparece.
avatar
PepDracko
Hijo De Artemisa
Hijo De Artemisa

Cantidad de envíos : 66
Edad : 28
Localización : In your room, above your sister
Fecha de inscripción : 10/03/2008

Volver arriba Ir abajo

[Script] sistema de teletransporte(KGC) Empty Re: [Script] sistema de teletransporte(KGC)

Mensaje  Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

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