MapEquip - Equipaments on Map Screen
Version: 2.0
By Rafidelis(RafiScripts)
Introduction:
The first version of this script was released on September 22, 2008, when I started to learn RGSS.
So, after almost a year, was going through this topic and when I saw my script I thought 'aff, that horrible code!'.
Then decide totally rewrite the script, and this new version lags and bugs are almost impossible (see the feature session to see what's new.)
[center]Features
Version: 2.0
By Rafidelis(RafiScripts)
Introduction:
The first version of this script was released on September 22, 2008, when I started to learn RGSS.
So, after almost a year, was going through this topic and when I saw my script I thought 'aff, that horrible code!'.
Then decide totally rewrite the script, and this new version lags and bugs are almost impossible (see the feature session to see what's new.)
[center]Features
-View the equipment in the Vertical (|) or Horizontal (_)
-Displays the attack or defense of equipment.
-Show / Hide the equipment through a key.
-Use a background image if desired.
-Displaying a text, in 'empty' equipment slots
-Compatible with scripts that increase the amount of equipment slots.
-Updated only when some equipment is modified, thus totally avoids the possible lags.
Instructions
First up,paste above the main, then edit the settings in the editing section of the script, if the option to use image is active, the image should be in the picture folder, with the name defined in the script.See Screenshots section to find some images to use.
Screenshots


Images to be used as Background:



Script
Script
Spoiler
- #==============================================================================#
- # [RGSS2] Equipaments in Map Screen #
- #------------------------------------------------------------------------------#
- # $RafiScripts.by = Rafidelis(Rafis) #
- # $RafiScripts.version = 1.0 #
- # $RafiScripts.release_date = 09/09/09 (legal né?) (d/m/y) #
- # $RafiScripts.email = [email hidden] or [email hidden] #
- # $RafiScripts.website = http://www.ReinoRPG.com or http://www.ReinoRPG.com/forum #
- #==============================================================================#
- #==============================================================================#
- # [** $RafiScripts.versions **] // Versões do Script/ Script Versions #
- #------------------------------------------------------------------------------#
- # 22/09/08 - Version 1.0 Released #
- # 09/09/09 - Version 2.0 Released #
- #==============================================================================#
- #==============================================================================#
- # [** $RafiScripts.desc **] // Sobre o Script / About Script #
- #------------------------------------------------------------------------------#
- # Este script,é uma nova versão de um velho script que criei,à uns 10 meses #
- # atras.E claro,dessa vez uma versão aprimorada e melhor,totalmente sem lags. #
- # O que este Script Faz? :Ele mostra na tela os equipamentos atuais do jogador #
- #------------------------------------------------------------------------------#
- # ** Features : #
- # (*) View the equipment in the Vertical (|) or Horizontal (_) #
- # (*) Displays the attack or defense of equipment. #
- # (*) Show / Hide the equipment through a key. #
- # (*) Use a background image if desired. #
- # (*) Displaying a text, in 'empty' equipment slots #
- # (*) Compatible with scripts that increase the amount of equipment slots. #
- # (*) Updated only when some equipment is modified, thus totally avoids the #
- # possible lags ò.Ó #
- #------------------------------------------------------------------------------#
- #==============================================================================#
- # [** $RafiScripts.instr ] // Instruções #
- #------------------------------------------------------------------------------#
- # 1° Paste above the Main #
- # 2° Edit the constants in Module Rafidelis: MapEquip if you want. #
- # 3° If you want to use a background image,it's must be in picture folder #
- #------------------------------------------------------------------------------#
- #==============================================================================#
- # [** Module Rafidelis ] #
- #[**Modulo necessario para rodar os Scripts criados por Rafidelis(RafiScripts)]#
- #==============================================================================#
- module Rafidelis
- #==============================================================================#
- # Rafidelis.add_script - Name : Name of Script - Version : Version of Script #
- #------------------------------------------------------------------------------#
- def self.add_script(name,version)
- $RafiScripts = [] if $RafiScripts.nil?
- $RafiScripts.push("Name : #{name} - Version: #{version}")
- end
- #==============================================================================#
- # Rafidelis.script_exist? - Name : Name of Script - Version : Version of Script#
- #------------------------------------------------------------------------------#
- def self.script_exist?(name,version)
- $RafiScripts = [] if $RafiScripts.nil?
- return $RafiScripts.include?("Name : #{name} - Version: #{version}")
- end
- #==============================================================================#
- # Rafidelis.scripts - Return all scripts create by Rafidelis(RafiScripts) #
- #------------------------------------------------------------------------------#
- def self.scripts
- print $RafiScripts
- end
- #==============================================================================#
- # Rafidelis.create_txt - Create a .txt with all Rafidelis(RafiScripts) scripts #
- #------------------------------------------------------------------------------#
- def self.create_txt(filename="RafideliScripts")
- file = File.open("#{filename}.txt","wb")
- for i in 0...$RafiScripts.size
- file.write("#{$RafiScripts[i]}\r\n")
- end
- end
- #============================================================================#
- # (***) Modulo de Opções para o Script de Equipamento na Tela. #
- #============================================================================#
- module MapEquip
- # Adding the Script at the System. Don't Modify
- name = "Equipaments in Map Screen"
- version = "1.0"
- Rafidelis.add_script(name,version)
- # Script add at the System
- # Mode = use "V" -> Vertical or "H" -> Horizontal
- Mode = "V"
- # Background Picture,if you do not use leave the name in ".
- BackGround_Image = "Equip_Back"
- # Show equipaments informations ? -> Attack and Defense.
- Display_Equip_Info = true
- # Terms to be displayed before the attack power and defense power.
- Terms = ["Atk : ","Def : "]
- # Text Displayed when the equipament slot is empty.
- No_Equip_Text = "Empty"
- # Horizontal position of Equipment. Default -> - 10
- Window_X = -10
- # Vertical position of Equipment. Default -> - 10
- Window_Y = -10
- # Opacity of the window,recommended leave 0
- Window_Opacity = 0
- # Use the keyboard to Show / Hide the equipments?
- Use_Input = true
- # If Use_Input = true set down the key to be used.
- # Set according the RPGMaker Default.See down some keys.
- # "Key in RPGMaker" -> the original keyboard key.
- # "A" -> Z : "Y" -> S : "Z" -> D : "X" - A : "L" -> Q : "R" -> W
- Key = "X"
- # If Use_Input = false, set down the ID of a switch to control
- # Display of the Equipment on the screen.
- Control_Switch_ID = 1
- end
- end
- #==============================================================================#
- # [** $RafiScripts.conf_start ] \\ Inicio das Configurações #
- #------------------------------------------------------------------------------#
- # Verificando se o script esta incluso no sistema #
- #==============================================================================#
- name = "Equipaments in Map Screen"
- version = "1.0"
- if Rafidelis.script_exist?(name,version)
- #==============================================================================#
- # [** Window_Equipment **] #
- #------------------------------------------------------------------------------#
- # (*) Esta Janela exibe os equipamentos do personagem principal no Mapa. #
- #==============================================================================#
- class Window_Equipament < Window_Base
- include Rafidelis::MapEquip
- #============================================================================#
- # (*) -> Inicialização do objeto #
- #----------------------------------------------------------------------------#
- def initialize
- dim = get_dimensions
- super(Window_X,Window_Y,dim[0],dim[1])
- self.opacity = Window_Opacity
- self.contents.font.bold = true
- refresh
- end
- #============================================================================#
- # (*) -> Pegar as Dimensões de Altura e Largura da Janela. #
- #----------------------------------------------------------------------------#
- def get_dimensions
- @mode = Mode
- @bitmap = Cache.picture(BackGround_Image)
- @equips = $game_party.members[0].equips
- case @mode
- when "H"
- width = (@equips.size * @bitmap.width) + 32
- height = @bitmap.height + 32
- when "V"
- width = @bitmap.width + 32
- height = (@equips.size * @bitmap.height) + 32
- end
- return [width,height]
- end
- #============================================================================#
- # (*) Refresh #
- #----------------------------------------------------------------------------#
- def refresh
- self.contents.clear
- bw = @bitmap.width ; bh = @bitmap.height
- for i in 0...@equips.size
- if @mode == "H"
- x = i * bw
- y = 0
- tx = 5 + x
- else
- x = 0
- y = i * bh
- tx = 5 + x
- end
- self.contents.blt(x,y,@bitmap,@bitmap.rect)
- if @equips[i].nil?
- tw = contents.text_size(No_Equip_Text).width
- self.contents.font.size = 15
- self.contents.draw_text(tx,y,self.width,32,No_Equip_Text)
- else
- draw_equip_icon(@equips[i],x + 8,y + 5,Display_Equip_Info)
- end
- end
- end
- #============================================================================#
- # (*) Mostrar os Icones dos Equipamentos #
- # item :equipamento a ser exibido,pode ser tanto uma Arma ou Armadura. #
- # x : Posição x do Icone | y : Posição Y do Icone #
- # show_text : Exibir as Informações de Ataque e Defesa do Equipamento. #
- #----------------------------------------------------------------------------#
- def draw_equip_icon(item, x, y,show_text=false)
- draw_icon(item.icon_index,x,y)
- if item != nil
- self.contents.font.size = 11
- atk = Terms[0]
- defense = Terms[1]
- tw = contents.text_size(atk).width
- tw2 = contents.text_size(defense).width
- x = x - 6
- y = y + 12
- if show_text
- if item.is_a?(RPG::Armor)
- self.contents.font.color = text_color(2)
- self.contents.draw_text(x, y,@bitmap.width,32,defense)
- self.contents.font.color = normal_color
- self.contents.draw_text(tw2 + x, y,@bitmap.width,32,"#{item.def}")
- elsif item.is_a?(RPG::Weapon)
- self.contents.font.color = text_color(2)
- self.contents.draw_text(x, y,@bitmap.width, 32,atk)
- self.contents.font.color = normal_color
- self.contents.draw_text(tw + x, y,@bitmap.width, 32,"#{item.atk}")
- end
- end
- end
- end
- #============================================================================#
- # (*) Atualização | (*) Update #
- #----------------------------------------------------------------------------#
- def update
- if Use_Input
- if Input.trigger?(eval("Input::#{Key}"))
- if self.visible
- self.visible = false
- else
- self.visible = true
- end
- end
- elsif not Use_Input
- self.visible = $game_switches[Control_Switch_ID]
- end
- actor = $game_party.members[0]
- for i in 0...@equips.size
- if @equips[i] != actor.equips[i]
- @equips = $game_party.members[0].equips
- refresh if self.visible
- end
- end
- end
- end
- #==============================================================================#
- # Scene_Map #
- #------------------------------------------------------------------------------#
- # Classe das operações nos mapas. #
- #==============================================================================#
- class Scene_Map < Scene_Base
- include Rafidelis::MapEquip
- #============================================================================#
- # (*) -> Aliase #
- #----------------------------------------------------------------------------#
- alias :rafidelis_mapequip_start :start
- alias :rafidelis_mapequip_update :update
- alias :rafidelis_mapequip_terminate :terminate
- #============================================================================#
- # (*) -> Inicialização do processo #
- #----------------------------------------------------------------------------#
- def start
- @equip_window = Window_Equipament.new
- $game_switches[Rafidelis::MapEquip::Control_Switch_ID] = true
- rafidelis_mapequip_start
- end
- #============================================================================#
- # (*) -> Atualização do processo #
- #----------------------------------------------------------------------------#
- def update
- @equip_window.update
- rafidelis_mapequip_update
- end
- #============================================================================#
- # (*) -> Termininação do processo #
- #----------------------------------------------------------------------------#
- def terminate
- @equip_window.dispose
- rafidelis_mapequip_terminate
- end
- end
- # Fim da Verificação do Script no Sistema
- end
- #==============================================================================#
- # [** $RafiScripts.script_end] // Fim do Script - Script End #
- #------------------------------------------------------------------------------#
- # Você pode encontrar mais scripts meus em http://www.ReinoRPG.com #
- # You can find more scripts create for me at http://www.ReinoRPG.com #
- #==============================================================================#
Expand to see the code.
Terms of Use
- If you use this script, you do not have to include my name in
credits, but I'd like you to give the deserved credits; D
- You can use this script on non-commercial games, if you want to use in
some commercial game, please get in touch with me and we entered into an agreement.
- You can distribute / modify / edit this script, but can not withdraw
the name of the author and not the link to the forum ReinoRpg.
- Enjoy; D