I get an error with "$game_party.keys"
edit: your decimal fix works perfectly ^^
here are the relevant codes:
Sample description
Restores HP to one ally. /%1.1%/
output:
Restores HP to one ally. 1.1 lb
at the bottom of : "Window_Item", "Window_EquipRight", and "Window_EquipItem"
def update_help
if self.item == nil
final_description = ""
else
final_description = item.description.gsub(/\/%(\d+(\.\d+)?)%\//) {"#{$1.to_f} lb"}
end
weight = $1.to_f
@help_window.set_text(self.item == nil ? "" : final_description)
end
end
Above Main
class RPG::Item
def weight
return self.description[/\/%(\d+(\.\d+)?)%\//].nil? ? 0 : $1.to_f
end
end
class RPG::Weapon
def weight
return self.description[/\/%(\d+(\.\d+)?)%\//].nil? ? 0 : $1.to_f
end
end
class RPG::Armor
def weight
return self.description[/\/%(\d+(\.\d+)?)%\//].nil? ? 0 : $1.to_f
end
end
and here's a sample generic strength calculation, entered above Dexterity in Game_Battler_1:
#--------------------------------------------------------------------------
# * Get Encumbrance (ENC)
#--------------------------------------------------------------------------
def enc
n = [[str * 4, 0].max, 9999].min
return n
end
and here's the related window display stuff, above "equipment" in Window_Status:
#=============================================================
# *** Encumbrance ***
self.contents.font.color = system_color
self.contents.draw_text(320, 112, 120, 32, "Carry")
self.contents.font.color = normal_color
carry = 0
self.contents.draw_text(320 + 80, 112, 84, 32, carry.to_s + "/" + @actor.enc.to_s, 2)
#==============================================================