Autor Tópico: Visão para eventos  (Lida 834 vezes)

0 Membros e 1 Visitante estão vendo este tópico.

DarkLuar

  • Offline
  • *
  • Mensagens: 724
  • Sexo: Feminino
  • Hum?
  • Especialidade: Multifunção
  • Maker: RPG Maker XP
  • Prêmios
    Prêmio concedido aos vencedores do Concurso Semanal de Mapeamento Prêmio concedido aos vencedores do Concurso Semanal de Pixel Art Prêmio concedido ao vencedor do Concurso Mascote Santuário RPG Maker

      Contato
    • MSN Messenger - darkluar@hotmail.com
    • Ver Perfil
    • Meu Deviant
Visão para eventos
« : 22 de Maio de 2009, 20:18 »
Visão para eventos
por LB

.: Introdução :.
Esse script serve para que um evento possa "ver" o personagem se aproximar e reagir. Muito útil em batalhas ou fugas de prisão. Ele tem dois tipos de visão, a retangular e a triangular.

.: Características :.

  • Cria um campo de visão para o evento "ver" o personagem.

.: Screenshots :.
Não é possível demonstrar direito por screens.


.: Como usar :.

Visão do Evento

Citar
    @ = evento
    # = visão


    @ #########

    #
    ##
    ###
    @ ####
    ###
    ##
    #

Cole o script na seção de scrips adicionais. (acima do Main)
Use em um evento o chamar script e ponha por exemplo:

<>Comentário: triangulo
<>Comentário: 4
<>Iniciar Batalha: Slime*2
<>Apagar Evento Temporário

E escolha o Inimigo.


.: Demo :.

Não tem.

.: Script :.

Código: [Selecionar]
=begin #########################################################################
################### VISÃO PARA CHARS ##################### V 1.0.3 #############
################################################################################
################### POR: LB - ReinoRPG.com #####################################
################################################################################

  INSTRUÇÕES:
 
  Crie um evento e coloque-o em processo paralelo. Coloque seu movimento como
  preferir. Depois adicione um comentário que deve conter:
 
  "retangulo" OU "triangulo"
 
    - retangulo:
 
 @ ####
 
    - triangulo:
 
      #
    ##
    ###
 @ ####
    ###
    ##
      #
     
  Depois desse comentário com o tipo de visão adicione outro comentário, nele
  coloque o tamanho dessa visão. Depois dos dois comentários coloque os comandos
  que serão executados se o personagem for visto pelo evento. Lembre-se de
  trocar de pagina logo após esses comandos, para que não sejam executados
  novamente. Exemplos:
 
  1-
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
      #
      ##
    ###
    ####
 @ #####  << cinco tiles de visão
    ####
    ###
      ##
      #
     
  2-
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ #######  << sete tiles de visão

=end
class Game_Interpreter
  alias cont execute_command
  def execute_command
    if @list[0].code == 108 and @list[1].code == 108
      if @list[0].parameters[0] == "retangulo" or @list[0].parameters[0] == "triangulo"
        if eval("!"+@list[0].parameters[0]+"("+@event_id.to_s+","+@list[1].parameters[0]+")")
          command_end
          return true
        end
      end
    end
    cont
  end
  def retangulo(id,t)
    result = false
    x = $game_map.events[id].x
    y = $game_map.events[id].y
    x2 = $game_player.x
    y2 = $game_player.y
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        result = (x2 == x and y2 == y+i ? true : result)
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        result = (x2 == x-i and y2 == y ? true : result)
      end
    when 6 # Direita
      for i in 1...(t+1)
        result = (x2 == x+i and y2 == y ? true : result)
      end
    when 8 # Cima
      for i in 1...(t+1)
        result = (x2 == x and y2 == y-i ? true : result)
      end
    end
    return result
  end
  def triangulo(id,t)
    result = false
    x = $game_map.events[id].x
    y = $game_map.events[id].y
    x2 = $game_player.x
    y2 = $game_player.y
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        if x2 == x and y2 == y+i
          result = true
        end
        for a in 1...i
          if x2 == x-a and y2 == y+i
            result = true
          end
        end
        for a in 1...i
          if x2 == x+a and y2 == y+i
            result = true
          end
        end
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        if x2 == x-i and y2 == y
          result = true
        end
        for a in 1...i
          if x2 == x-i and y2 == y-a
            result = true
          end
        end
        for a in 1...i
          if x2 == x-i and y2 == y+a
            result = true
          end
        end
      end
    when 6 # Direita
      for i in 1...(t+1)
        if x2 == x+i and y2 == y
          result = true
        end
        for a in 1...i
          if x2 == x+i and y2 == y-a
            result = true
          end
        end
        for a in 1...i
          if x2 == x+i and y2 == y+a
            result = true
          end
        end
      end
    when 8 # Cima
      for i in 1...(t+1)
        if x2 == x and y2 == y-i
          result = true
        end
        for a in 1...i
          if x2 == x-a and y2 == y-i
            result = true
          end
        end
        for a in 1...i
          if x2 == x+a and y2 == y-i
            result = true
          end
        end
      end
    end
    return result
  end
end

.: Créditos e Agradecimentos :.
  • DarkLuar por disponibilizar
  • LB por criar.
« Última modificação: 22 de Julho de 2009, 14:59 por Atoa »
Registrado

aledrone759

  • Offline
  • *
  • Mensagens: 18
  • Sexo: Masculino
  • a vida é dura pra quem é mole!
  • Especialidade: Design
  • Maker: RPG Maker VX

    • Contato
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #1 : 23 de Fevereiro de 2010, 19:23 »
poxa gente,um script tosa bom e ninguem comento?
Registrado
se existe mal do mundo,ela reside no coração dos homens

Shin

  • Offline
  • *
  • Mensagens: 325
  • Sexo: Masculino
  • ~Blogshin~
  • Especialidade: Multifunção
  • Maker: Todos os Makers

    • Contato
    • Ver Perfil
    • Blogshin
    • Email
Re: Visão para eventos
« Resposta #2 : 23 de Fevereiro de 2010, 23:46 »
Eu curto bastante esse script. Comentei ele lá no Reino que foi aonde o próprio LB postou e, recetemente, atualizou.

Versão 1.1.3 - agora com bloqueios de visão!
Spoiler  :
Código: [Selecionar]
=begin #########################################################################
################### VISÃO PARA CHARS ##################### V 1.1.3 #############
################################################################################
################### POR: LB - ReinoRPG.com #####################################
################################################################################

  INSTRUÇÕES:
 
  Crie um evento e coloque-o em processo paralelo. Coloque seu movimento como
  preferir. Depois adicione um comentário que deve conter:
 
  "retangulo" OU "triangulo"
 
     - retangulo:
 
 @ ####
 
     - triangulo:
 
      #
     ##
    ###
 @ ####
    ###
     ##
      #
     
  Depois desse comentário com o tipo de visão adicione outro comentário, nele
  coloque o tamanho dessa visão. Depois dos dois comentários coloque os comandos
  que serão executados se o personagem for visto pelo evento. Lembre-se de
  trocar de pagina logo após esses comandos, para que não sejam executados
  novamente. Exemplos:
 
  1-
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ###
    ####
 @ #####    << cinco tiles de visão
    ####
     ###
      ##
       #
       
  2-
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ #######  << sete tiles de visão
 
 Em caso de bloqueio, na visão retangular:
 
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ ###|     << a visão é interrompida apartir do obstáculo
 
 na visão triangular:
 
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ##
    #|
 @ ####     << o bloqueio interrompe a visão também em formato triangular
    ####
     ###
      ##
       #

=end
class Game_Interpreter
  alias cont execute_command
  def execute_command
    if @list[0].code == 108 and @list[1].code == 108
      if @list[0].parameters[0] == "retangulo" or @list[0].parameters[0] == "triangulo"
        if eval("!"+@list[0].parameters[0]+"("+@event_id.to_s+","+@list[1].parameters[0]+")")
          command_end
          return true
        end
      end
    end
    cont
  end
  def retangulo(id,t)
    result = false
    x, y = $game_map.events[id].x, $game_map.events[id].y
    x2, y2 = $game_player.x, $game_player.y
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y+i)
        result = (x2 == x and y2 == y+i ? true : result)
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        break if !$game_map.passable?(x-i, y)
        result = (x2 == x-i and y2 == y ? true : result)
      end
    when 6 # Direita
      for i in 1...(t+1)
        break if !$game_map.passable?(x+i, y)
        result = (x2 == x+i and y2 == y ? true : result)
      end
    when 8 # Cima
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y-i)
        result = (x2 == x and y2 == y-i ? true : result)
      end
    end
    return result
  end
  def triblock(x, y, t, invisible)
    x2 = $game_player.x
    y2 = $game_player.y
    for i2 in 1...(t+1)
      invisible << [x, y+i2] if x2 == x and y2 == y+i2
      for a2 in 1...i2
        invisible << [x-a2, y+i2] if x2 == x-a2 and y2 == y+i2
      end
      for a2 in 1...i2
        invisible << [x+a2, y+i2] if x2 == x+a2 and y2 == y+i2
      end
    end
  end
  def triangulo(id,t)
    result = false
    x = $game_map.events[id].x
    y = $game_map.events[id].y
    x2 = $game_player.x
    y2 = $game_player.y
    invisible = []
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        result = [x, y+i] if x2 == x and y2 == y+i
        triblock(x, y+i, t, invisible) if !$game_map.passable?(x, y+i)
        for a in 1...i
          result = [x-a, y+i] if x2 == x-a and y2 == y+i
          triblock(x-a, y+i, t, invisible) if !$game_map.passable?(x-a, y+i)
        end
        for a in 1...i
          result = [x+a, y+i] if x2 == x+a and y2 == y+i
          triblock(x+a, y+i, t, invisible) if !$game_map.passable?(x+a, y+i)
        end
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        result = true if x2 == x-i and y2 == y
        triblock(x-i, y, t, invisible) if !$game_map.passable?(x-i, y)
        for a in 1...i
          result = true if x2 == x-i and y2 == y-a
          triblock(x-i, y-a, t, invisible) if !$game_map.passable?(x-i, y-a)
        end
        for a in 1...i
          result = true if x2 == x-i and y2 == y+a
          triblock(x-i, y+a, t, invisible) if !$game_map.passable?(x-i, y+a)
        end
      end
    when 6 # Direita
      for i in 1...(t+1)
        result = true if x2 == x+i and y2 == y
        triblock(x+i, y, t, invisible) if !$game_map.passable?(x+i, y)
        for a in 1...i
          result = true if x2 == x+i and y2 == y-a
          triblock(x+i, y-a, t, invisible) if !$game_map.passable?(x+i, y-a)
        end
        for a in 1...i
          result = true if x2 == x+i and y2 == y+a
          triblock(x+i, y+a, t, invisible) if !$game_map.passable?(x+i, y+a)
        end
      end
    when 8 # Cima
      for i in 1...(t+1)
        result = true if x2 == x and y2 == y-i
        triblock(x, y-i, t, invisible) if !$game_map.passable?(x, y-i)
        for a in 1...i
          result = true if x2 == x-a and y2 == y-i
          triblock(x-a, y-i, t, invisible) if !$game_map.passable?(x-a, y-i)
        end
        for a in 1...i
          result = true if x2 == x+a and y2 == y-i
          triblock(x+a, y-i, t, invisible) if !$game_map.passable?(x+a, y-i)
        end
      end
    end
    return (!invisible.include?(result) and result)
  end
end

Tenho feito algumas experiências com ele para eliminar os encontros aleatórios.
 :SRM 57:
Registrado
~SHIN~


Eurritimia

  • Offline
  • *
  • Mensagens: 220
  • Sexo: Masculino
  • Especialidade: Design
  • Maker: RPG Maker VX

    • Contato
    • Ver Perfil
    • http://eurritz.deviantart.com
    • Email
Re: Visão para eventos
« Resposta #3 : 24 de Fevereiro de 2010, 13:53 »
Shin, como funciona esse bloqueio de visão? O que tenho de colocar no evento pra fazer que ele vire um "obstáculo"?
Registrado

Shin

  • Offline
  • *
  • Mensagens: 325
  • Sexo: Masculino
  • ~Blogshin~
  • Especialidade: Multifunção
  • Maker: Todos os Makers

    • Contato
    • Ver Perfil
    • Blogshin
    • Email
Re: Visão para eventos
« Resposta #4 : 24 de Fevereiro de 2010, 22:03 »
@Eurritimia: Algum elemento não-passável dos tiles. Tipo uma árvore ou uma parede.
Registrado
~SHIN~


luska

  • Offline
  • *
  • Mensagens: 136
  • Sexo: Masculino
  • Herrar é umano.
  • Especialidade: Eventos
  • Maker: RPG Maker XP

    • Contato
    • MSN Messenger - pike_lucas@hotmail.com
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #5 : 02 de Março de 2010, 20:45 »
puts vei, me arranja um desse pra xp? ;P
Registrado


Habilidades Makers:
Roteirista:          9
Mapper:             9
Eventos:            8
Designer:          5
Essas são as áreas que me interessam. Estou aprendendo cada vez mais para ultrapassar meus fãs :)

doughq

  • Offline
  • *
  • Mensagens: 33
  • Sexo: Masculino
  • -Guardiao Maker-
  • Especialidade: Multifunção
  • Maker: RPG Maker VX

    • Contato
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #6 : 03 de Maio de 2010, 16:37 »
   Este Script e realmente otimo, da para criar otimos puzzles e eventos com ele parabens para quem o criou
Registrado
Visitante veja Meus Desenhos no Topico e Avalie.

gpj252

  • Offline
  • *
  • Mensagens: 156
  • Sexo: Masculino
  • eu posso nao ser o melhor, mas dou meu melhor
  • Especialidade: Nenhuma
  • Maker: Nenhum Específico

    • Contato
    • MSN Messenger - gabriel.p.j@hotmail.com
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #7 : 03 de Maio de 2010, 16:51 »
eu tinha feito um um poko menos complexo uma vez e completamente por eventos, mas ele tbm tinha um sistema de audiçao, eu acho até que eu trouxe pra ca...
mas parabens pelo script, bom tbm :SRM 67:
« Última modificação: 03 de Maio de 2010, 16:53 por gpj252 »
Registrado


Gabriel Winchester

  • Offline
  • *
  • Mensagens: 484
  • Sexo: Masculino
  • Hacredista/Santuarista
  • Especialidade: Multifunção
  • Maker: RPG Maker XP
  • Prêmios
    Prêmio concedido aos vencedores do Concurso Semanal de Mapeamento Prêmio concedido aos vencedores do Evento Projeto do Mês

      Contato
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #8 : 03 de Maio de 2010, 17:17 »
Alguém poderia me dizer se existe uma versão para XP?  :SRM 1:
Registrado



gpj252

  • Offline
  • *
  • Mensagens: 156
  • Sexo: Masculino
  • eu posso nao ser o melhor, mas dou meu melhor
  • Especialidade: Nenhuma
  • Maker: Nenhum Específico

    • Contato
    • MSN Messenger - gabriel.p.j@hotmail.com
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #9 : 03 de Maio de 2010, 17:32 »
o que eu tinha feito por eventos dava no xp, mas pesa muito, ja o da dark nao deu no xp(pelo menos aqui) e eu nunca vi um script desse pro xp :SRM 36:
Registrado


Alex Crosslight

  • Offline
  • *
  • Mensagens: 1391
  • Sexo: Masculino
  • Eternal Cross
  • Especialidade: Multifunção
  • Maker: Todos os Makers
  • Prêmios
    Prêmio concedido aos vencedores do Evento Projeto do Mês Prêmio concedido aos vencedores do Concurso Semanal de Roteiro

      Contato
    • MSN Messenger - akimenerus_rxbiodegenerate@hotmail.com
    • Ver Perfil
    • Ateliê Cross
    • Email
Re: Visão para eventos
« Resposta #10 : 03 de Maio de 2010, 18:17 »
Modifiquei esse script para que seja compativel para o XP, bastava mudar a class Interpreter (que no VX é Game_Interpreter enquanto no XP é apenas Interpreter) e arrumar alguns argumentos. As instruções são as mesmas.

Código: [Selecionar]
=begin #########################################################################
################### VISÃO PARA CHARS XP ##################### V 1.1.3 #############
################################################################################
############## Original VX por LB - ReinoRPG.com#####################################
################### Versão XP por Akimenerus#####################################
################################################################################

  INSTRUÇÕES:
 
  Crie um evento e coloque-o em processo paralelo. Coloque seu movimento como
  preferir. Depois adicione um comentário que deve conter:
 
  "retangulo" OU "triangulo"
 
     - retangulo:
 
 @ ####
 
     - triangulo:
 
      #
     ##
    ###
 @ ####
    ###
     ##
      #
     
  Depois desse comentário com o tipo de visão adicione outro comentário, nele
  coloque o tamanho dessa visão. Depois dos dois comentários coloque os comandos
  que serão executados se o personagem for visto pelo evento. Lembre-se de
  trocar de pagina logo após esses comandos, para que não sejam executados
  novamente. Exemplos:
 
  1-
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ###
    ####
 @ #####    << cinco tiles de visão
    ####
     ###
      ##
       #
       
  2-
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ #######  << sete tiles de visão
 
 Em caso de bloqueio, na visão retangular:
 
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ ###|     << a visão é interrompida apartir do obstáculo
 
 na visão triangular:
 
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ##
    #|
 @ ####     << o bloqueio interrompe a visão também em formato triangular
    ####
     ###
      ##
       #

=end
class Interpreter
  alias cont execute_command
  def execute_command
    if @list[0].code == 108 and @list[1].code == 108
      if @list[0].parameters[0] == "retangulo" or @list[0].parameters[0] == "triangulo"
        if eval("!"+@list[0].parameters[0]+"("+@event_id.to_s+","+@list[1].parameters[0]+")")
          command_end
          return true
        end
      end
    end
    cont
  end
  def retangulo(id,t)
    result = false
    x, y = $game_map.events[id].x, $game_map.events[id].y
    x2, y2 = $game_player.x, $game_player.y
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y+i, x-1)
        result = (x2 == x and y2 == y+i ? true : result)
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        break if !$game_map.passable?(x-i, y, x-1)
        result = (x2 == x-i and y2 == y ? true : result)
      end
    when 6 # Direita
      for i in 1...(t+1)
        break if !$game_map.passable?(x+i, y, x-1)
        result = (x2 == x+i and y2 == y ? true : result)
      end
    when 8 # Cima
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y-i, x-1)
        result = (x2 == x and y2 == y-i ? true : result)
      end
    end
    return result
  end
  def triblock(x, y, t, invisible)
    x2 = $game_player.x
    y2 = $game_player.y
    for i2 in 1...(t+1)
      invisible << [x, y+i2] if x2 == x and y2 == y+i2
      for a2 in 1...i2
        invisible << [x-a2, y+i2] if x2 == x-a2 and y2 == y+i2
      end
      for a2 in 1...i2
        invisible << [x+a2, y+i2] if x2 == x+a2 and y2 == y+i2
      end
    end
  end
  def triangulo(id,t)
    result = false
    x = $game_map.events[id].x
    y = $game_map.events[id].y
    x2 = $game_player.x
    y2 = $game_player.y
    invisible = []
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        result = [x, y+i] if x2 == x and y2 == y+i
        triblock(x, y+i, t, invisible) if !$game_map.passable?(x, y+i, t)
        for a in 1...i
          result = [x-a, y+i] if x2 == x-a and y2 == y+i
          triblock(x-a, y+i, t, invisible) if !$game_map.passable?(x-a, y+i, t)
        end
        for a in 1...i
          result = [x+a, y+i] if x2 == x+a and y2 == y+i
          triblock(x+a, y+i, t, invisible) if !$game_map.passable?(x+a, y+i, t)
        end
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        result = true if x2 == x-i and y2 == y
        triblock(x-i, y, t, invisible) if !$game_map.passable?(x-i, y)
        for a in 1...i
          result = true if x2 == x-i and y2 == y-a
          triblock(x-i, y-a, t, invisible) if !$game_map.passable?(x-i, y-a)
        end
        for a in 1...i
          result = true if x2 == x-i and y2 == y+a
          triblock(x-i, y+a, t, invisible) if !$game_map.passable?(x-i, y+a)
        end
      end
    when 6 # Direita
      for i in 1...(t+1)
        result = true if x2 == x+i and y2 == y
        triblock(x+i, y, t, invisible) if !$game_map.passable?(x+i, y)
        for a in 1...i
          result = true if x2 == x+i and y2 == y-a
          triblock(x+i, y-a, t, invisible) if !$game_map.passable?(x+i, y-a)
        end
        for a in 1...i
          result = true if x2 == x+i and y2 == y+a
          triblock(x+i, y+a, t, invisible) if !$game_map.passable?(x+i, y+a)
        end
      end
    when 8 # Cima
      for i in 1...(t+1)
        result = true if x2 == x and y2 == y-i
        triblock(x, y-i, t, invisible) if !$game_map.passable?(x, y-i)
        for a in 1...i
          result = true if x2 == x-a and y2 == y-i
          triblock(x-a, y-i, t, invisible) if !$game_map.passable?(x-a, y-i)
        end
        for a in 1...i
          result = true if x2 == x+a and y2 == y-i
          triblock(x+a, y-i, t, invisible) if !$game_map.passable?(x+a, y-i)
        end
      end
    end
    return (!invisible.include?(result) and result)
  end
end

Divirtem-se ^^

Atenciosamente

Akimenerus
Registrado



Gabriel Winchester

  • Offline
  • *
  • Mensagens: 484
  • Sexo: Masculino
  • Hacredista/Santuarista
  • Especialidade: Multifunção
  • Maker: RPG Maker XP
  • Prêmios
    Prêmio concedido aos vencedores do Concurso Semanal de Mapeamento Prêmio concedido aos vencedores do Evento Projeto do Mês

      Contato
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #11 : 03 de Maio de 2010, 18:21 »
Muito obrigado AKime, eu já ia me preparar para tentar uma conversão xD

o/
Registrado



luska

  • Offline
  • *
  • Mensagens: 136
  • Sexo: Masculino
  • Herrar é umano.
  • Especialidade: Eventos
  • Maker: RPG Maker XP

    • Contato
    • MSN Messenger - pike_lucas@hotmail.com
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #12 : 03 de Maio de 2010, 19:56 »
opa, vlw akimi ^^
gpj, como é esse sistema de audição?
« Última modificação: 03 de Maio de 2010, 19:57 por luska »
Registrado


Habilidades Makers:
Roteirista:          9
Mapper:             9
Eventos:            8
Designer:          5
Essas são as áreas que me interessam. Estou aprendendo cada vez mais para ultrapassar meus fãs :)

gpj252

  • Offline
  • *
  • Mensagens: 156
  • Sexo: Masculino
  • eu posso nao ser o melhor, mas dou meu melhor
  • Especialidade: Nenhuma
  • Maker: Nenhum Específico

    • Contato
    • MSN Messenger - gabriel.p.j@hotmail.com
    • Ver Perfil
    • Email
Re: Visão para eventos
« Resposta #13 : 03 de Maio de 2010, 20:10 »
é por switchs, se voce pisa em um galho por exemplo, o evento executa o barulho do galho quebrando e ativa uma switch que dentro do evento do monstro ativa a funçao dele seguir voce...
Registrado


Czarine

  • Offline
  • *
  • Mensagens: 146
  • Sexo: Masculino
  • L.A.R.D.
  • Especialidade: Scripts
  • Maker: RPG Maker XP

    • Contato
    • MSN Messenger - phcs666@hotmail.com
    • Ver Perfil
    • Orkut
    • Email
Re: Visão para eventos
« Resposta #14 : 04 de Maio de 2010, 00:33 »
@Akime

Parabens e valeu pela verssão XP, vc só esqueceu de por um ", t" no fim de algumas linhas e isso tava dando erro quando o evento olhava para cima ou para os lados ( vc só testou com o evento olhando pra baixo né ? xD ), ai vai a verssão corrigida:

Código: [Selecionar]
=begin #########################################################################
################### VISÃO PARA CHARS XP ##################### V 1.1.3 #############
################################################################################
############## Original VX por LB - ReinoRPG.com#####################################
################### Versão XP por Akimenerus#####################################
################################################################################

  INSTRUÇÕES:
 
  Crie um evento e coloque-o em processo paralelo. Coloque seu movimento como
  preferir. Depois adicione um comentário que deve conter:
 
  "retangulo" OU "triangulo"
 
     - retangulo:
 
 @ ####
 
     - triangulo:
 
      #
     ##
    ###
 @ ####
    ###
     ##
      #
     
  Depois desse comentário com o tipo de visão adicione outro comentário, nele
  coloque o tamanho dessa visão. Depois dos dois comentários coloque os comandos
  que serão executados se o personagem for visto pelo evento. Lembre-se de
  trocar de pagina logo após esses comandos, para que não sejam executados
  novamente. Exemplos:
 
  1-
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ###
    ####
 @ #####    << cinco tiles de visão
    ####
     ###
      ##
       #
       
  2-
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ #######  << sete tiles de visão
 
 Em caso de bloqueio, na visão retangular:
 
  Comentário: retangulo
  Comentário: 7
  <Comandos>
 
 @ ###|     << a visão é interrompida apartir do obstáculo
 
 na visão triangular:
 
  Comentário: triangulo
  Comentário: 5
  <Comandos>
 
       #
      ##
     ##
    #|
 @ ####     << o bloqueio interrompe a visão também em formato triangular
    ####
     ###
      ##
       #

=end
class Interpreter
  alias cont execute_command
  def execute_command
    if @list[0].code == 108 and @list[1].code == 108
      if @list[0].parameters[0] == "retangulo" or @list[0].parameters[0] == "triangulo"
        if eval("!"+@list[0].parameters[0]+"("+@event_id.to_s+","+@list[1].parameters[0]+")")
          command_end
          return true
        end
      end
    end
    cont
  end
  def retangulo(id,t)
    result = false
    x, y = $game_map.events[id].x, $game_map.events[id].y
    x2, y2 = $game_player.x, $game_player.y
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y+i, x-1)
        result = (x2 == x and y2 == y+i ? true : result)
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        break if !$game_map.passable?(x-i, y, x-1)
        result = (x2 == x-i and y2 == y ? true : result)
      end
    when 6 # Direita
      for i in 1...(t+1)
        break if !$game_map.passable?(x+i, y, x-1)
        result = (x2 == x+i and y2 == y ? true : result)
      end
    when 8 # Cima
      for i in 1...(t+1)
        break if !$game_map.passable?(x, y-i, x-1)
        result = (x2 == x and y2 == y-i ? true : result)
      end
    end
    return result
  end
  def triblock(x, y, t, invisible)
    x2 = $game_player.x
    y2 = $game_player.y
    for i2 in 1...(t+1)
      invisible << [x, y+i2] if x2 == x and y2 == y+i2
      for a2 in 1...i2
        invisible << [x-a2, y+i2] if x2 == x-a2 and y2 == y+i2
      end
      for a2 in 1...i2
        invisible << [x+a2, y+i2] if x2 == x+a2 and y2 == y+i2
      end
    end
  end
  def triangulo(id,t)
    result = false
    x = $game_map.events[id].x
    y = $game_map.events[id].y
    x2 = $game_player.x
    y2 = $game_player.y
    invisible = []
    case $game_map.events[id].direction
    when 2 # Baixo
      for i in 1...(t+1)
        result = [x, y+i] if x2 == x and y2 == y+i
        triblock(x, y+i, t, invisible) if !$game_map.passable?(x, y+i, t)
        for a in 1...i
          result = [x-a, y+i] if x2 == x-a and y2 == y+i
          triblock(x-a, y+i, t, invisible) if !$game_map.passable?(x-a, y+i, t)
        end
        for a in 1...i
          result = [x+a, y+i] if x2 == x+a and y2 == y+i
          triblock(x+a, y+i, t, invisible) if !$game_map.passable?(x+a, y+i, t)
        end
      end
    when 4 # Esquerda
      for i in 1...(t+1)
        result = true if x2 == x-i and y2 == y
        triblock(x-i, y, t, invisible) if !$game_map.passable?(x-i, y, t)
        for a in 1...i
          result = true if x2 == x-i and y2 == y-a
          triblock(x-i, y-a, t, invisible) if !$game_map.passable?(x-i, y-a, t)
        end
        for a in 1...i
          result = true if x2 == x-i and y2 == y+a
          triblock(x-i, y+a, t, invisible) if !$game_map.passable?(x-i, y+a, t)
        end
      end
    when 6 # Direita
      for i in 1...(t+1)
        result = true if x2 == x+i and y2 == y
        triblock(x+i, y, t, invisible) if !$game_map.passable?(x+i, y, t)
        for a in 1...i
          result = true if x2 == x+i and y2 == y-a
          triblock(x+i, y-a, t, invisible) if !$game_map.passable?(x+i, y-a, t)
        end
        for a in 1...i
          result = true if x2 == x+i and y2 == y+a
          triblock(x+i, y+a, t, invisible) if !$game_map.passable?(x+i, y+a, t)
        end
      end
    when 8 # Cima
      for i in 1...(t+1)
        result = true if x2 == x and y2 == y-i
        triblock(x, y-i, t, invisible) if !$game_map.passable?(x, y-i, t)
        for a in 1...i
          result = true if x2 == x-a and y2 == y-i
          triblock(x-a, y-i, t, invisible) if !$game_map.passable?(x-a, y-i, t)
        end
        for a in 1...i
          result = true if x2 == x+a and y2 == y-i
          triblock(x+a, y-i, t, invisible) if !$game_map.passable?(x+a, y-i, t)
        end
      end
    end
    return (!invisible.include?(result) and result)
  end
end

Vlw Akime  :SRM 64: <--- melhor emotion de todos!

PS: esse script é uma maravilha, o sistema de bloquear a visão triangular é perfeito  :SRM 24:
« Última modificação: 04 de Maio de 2010, 00:35 por Czarine »
Registrado