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

    [NPMV3]MiniMapa

    Winner
    Winner
    Iniciante
    Iniciante


    Mensagens : 54
    Créditos : 1

    [NPMV3]MiniMapa Empty [NPMV3]MiniMapa

    Mensagem por Winner Qui Abr 26, 2012 10:11 am

    Preciso daquele Script de mini-mapa que fica em cima no canto direito,se alguem tiver me passe por favor. [NPMV3]MiniMapa 364988687


    _________________
    Projetos:
    [NPMV3]MiniMapa Logo
    Acesse o Blog
    Acesse também o Forum
    Lief
    Lief
    Desenvolvedor
    Desenvolvedor


    Mensagens : 834
    Créditos : 50

    [NPMV3]MiniMapa Empty Re: [NPMV3]MiniMapa

    Mensagem por Lief Qui Abr 26, 2012 10:36 am

    eu tenho ele aqui!
    #===============================================================================
    # RTH Mini_Mapa
    # por Renan Tsuneo Hangai Junior
    #===============================================================================
    # Mostra um Mini Mapa na tela do jogo
    #===============================================================================

    module RTH

    # Largura do mini mapa
    MINI_MAP_LARG = 160
    # Altura do mini mapa
    MINI_MAP_ALT = 120
    # Transparencia do mini mapa
    MINI_MAP_OPACITY = 210
    # Nome do arquivo de imagem da pasta pictures do fundo do mini mapa
    MINI_MAP_BACK_NAME = "mapback"
    # Largura do fundo mini mapa ( Igual ao da imagem na pasta Pictures )
    MINI_MAP_BACK_LARG = 180
    # Altura do fundo mini mapa ( Igual ao da imagem na pasta Pictures )
    MINI_MAP_BACK_ALT = 140
    # Transparencia do fundo do mini mapa
    MINI_MAP_BACK_OPACITY = 140
    # Nome do arquivo de imagem da pasta pictures do herói
    MINI_MAP_HERO_BITMAP_NAME = "heroi"
    # Switch que ativa o mapa
    MAP_ON_SWITCH = 7
    # Variavel que define o canto do mapa
    MAP_CANTO_VARIABLE = 7

    end

    $RTHScript = {} if $RTHScript.nil?
    $RTHScript["Mini_Map"] = true

    class Mini_Map_Base

    attr_reader :map_rect, :bitmap_rect, :map_dif_width, :map_dif_height, :visible

    def initialize(canto)
    @canto = canto
    @x = 0
    @y = 0
    @difbx = (RTH::MINI_MAP_BACK_LARG - RTH::MINI_MAP_LARG) / 2
    @difby = (RTH::MINI_MAP_BACK_ALT - RTH::MINI_MAP_ALT) / 2
    draw_map
    self.visible = false
    end

    def draw_map
    @id = $game_map.map_id
    @layers = []
    viewport = Viewport.new(0, 0, 640, 480)
    viewport.z = 6000
    @bitmap_rect = Rect.new(0, 0, RTH::MINI_MAP_LARG, RTH::MINI_MAP_ALT)
    @back_bitmap_rect = Rect.new(0, 0, RTH::MINI_MAP_BACK_LARG, RTH::MINI_MAP_BACK_ALT)
    w = RTH::MINI_MAP_LARG.to_f * ($game_map.width.to_f * 32.0) / 640.0
    h = RTH::MINI_MAP_ALT.to_f * ($game_map.height.to_f * 32.0) / 480.0
    @map_dif_width = ($game_map.width.to_f * 32.0) / w
    @map_dif_height = ($game_map.height.to_f * 32.0) / h
    @map_rect = Rect.new(0, 0, w, h)
    @back_sprite = Sprite.new(viewport)
    @back_sprite.bitmap = Bitmap.new(@back_bitmap_rect.width, @back_bitmap_rect.height)
    back_bitmap = RPG::Cache.picture(RTH::MINI_MAP_BACK_NAME)
    @back_sprite.bitmap.stretch_blt(@back_bitmap_rect, back_bitmap, Rect.new(0, 0, back_bitmap.width, back_bitmap.height))
    src_rect = Rect.new(0, 0, $game_map.width * 32, $game_map.height * 32)
    for i in 0..5
    @layers[i] = Sprite.new(viewport)
    @layers[i].z = 10000 + (i * 20)
    @layers[i].x = (@back_bitmap_rect.width - @bitmap_rect.width) / 2
    @layers[i].y = (@back_bitmap_rect.height - @bitmap_rect.height) / 2
    @layers[i].bitmap = Bitmap.new(@map_rect.width, @map_rect.height)
    @layers[i].bitmap.stretch_blt(@map_rect, RPG::Cache.map_bitmap(@id, i), src_rect)
    end
    end

    def update
    if @layers.nil?
    draw_map
    end
    canto = $game_variables[RTH::MAP_CANTO_VARIABLE] % 4
    case canto
    when 0
    @x, @y = 16, 16
    when 1
    @x, @y = (640 - 16 - @back_bitmap_rect.width), 16
    when 2
    @x, @y = 16, (480 - 16 - @back_bitmap_rect.height)
    when 3
    @x, @y = (640 - 16 - @back_bitmap_rect.width), (480 - 16 - @back_bitmap_rect.height)
    end
    @back_sprite.x = @x
    @back_sprite.y = @y
    @back_sprite.opacity = RTH::MINI_MAP_BACK_OPACITY
    for layer in @layers
    layer.x = @x + @difbx
    layer.y = @y + @difby
    layer.opacity = RTH::MINI_MAP_OPACITY
    ox = ($game_map.display_x / 4) / @map_dif_width
    oy = ($game_map.display_y / 4) / @map_dif_height
    layer.src_rect.set(ox, oy, @bitmap_rect.width, @bitmap_rect.height)
    end
    end

    def dispose(dp=false)
    for layer in @layers
    layer.bitmap.dispose
    layer.dispose
    end
    @layers = nil
    @back_sprite.bitmap.dispose
    @back_sprite.dispose
    @back_sprite = nil
    RPG::Cache.dispose_map_bitmap(@id) if dp
    end

    end

    class Mini_Map < Mini_Map_Base

    def draw_map
    super
    viewport = Viewport.new(0, 0, 640, 480)
    viewport.z = 10010
    @hero = Sprite.new(viewport)
    @hero.bitmap = RPG::Cache.picture(RTH::MINI_MAP_HERO_BITMAP_NAME)
    @events = []
    @events_sprites = []
    @destinies = []
    @destinies_event = []
    @blinked_events = []
    @blink_count = 0
    i = 0
    for event in $game_map.events.values
    next if event.nil?
    next if event.list.nil? or event.list.size <= 0
    maped = false
    blinked = false
    @blinked_events[i] = false
    for item in event.list
    next if item.nil?
    if item.code == 108 or item.code == 408
    unless maped
    if item.parameters[0].downcase.include?("minimap")
    name = item.parameters[0].split[1]
    sprite = Sprite.new(viewport)
    sprite.bitmap = RPG::Cache.picture(name)
    @events[i] = event
    @events_sprites[i] = sprite
    maped = true
    i += 1
    elsif item.parameters[0].downcase.include?("destino")
    name = item.parameters[0].split[1]
    sprite = Sprite.new(viewport)
    sprite.bitmap = RPG::Cache.picture(name)
    @destinies[i] = sprite
    @destinies_event[i] = event
    maped = true
    i += 1
    end
    end
    unless blinked
    if item.parameters[0].downcase.include?("blink")
    adx = (maped == true ? -1 : 0)
    @blinked_events[i + adx] = true
    blinked = true
    end
    end
    break if blinked and maped
    end
    end
    end
    end

    def visible=(valor)
    return if !@visible.nil? and @visible == valor
    @visible = valor
    @back_sprite.visible = valor
    for layer in @layers
    layer.visible = valor
    end
    for sprite in @events_sprites + @destinies
    next if sprite.nil?
    sprite.visible = valor
    end
    @hero.visible = valor
    end

    def update
    self.visible = true
    self.visible = false if $game_system.map_interpreter.running?
    self.visible = $game_switches[RTH::MAP_ON_SWITCH] if @visible == true
    return if @visible == false
    super
    @blink_count = (@blink_count + 1) % 10
    if @destinies.size > 0
    for i in 0...@destinies.size
    next if @destinies[i].nil?
    max_x = RTH::MINI_MAP_LARG + @layers[0].x - (@destinies[i].src_rect.width / 2)
    max_y = RTH::MINI_MAP_ALT + @layers[0].y - (@destinies[i].src_rect.height / 2)
    x = (@destinies_event[i].screen_x.to_f / self.map_dif_width) + @layers[0].x - (@destinies[i].src_rect.width / 2)
    y = (@destinies_event[i].screen_y.to_f / self.map_dif_height) + @layers[0].y - @destinies[i].src_rect.height
    @destinies[i].x = (x >= max_x ? max_x : x <= @layers[0].x ? @layers[0].x : x)
    @destinies[i].y = (y >= max_y ? max_y : y <= @layers[0].y ? @layers[0].y : y)
    @destinies[i].visible = (not @destinies[i].visible) if @blink_count == 0 and @blinked_events[i]
    end
    end
    for i in 0...@events_sprites.size
    next if @events[i].nil?
    @events_sprites[i].x = (@events[i].screen_x.to_f / self.map_dif_width) + @layers[0].x - (@events_sprites[i].src_rect.width / 2)
    @events_sprites[i].y = (@events[i].screen_y.to_f / self.map_dif_height) + @layers[0].y - @events_sprites[i].src_rect.height
    @events_sprites[i].visible = (@events_sprites[i].x >= @layers[0].x and @events_sprites[i].x <= @layers[0].x + @bitmap_rect.width and @events_sprites[i].y >= @layers[0].y and @events_sprites[i].y <= @layers[0].y + @bitmap_rect.height)
    end
    @hero.x = ($game_player.screen_x.to_f / self.map_dif_width) + @layers[0].x - (@hero.src_rect.width / 2)
    @hero.y = ($game_player.screen_y / self.map_dif_height) + @layers[0].y - @hero.src_rect.height
    end

    def dispose(dp=false)
    super(dp)
    for sprite in @events_sprites + @destinies
    next if sprite.nil?
    sprite.bitmap.dispose
    sprite.dispose
    end
    @hero.bitmap.dispose
    @hero.dispose
    end

    def redraw_map
    dispose
    draw_map
    end

    end

    class Spriteset_Map

    attr_reader :mini_mapa

    alias rth_mini_map_spmap_initialize initialize
    alias rth_mini_map_spmap_dispose dispose
    alias rth_mini_map_spmap_update update

    def initialize
    @mini_mapa = Mini_Map.new(0)
    rth_mini_map_spmap_initialize
    end

    def dispose
    @mini_mapa.dispose(true)
    rth_mini_map_spmap_dispose
    end

    def update
    @mini_mapa.update
    rth_mini_map_spmap_update
    end

    end

    class Scene_Map
    attr_reader :spriteset
    end

    class Game_Map

    alias rth_mini_map_gmap_refresh refresh
    def refresh
    rth_mini_map_gmap_refresh
    if $scene.instance_of?(Scene_Map)
    if $scene.spriteset != nil and $scene.spriteset.mini_mapa != nil
    $scene.spriteset.mini_mapa.redraw_map
    end
    end
    end

    end

    class Interpreter

    alias rth_mini_map_iterpreter_command_123 command_123
    def command_123
    valor = rth_mini_map_iterpreter_command_123
    if $scene.instance_of?(Scene_Map)
    $scene.spriteset.mini_mapa.redraw_map
    end
    end

    end

    class Scene_Full_Map

    def main
    @rw = $game_map.width * 32
    @rh = $game_map.height * 32
    @full_map = Sprite.new
    @full_map.bitmap = Bitmap.new(@rw, @rh)
    for i in 0..5
    @full_map.bitmap.blt(0, 0, RPG::Cache.map_bitmap($game_map.map_id, i), Rect.new(0, 0, @rw, @rh))
    end
    #RPG::Cache.dispose_map_bitmap($game_map.map_id)
    @ox = ($game_map.display_x / 4)
    @oy = ($game_map.display_y / 4)
    @full_map.ox = @ox
    @full_map.oy = @oy
    @full_map.zoom_x = 0.8
    @full_map.zoom_y = 0.8
    @full_map.x = (640 - (640 * @full_map.zoom_x)) / 2
    @full_map.y = (480 - (480 * @full_map.zoom_y)) / 2
    Graphics.transition(20)
    while $scene == self
    Graphics.update
    Input.update
    update
    end
    Graphics.freeze
    @full_map.bitmap.dispose
    @full_map.dispose
    end

    def update
    @full_map.update
    cw = (@rw * @full_map.zoom_x)
    ch = (@rh * @full_map.zoom_y)
    if cw + @full_map.x > 640 - @full_map.x
    if [1, 4, 7].include?(Input.dir8) and @ox > 0
    @ox -= 10
    elsif [3, 6, 9].include?(Input.dir8) and @ox < (@rw - (@full_map.x * 2) - (640 * @full_map.zoom_x))
    @ox += 10
    end
    end
    if ch + @full_map.y > 480 - @full_map.y
    if [7, 8, 9].include?(Input.dir8) and @oy > 0
    @oy -= 10
    elsif [1, 2, 3].include?(Input.dir8) and @oy < (@rh - (@full_map.y * 2) - (480 * @full_map.zoom_y))
    @oy += 10
    end
    end
    #@full_map.src_rect.set(@ox, @oy, @rw, @rh)
    @full_map.ox = @ox
    @full_map.oy = @oy
    if Input.trigger?(Input::C) or Input.trigger?(Input::B)
    $scene = Scene_Map.new
    end
    end

    end

    class Game_Map

    def mmsetup(id)
    @map_id = id
    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
    tilesets = load_data("Data/Tilesets.rxdata")
    tileset = tilesets[@map.tileset_id]
    @tileset_name = tileset.tileset_name
    @autotile_names = tileset.autotile_names
    @priorities = tileset.priorities
    end

    end

    module RPG

    module Cache

    @map_bitmap = []

    AUTOTILES_DEFINITION = [
    26, 27, 32, 33, 4, 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
    26, 27, 32, 11, 4, 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
    26, 27, 10, 33, 4, 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
    26, 27, 10, 11, 4, 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
    24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
    14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
    28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
    38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
    24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
    16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
    36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
    36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
    ]

    def self.map_bitmap(map_id, priority=0)
    if @map_bitmap[map_id].nil?
    mapa = Game_Map.new
    mapa.mmsetup(map_id)
    layers = [
    Bitmap.new(mapa.width * 32, mapa.height * 32),
    Bitmap.new(mapa.width * 32, mapa.height * 32),
    Bitmap.new(mapa.width * 32, mapa.height * 32),
    Bitmap.new(mapa.width * 32, mapa.height * 32),
    Bitmap.new(mapa.width * 32, mapa.height * 32),
    Bitmap.new(mapa.width * 32, mapa.height * 32)
    ]
    autotiles = []
    for i in 0..6
    autotiles[i] = self.autotile(mapa.autotile_names[i])
    end
    vx = [0, 1, 0, 1]
    vy = [0, 0, 1, 1]
    for x in 0...mapa.width
    for y in 0...mapa.height
    for level in 0..2
    tile_id = mapa.data[x, y, level]
    prioridade = mapa.priorities[tile_id]
    if tile_id >= 384
    tileset_bitmap = self.tile(mapa.tileset_name, tile_id, 0)
    src_rect = Rect.new(0, 0, 32, 32)
    layers[prioridade].blt(x * 32, y * 32, tileset_bitmap, src_rect)
    elsif tile_id >= 48 and tile_id < 384
    aid = tile_id / 48 - 1
    for j in 0..3
    h = 4 * (tile_id % 48) + j
    src_rect = Rect.new((AUTOTILES_DEFINITION[h] % 6) * 16, (AUTOTILES_DEFINITION[h] / 6 ) * 16, 16, 16)
    ax = x * 32 + vx[j] * 16
    ay = y * 32 + vy[j] * 16
    layers[prioridade].blt(ax, ay, autotiles[aid], src_rect)
    end
    end
    end
    end
    end
    @map_bitmap[map_id] = layers
    end
    return @map_bitmap[map_id][priority]
    end

    def self.dispose_map_bitmap(id)
    return if @map_bitmap[id].nil?
    for bitmap in @map_bitmap[id]
    bitmap.dispose
    end
    @map_bitmap[id] = nil
    end

    end

    end
    Não fica no canto direito da tela você que tem que definir or uma variável(a 7) em que canto ela fica,crie um npc pra ativar o minimap(ativar a switch 7) ai ele aparece e coloca tbm para colocar a variável 7 em substituir e o valor 15(fica em cima da hotkey)
    e as imagens necessárias eu exclui sem querer,então olhe no script e procure umas imagens pequenas pro minimap de eventos,herói(não amostra os outros players),baús etc...

      Data/hora atual: Sex Nov 22, 2024 10:07 am