Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


2 participantes

    Script de cheats

    Link
    Link
    Membro Ativo
    Membro Ativo


    Mensagens : 307
    Créditos : 35

    Script de cheats Empty Script de cheats

    Mensagem por Link Dom Fev 19, 2012 10:15 pm

    Função:
    Sistema de cheats usando o teclado, permite todas as letra e números.


    Instalação:
    Colocar os dois scripts acima de main.

    Utilização:
    Para ativar o script utilize:
    Código:

    $scene = Scene_Cheats.new

    ATENÇÃO, SÃO 2 SCRIPTS, CUIDADO PARA NÃO COPIAR OS 2 COMO SE
    FOSSE UM SÓ!

    Código:
    #=begin
    #===============================================================================
    # ** Input Script v2 - Este script foi primeiramente criado por
    #                        Cybersam e ela merece a maior parte do
    #                        crédito, Tudo o que fiz foi adicionar
    #                        algumas funções.
    #                        (Astro_Mech diz(traduzido))
    # ** Input Script v3 - O que ViniV fez neste script foi deixar os nomes
    #                        das teclas, adicionar novos caracteres,
    #                        consertar bugs, traduzir e adicionar a
    #                        função para escolher as teclas
    #                        utilizadas no jogo.
    #                        (Aster diz)
    #-------------------------------------------------------------------------------
    # Author    Cybersam
    # Versão  3.0
    # Data      08-03-08
    # Editado  Aster, Astro_mech e Mr.Mo
    #===============================================================================

    module Input
      #--------------------------------------------------------------------------
      # * Criação das variaveis
      #--------------------------------------------------------------------------
        Botoes = {}
        @keys = []
        @repea = []
        @pres = []
        @trigg = []
        Names = {}
        @trigg2 = []
        Digi = {}
        Shif = {}
      #--------------------------------------------------------------------------
      # * ID das teclas
      #--------------------------------------------------------------------------
        Mouse_Left = '1'
        Mouse_Right = '2'
        Mouse_Middle = '4'
        Mouse_Esq = '1'
        Mouse_Direita = '2'
        Mouse_Meio = '4'
        Back = '8'
        Tab = '9'
        Enter = '13'
        Shift = '16'
        Ctrl = '17'
        Alt = '18'
        Capslock = '20'
        Esc = '27'
        Space = '32'
        Pgup = 33
        Pgdn = 34
        End = 35
        Home = 36
        LT = 37
        UPs = 38
        RT = 39
        DN = 40
        EQ = 37
        CM = 38
        DR = 39
        BX = 40
        Printscreen = 44
        Ins = 45
        Del = 46
        Numberkeys = {}
        Numberkeys[0] = 48        # => 0
        Numberkeys[1] = 49        # => 1
        Numberkeys[2] = 50        # => 2
        Numberkeys[3] = 51        # => 3
        Numberkeys[4] = 52        # => 4
        Numberkeys[5] = 53        # => 5
        Numberkeys[6] = 54        # => 6
        Numberkeys[7] = 55        # => 7
        Numberkeys[8] = 56        # => 8
        Numberkeys[9] = 57        # => 9
        Numeros = Numberkeys
        Letters = {}
        Letters['A'] = 65
        Letters['B'] = 66
        Letters['C'] = 67
        Letters['D'] = 68
        Letters['E'] = 69
        Letters['F'] = 70
        Letters['G'] = 71
        Letters['H'] = 72
        Letters['I'] = 73
        Letters['J'] = 74
        Letters['K'] = 75
        Letters['L'] = 76
        Letters['M'] = 77
        Letters['N'] = 78
        Letters['O'] = 79
        Letters['P'] = 80
        Letters['Q'] = 81
        Letters['R'] = 82
        Letters['S'] = 83
        Letters['T'] = 84
        Letters['U'] = 85
        Letters['V'] = 86
        Letters['W'] = 87
        Letters['X'] = 88
        Letters['Y'] = 89
        Letters['Z'] = 90
        Leftwin = 91
        Rightwin = 92
        Winesq = 91
        Windir = 92
        Numberpad = {}
        Numberpad[0] = 96
        Numberpad[1] = 97
        Numberpad[2] = 98
        Numberpad[3] = 99
        Numberpad[4] = 100
        Numberpad[5] = 101
        Numberpad[6] = 102
        Numberpad[7] = 103
        Numberpad[8] = 104
        Numberpad[9] = 105
        Numerico = Numberpad
        Asterisconum = 106  # => *
        Maisnum = 107      # => +
        Menosnum = 109      # => -
        Delnum = 110        # => ,
        Barranum = 111      # => / 
        Fkeys = {}
        Fkeys[1] = 112
        Fkeys[2] = 113
        Fkeys[3] = 114
        Fkeys[4] = 115
        Fkeys[5] = 116
        Fkeys[6] = 117
        Fkeys[7] = 118
        Fkeys[8] = 119
        Fkeys[9] = 120
        Fkeys[10] = 121
        Fkeys[11] = 122
        Fkeys[12] = 123
        Letters['Ç'] = 186  # => ç Ç
        Letras = Letters
        Equal = 187        # => = +
        Comma = 188        # => , <
        Underscore = 189    # => - _
        Underline = 189    # => - _
        Dot = 190          # => . >
        Twodot = 191        # => ; :
        Quote = 192        # => ' "
        Backslash = 193    # => / ?
        Dotnum = 194        # => .
        Acento = 219        # => ´ `
        Rchaves = 220      # => ] }
        Lchaves = 221      # => [ {
        Tio = 222          # => ~ ^
        Slash = 226        # => \ |
      #--------------------------------------------------------------------------
      # * EDITE AQUI
      #--------------------------------------------------------------------------
      #Instruções:
      #1 - Leia pra que serve cada botão
      #2 - suba e escolha quais teclas você deseja que o botão seja
      #3 - decore o nome ou numero da tecla
      #3 - coloque como no seguinte exemplo:
      #  Botao['#'] = [Tecla1, Tecla2, Tecla3, Tecla4]
      #4 - se não quiser 4 teclas diferentes substitua o resto
      #    por 0 Ex:
      #  Botao['#'] = [Tecla1, Tecla2, 0, 0]
      # Obs: se quiser deixar as normais do RPG Maker XP, não mude nada.
      #--------------------------------------------------------------
        #Botão principal(usado para conversar, confirmar, etc.)
        Botoes['A'] = [Letters['C'], Enter, Space, 0]#C, Enter, Espaço
        #Botão secundário(para cancelar, abrir o menu, etc.)
        Botoes['B'] = [Letters['X'], Esc, Numberpad[0], 0]#X, Esc, 0(num)
        #Botão terciario(sem uso normal)
        Botoes['C'] = [Letters['Z'], Shift, 0, 0]#Z, Shift
        #Outros botoes(sem uso)
        Botoes['X'] = [Letters['D'], 0, 0, 0]#D
        Botoes['Y'] = [Letters['S'], 0, 0, 0]#S
        Botoes['Z'] = [Letters['A'], 0, 0, 0]#A
        #Botão L e R(Muda de herói ao trocar equips, ver status, etc.)
        Botoes['L'] = [Letters['Q'], Pgup, 0, 0]#Q, Page Up
        Botoes['R'] = [Letters['W'], Pgdn, 0, 0]#W, Page Doun
        #Setas(controla o personagem)
        Botoes['UP'] = [UPs, 0, 0, 0]#Cima
        Botoes['RT'] = [RT, 0, 0, 0]#Direita
        Botoes['LT'] = [LT, 0, 0, 0]#Esquerda
        Botoes['DN'] = [DN, 0, 0, 0]#Baixo
      #--------------------------------------------------------------------------
      # * FIM DA EDIÇÃO
      #--------------------------------------------------------------------------
        State = Win32API.new('user32','GetKeyState',['i'],'i')
        Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
    #-------------------------------------------------------------------------------
        USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
    #-------------------------------------------------------------------------------
      module_function
        #--------------------------------------------------------------------------
        def Input.getstate(key)
          !State.call(key).between?(0, 1)
        end
        #--------------------------------------------------------------------------
        def Input.testkey(key)
          Key.call(key) & 0x01 == 1
        end
        def Input.pressing
          @pres
        end
        def Input.triggering
          @trigg
        end
        def Input.repeating
          @repea
        end
        #--------------------------------------------------------------------------
        def Input.update
          @trigg = []
          @repea = []
          @pres = []
          for i in 1..226
            next if i == 112
            @pres.push(i) if Input.getstate(i)
            @repea.push(i) if Input.testkey(i)
            @trigg.push(i) if Input.getstate(i) and [email=!@trigg2.include?(i]!@trigg2.include?(i[/email])
          end
          @trigg2 = @pres
        end
        #--------------------------------------------------------------------------
        def Input.triggerd?(key)
          @trigg.include?(key.to_i)
        end
        #--------------------------------------------------------------------------
        def Input.repeated?(key)
          @repea.include?(key.to_i)
        end
        #--------------------------------------------------------------------------
        def Input.pressed?(key)
          @pres.include?(key.to_i)
        end
      #--------------------------------------------------------------------------
      # * 4 Diraction
      #--------------------------------------------------------------------------
        def Input.dir4
          return 2 if Input.press?(Botoes['DN'])
          return 4 if Input.press?(Botoes['LT'])
          return 6 if Input.press?(Botoes['RT'])
          return 8 if Input.press?(Botoes['UP'])
          return 0
        end
      #--------------------------------------------------------------------------
      # * 8 Diraction
      #--------------------------------------------------------------------------
        def Input.dir8
          return 1 if Input.press?(Botoes['DN']) and Input.press?(Botoes['LT'])
          return 3 if Input.press?(Botoes['DN']) and Input.press?(Botoes['RT'])
          return 7 if Input.press?(Botoes['UP']) and Input.press?(Botoes['LT'])
          return 9 if Input.press?(Botoes['UP']) and Input.press?(Botoes['RT'])
          return 2 if Input.press?(Botoes['DN'])
          return 4 if Input.press?(Botoes['LT'])
          return 6 if Input.press?(Botoes['RT'])
          return 8 if Input.press?(Botoes['UP'])
          return 0
        end
      #--------------------------------------------------------------------------
      # * Trigger (key)
      #--------------------------------------------------------------------------
      def trigger?(key)
        keys = check_key(key)
        for k in keys
          return true if Input.triggerd?(k)
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Repeat (key)
      #--------------------------------------------------------------------------
      def repeat?(key)
        keys = check_key(key)
        for k in keys
          return true if Input.repeated?(k)
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Press (key)
      #--------------------------------------------------------------------------
      def press?(key)
        keys = check_key(key)
        for k in keys
          return true if Input.pressed?(k)
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Check key (key)
      #-------------------------------------------------------------------------- 
      def check_key(key)
        keys = []
        if key.is_a?(Array)
          for i in key
            keys.push(check_key(i))
          end
        end
        strings = []
        case key
        when Input::DOWN
          strings.push('DN')
        when Input::UP
          strings.push('UP')
        when Input::LEFT
          strings.push('LT')
        when Input::RIGHT
          strings.push('RT')
        when Input::C
          strings.push('A')
        when Input::B
          strings.push('B')
        when Input::A
          strings.push('C')
        when Input::Z
          strings.push('X')
        when Input::Y
          strings.push('Y')
        when Input::X
          strings.push('Z')
        when Input::L
          strings.push('L')
        when Input::R
          strings.push('R')
        when Input::F5
          keys.push(Input::Fkeys[5])
        when Input::F6
          keys.push(Input::Fkeys[6])
        when Input::F7
          keys.push(Input::Fkeys[7])
        when Input::F8
          keys.push(Input::Fkeys[8])
        when Input::F9
          keys.push(Input::Fkeys[9])
        when Input::SHIFT
          keys.push(Input::Shift)
        when Input::CTRL
          keys.push(Input::Ctrl)
        when Input::ALT
          keys.push(Input::Alt)
        else
          keys.push(key)
        end
        if strings.size > 0
          for i in strings
            bt = add_botoes(i)
            for i2 in bt
              keys.push(i2)
            end
          end
        end
        k = keys
        keys = []
        for i in k
          i = [i] if !i.is_a?(Array)
          for i2 in i
            keys.push(i2)
          end
        end
        return keys
      end
      #--------------------------------------------------------------------------
      # * Adiciona botões (key)
      #--------------------------------------------------------------------------
      def add_botoes(key)
        keys ||= []
        keys.push(Botoes[key])
        return keys
      end
      #--------------------------------------------------------------------------
      # * Check (key)
      #--------------------------------------------------------------------------
      def check(key)
        Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1  # key 0
      end
      #--------------------------------------------------------------------------
      # * Mouse Update
      #--------------------------------------------------------------------------
      def mouse_update
        @used_i = []
        for i in USED_KEYS
          x = check(i)
          if x == true
            @used_i.push(i)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Short Write C
      #--------------------------------------------------------------------------
      def Input.C
        Input.trigger?(C)
      end
      #--------------------------------------------------------------------------
      # * Short Write B
      #--------------------------------------------------------------------------
      def Input.B
        Input.trigger?(B)
      end
      #--------------------------------------------------------------------------
      # * Short Write A
      #--------------------------------------------------------------------------
      def Input.A
        Input.trigger?(A)
      end
      #--------------------------------------------------------------------------
      # * Short Write Down
      #--------------------------------------------------------------------------
      def Input.Down
        Input.trigger?(DOWN)
      end
      #--------------------------------------------------------------------------
      # * Short Write Up
      #--------------------------------------------------------------------------
      def Input.Up
        Input.trigger?(UP)
      end
      #--------------------------------------------------------------------------
      # * Short Write Right
      #--------------------------------------------------------------------------
      def Input.Right
        Input.trigger?(RIGHT)
      end
      #--------------------------------------------------------------------------
      # * Short Write Left
      #--------------------------------------------------------------------------
      def Input.Left
        Input.trigger?(LEFT)
      end
      #--------------------------------------------------------------------------
      # * Anykey pressed?  ( A or B or C or Down or Up or Right or Left )
      #--------------------------------------------------------------------------
      def Input.Anykey
        if A or B or C or Down or Up or Right or Left
          return true
        else
          return false
        end
      end
    end

    ______________________________________________________

    2

    Código:
        ###########################################################
              ##################### CHEATS SYSTEM #######################
              #### V 1.0.2 ##############################################
              ################################### Por:  ###### #####
              ###########################################################


    class Window_Cheats < Window_Base
      attr_reader  :name
      attr_reader  :index
      attr_reader  :max_char
      def initialize(max_char)
        super(88, 20, 368, 128)
        @name = ""
        @max_char = max_char
        name_array = @name.split(//)[0...@max_char]
        @name = ""
        for i in 0...name_array.size
          @name += name_array[i]
        end
        @default_name = @name
        @index = name_array.size
        self.active = false
        refresh
        update_cursor
      end
      def add(character)
        if @index < @max_char and character != ""
          @name += character.to_s
          @index += 1
          refresh
          update_cursor
        end
      end
      def back
        if @index > 0
          name_array = @name.split(//)
          @name = ""
          for i in 0...name_array.size-1
            @name += name_array[i]
          end
          @index -= 1
          refresh
          update_cursor
        end
      end
      def textc
        return @name
      end
      def item_rect(index)
        rect = Rect.new(0, 0, 0, 0)
        rect.x = 180 - (@max_char + 1) * 12 + index * 24
        rect.y = 36
        rect.width = 24
        rect.height = WLH
        return rect
      end
      def refresh
        self.contents.clear
        name_array = @name.split(//)
        for i in [email=0...@max_char]0...@max_char[/email]
          c = name_array[i]
          c = '_' if c == nil
          self.contents.draw_text(item_rect(i), c, 1)
        end
      end
      def update_cursor
        self.cursor_rect = item_rect(@index)
      end
      def update
        super
        update_cursor
      end
    end
    class Scene_Cheats < Scene_Base
     
        LETRAS = ["A","B","C","Ç","D","E","F","G","H","I","J","K","L",
                  "M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
     
      def start
        super
        create_menu_background
        @edit_window = Window_Cheats.new(12)
      end
      def terminate
        super
        dispose_menu_background
        @edit_window.dispose
      end
      def return_scene
        $scene = Scene_Map.new
      end
      def update
        super
        update_menu_background
        @edit_window.update
        for i in 0...27
          letra = LETRAS[i]
          if Input.trigger?(Input::Letters[letra])
            if @edit_window.index == @edit_window.max_char
              Sound.play_buzzer
            else
              Sound.play_decision
              @edit_window.add(letra)
            end
          end
        end
        for i in 0...10
          if Input.trigger?(Input::Numberpad[i])
            if @edit_window.index == @edit_window.max_char
              Sound.play_buzzer
            else
              Sound.play_decision
              @edit_window.add(i)
            end
          end
        end
        for i in 0...10
          if Input.trigger?(Input::Numberkeys[i])
            if @edit_window.index == @edit_window.max_char
              Sound.play_buzzer
            else
              Sound.play_decision
              @edit_window.add(i)
            end
          end
        end
        if Input.trigger?(Input::Space)
            if @edit_window.index == @edit_window.max_char
              Sound.play_buzzer
            else
              Sound.play_decision
              @edit_window.add(" ")
            end
          end
        if Input.repeat?(Input::Esc) or Input.repeat?(Input::Back)
          if @edit_window.index > 0
            Sound.play_cancel
            @edit_window.back
          end

          # ---------------------------------------------- #
          #                CONFIGURAÇÕES:                #
          # ---------------------------------------------- #
       
       
          # Aqui ficam as cheats:
          # Utilize APENAS espaços, letras MAIUSCULAS (Sem acento) e números
          # Com no maxímo 12 caracteres
       
        elsif Input.trigger?(Input::Enter)
          if @edit_window.textc == "ATIVARSWITCH"
            switch(1,true)
            mensege("Você ativou o switch 1")
          elsif @edit_window.textc == "DINHEIRO"
            gold(1000)
            mensege("Ganhou 1000G")
          elsif @edit_window.textc == "ARMA"
            arma(1,1,true)
            mensege("Você consegui a arma 1")
          elsif @edit_window.textc == "50POÇAO"
            item(1,50)
            mensege("Você ganhou 50 porcões")
          elsif @edit_window.textc == "ITEM"
            item(1,5)
            item(1,5)
            item(1,5)
            mensege("Você ganhou itens")
          elsif @edit_window.textc == "SWITCH 14"
            switch(14,true)
            mensege("Ativada switch 14")
          end
          return_scene
        end
      end
     
      # Algumas funções pre-programadas:
     
      def switch(id,value)
        # ex: (Ativa a switch 1)
        # switch(1,true)
        $game_switches[id] = value
      end
      def gold(value)
        # ex: (Ganha 250G)
        # gold(250)
        $game_party.gain_gold(value)
      end
      def item(id,value)
        # ex: (Ganha 5 Poção)
        # item(1,5)
        $game_party.gain_item($data_items[id], value)
      end
      def arma(id,value,equip)
        # ex: (Ganha 1 Espada e equipa)
        # arma(2,1,true)
        $game_party.gain_item($data_weapons[id], value, equip)
      end
      def armd(id,value,equip)
        # ex: (Ganha 1 Escudo e não equipa)
        # armd(1,1,false)
        $game_party.gain_item($data_armors[id], value, equip)
      end
      def mensege(text)
        # ex: (Exibe mensagem)
        # mensege("Ganhou 500G")
        $game_message.face_name = ""
        $game_message.background = 1
        $game_message.position = 1
        $game_message.texts.push(text)
      end
    end


     
    ..

    Créditos a:
    Cybersam : por fazer o script 1
    ViniV : por disponibilizar em outro forum

    E a mim por disponibilizar na aldeia.



    Obs:No segundo script va na linha 151 e edite... (Se tiver dificuldades para editar me avise que eu posso te ajudar Wink )


    _________________
    Zelda eu irei te salvar
    darlocos
    darlocos
    Novato
    Novato


    Mensagens : 16
    Créditos : 3

    Script de cheats Empty Re: Script de cheats

    Mensagem por darlocos Ter Mar 13, 2012 11:05 pm

    Aki da erro na linha 61! é pq eu coloquei o primeiro script em segundo? afinal de contas, n to entendendo, vc disse cuidado são dois scripts, mas tmb disse q tem q colocar os dois

    @EDIT:
    AGORA DA ERRO NA LINHA 233 DO PRIMEIRO SCRIPT

      Data/hora atual: Sex Mar 29, 2024 6:13 am