Tidloc's Item Weights Script, edited by Mr Wiggles (and slightly modified by me for my own purposes) is a great script, but it does have one problem.
Every time you load a saved game all items no-longer seem to have weight!
I'm sure it's either a problem with the script not saving the data into the save file or just not refreshing the window that shows the total weight properly after you reload the save game. Either way, it's a problem I can't fix on my own.
Any help would be greatly appreciated! ;)
BTW, I know I'm not using the latest version, but neither version reloads weights.
Here's the version of the script I'm currently using (in the spoiler):
[spoiler]
################################################################################
# Item Weight V 1.0 #
# by Tidloc #
################################################################################
# V 1.4 #
# by Mr Wiggles - Drop to map. #
################################################################################
# Novostrana Version edited by CountVlad. #
################################################################################
# This script allows the player to carry only a limited amount of weight. #
# To define the weight of an item, weapon or armor simply enter \w<*VALUE*> #
# in the description box of that item. If left out the weight will be 0! #
################################################################################
# Definition of the constants: #
# TIDLOC_GROUPWEIGHT_MAX ................. limit of weight, where the #
# player will be slowed down. #
# TIDLOC_GROUPWEIGHT_SHOW_MAX ............ true if GROUPWEIGHT_MAX shall be #
# used for max weight, not #
# CARRY_OVER_MAX. #
# TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX ...... maximum weight, if exceeding #
# this limit, no more items can be #
# picked up. #
# TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH .... the number of the global switch #
# which shall be turned true if #
# the max-limit is exceeded. #
# TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH ... the number of the global switch #
# which shall be turned true if #
# you cannot carry any more. #
# if a switch is 0, it's not used #
################################################################################
# To alter this limits in game use the following script-commands: #
# $game_temp._tidloc_pweight(*VALUE*) for GROUPWEIGHT_MAX #
# $game_temp._tidloc_pmax(*VALUE*) for CARRY_OVER_MAX #
# You may leave Value empty to reset to the constants. #
################################################################################
# You are free to use this script in what ever game you want, but please #
# credit me for this hell of work ^_^ #
# Credits also to Albertfish for his help when it was needed! #
################################################################################
# Mr Wiggles: #
# #
# This version will store recently dropped items, which then can be picked #
# up through an event that calls a chest in Game_Guy's Item Storage Script. #
# #
# Use $game_temp.recentdrop for the chest that will house the recently #
# dropped items from Tidloc's Weighted Items Script. #
################################################################################
TIDLOC_GROUPWEIGHT_MAX = 1000 # Set by players Skill
TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX = 1000
TIDLOC_GROUPWEIGHT_MAT_POWER = 1 # Number of decimal algarisms.
TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH = 20
TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH = 3
module CHEST_DROP # Mr Wiggles
# Button to drop item
DROP_ITEM = Input::Letters["D"]
# Button to use item
USE_ITEM = Input::C # Space, Enter, "C"
end # Mr Wiggles
#-------------------------------------------------------------------------------
# * Window_Weight
#-------------------------------------------------------------------------------
class Window_Weight < Window_Base
def initialize
super(0, 0, 640, 480) # 140, 80
self.z = 200
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.font.name = "Arial"
self.contents.font.size = 20
self.contents.clear
self.contents.font.color = system_color
a = 1
for i in 0...TIDLOC_GROUPWEIGHT_MAT_POWER
a*=10.0
end
# Draw Weight in Maxed out color if over max
if $game_temp._tidloc_groupweight/a > $game_temp._tidloc_groupweight_max/a
self.contents.font.color = knockout_color
weight = ($game_temp._tidloc_groupweight/a).to_s
max_weight = ($game_temp._tidloc_groupweight_max/a).to_s
self.contents.draw_text(480, 9, 160, 32,weight+" / "+max_weight, 0)
# Draw Weight in Warning color if close to max
elsif $game_temp._tidloc_groupweight/a >= $game_temp._tidloc_groupweight_max/a - 15
self.contents.font.color = crisis_color
weight = ($game_temp._tidloc_groupweight/a).to_s
max_weight = ($game_temp._tidloc_groupweight_max/a).to_s
self.contents.draw_text(480, 9, 160, 32,weight+" / "+max_weight, 0)
else
# Draw Weight in normal color if under max
self.contents.font.color = normal_color
weight = ($game_temp._tidloc_groupweight/a).to_s
max_weight = ($game_temp._tidloc_groupweight_max/a).to_s
self.contents.draw_text(480, 9, 160, 32,weight+" / "+max_weight, 0)
end
# Draw Weight Total:
self.contents.draw_text(480,-9, 120, 32, "Weight Total:\n")
self.contents.font.color = normal_color
end
end
#==============================================================================
# * Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
if self.item != nil
help = self.item.description.to_s
$game_temp.item_description_lentgh = help.length
end
end
end
#-------------------------------------------------------------------------------
# * Game_Temp
#-------------------------------------------------------------------------------
class Game_Temp
attr_accessor :_tidloc_itemweight
attr_accessor :_tidloc_weaponweight
attr_accessor :_tidloc_armorweight
attr_accessor :_tidloc_groupweight
attr_accessor :_tidloc_groupweight_max
attr_accessor :_tidloc_groupweight_carry_over_max
attr_accessor :_tidloc_iweight_slow
attr_accessor :recentdrop
attr_accessor :item_description_lentgh
alias wo_weight_initialize initialize
def initialize
wo_weight_initialize
self._tidloc_itemweight = []
self._tidloc_weaponweight = []
self._tidloc_armorweight = []
self.recentdrop = []
self.item_description_lentgh = 0
self._tidloc_groupweight = 0
self._tidloc_groupweight_max = TIDLOC_GROUPWEIGHT_MAX
self._tidloc_groupweight_carry_over_max = TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
self._tidloc_iweight_slow = false
for i in 1...$data_items.size
if $data_items[i].description[0] != nil
text = $data_items[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
self._tidloc_itemweight[i]=$1.to_i
end
end
$data_items[i].description = text2
end
self._tidloc_itemweight[i] = 0 if self._tidloc_itemweight[i].nil?
end
for i in 1...$data_weapons.size
if $data_weapons[i].description[0] != nil
text = $data_weapons[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
self._tidloc_weaponweight[i]=$1.to_i
end
end
$data_weapons[i].description = text2
end
self._tidloc_weaponweight[i] = 0 if self._tidloc_weaponweight[i].nil?
end
for i in 1...$data_armors.size
if $data_armors[i].description[0] != nil
text = $data_armors[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c == "\1"
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
self._tidloc_armorweight[i]=$1.to_i
else
text2 += c
end
end
$data_armors[i].description = text2
end
self._tidloc_armorweight[i] = 0 if self._tidloc_armorweight[i].nil?
end
end
def _tidloc_pweight(new_weight=TIDLOC_GROUPWEIGHT_MAX)
self._tidloc_groupweight_max = new_weight
end
def _tidloc_pmax(new_max=TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX)
self._tidloc_groupweight_carry_over_max = new_max
end
end
#-------------------------------------------------------------------------------
# * Game_Party
#-------------------------------------------------------------------------------
class Game_Party
def tidloc_slowing(slow=true)
if slow
$game_player.tidloc_alt_speed -1
else
$game_player.tidloc_alt_speed 1
end
end
#----------------------
# Gain Item
#----------------------
alias tidloc_iweight_item gain_item
def gain_item(item_id, n)
# Add Wieght
if item_id > 0
$game_temp._tidloc_groupweight += $game_temp._tidloc_itemweight[item_id] * n #([[item_number(item_id) + n, 0].max, 999].min - item_number(item_id))
end
# check if over weight
if $game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = true
tidloc_slowing
end
elsif ($game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_max && !$game_temp._tidloc_iweight_slow)
$game_temp._tidloc_iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_item(item_id, n)
elsif ($game_temp._tidloc_groupweight <= $game_temp._tidloc_groupweight_max && $game_temp._tidloc_iweight_slow)
$game_temp._tidloc_iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_item(item_id, n)
else
tidloc_iweight_item(item_id, n)
end
end
#----------------------
# Gain Weapon
#----------------------
alias tidloc_iweight_weap gain_weapon
def gain_weapon(weapon_id, n)
if weapon_id > 0
$game_temp._tidloc_groupweight += $game_temp._tidloc_weaponweight[weapon_id] * n #([[weapon_number(weapon_id) + n, 0].max, 99].min - weapon_number(weapon_id))
end
if $game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = true
tidloc_slowing
end
elsif $game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_max && !$game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_weap(weapon_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_temp._tidloc_groupweight <= $game_temp._tidloc_groupweight_max && $game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_weap(weapon_id, n)
else
tidloc_iweight_weap(weapon_id, n)
end
end
#----------------------
# Gain Armor
#----------------------
alias tidloc_iweight_arm gain_armor
def gain_armor(armor_id, n)
if armor_id > 0
$game_temp._tidloc_groupweight += $game_temp._tidloc_armorweight[armor_id] * n #([[armor_number(armor_id) + n, 0].max, 99].min - armor_number(armor_id))
end
if $game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = true
tidloc_slowing
end
elsif $game_temp._tidloc_groupweight > $game_temp._tidloc_groupweight_max && !$game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_arm(armor_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_temp._tidloc_groupweight <= $game_temp._tidloc_groupweight_max && $game_temp._tidloc_iweight_slow
$game_temp._tidloc_iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_arm(armor_id, n)
else
tidloc_iweight_arm(armor_id, n)
end
end
end
#-------------------------------------------------------------------------------
# * Game_Player
#-------------------------------------------------------------------------------
class Game_Player
def tidloc_set_speed(speed=4)
@move_speed = speed
end
def tidloc_alt_speed(speed=0)
@move_speed += speed
end
end
#-------------------------------------------------------------------------------
# * Scene_Item
#-------------------------------------------------------------------------------
class Scene_Item
alias _tidloc_iweight_main main
def main
@weight_window = Window_Weight.new
@weight_window.x = 0
@weight_window.y = 0
_tidloc_iweight_main
@weight_window.dispose
end
alias _tidloc_iweight_update update
def update
@weight_window.update
_tidloc_iweight_update
@weight_window.refresh
end
#-------------------------------------------------------------------------------
alias _tidloc_iweight_item update_item
def update_item
@item = @item_window.item
#------------------
if Input.trigger?(CHEST_DROP::USE_ITEM)
# If not an item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end # if scope == 4
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play($data_system.decision_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end # if consumable
$scene = Scene_Map.new
return
end # if common event
end # if item scope >= 3
@item_window.refresh
@weight_window.refresh
return
end # if Input::C
#------------------
if Input.trigger?(CHEST_DROP::DROP_ITEM) # Drop Item
$game_switches[CHEST_DROP::RELOCATE_ITEM] = true
# if it is an Item
if @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_item(@item.id,-1)
# if it is a Weapon
elsif @item.is_a?(RPG::Weapon)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_weapon(@item.id,-1)
# if it is an Armor
elsif @item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_armor(@item.id,-1)
end # item type
@item_window.refresh
@weight_window.refresh
return
end # Input Drop button
#------------------
_tidloc_iweight_item
end # def
end # class
#-------------------------------------------------------------------------------
# * Scene_Shop
#-------------------------------------------------------------------------------
class Scene_Shop
alias _tidloc_iweight_buy update_buy
def update_buy
_tidloc_iweight_buy
if Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil or @item.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
max2 = $game_temp._tidloc_itemweight[@item.id]
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
max2 = $game_temp._tidloc_weaponweight[@item.id]
when RPG::Armor
number = $game_party.armor_number(@item.id)
max2 = $game_temp._tidloc_armorweight[@item.id]
end
if number == 999
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 999 : $game_party.gold / @item.price
return if max2 == 0
max2 = ($game_temp._tidloc_groupweight_max - $game_temp._tidloc_groupweight) / max2
max = [max, 999 - number, max2].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
#-------------------------------------------------------------------------------
# Scene Map
#-------------------------------------------------------------------------------
class Scene_Map
alias wieght_update update
def update
chest_size = $number_of_droped_items
if chest_size == 0 and $game_switches[CHEST_DROP::DROPED_ITEM_SW] == true
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = false
end
wieght_update
end
end
[/spoiler]
Ah i see why this could be, all the item weights are stored in Game_Temp, so when you load and save, its reset to like the game was started over again.
i think that all that needs to be done to correct this is change it from game temp, to game system. OR you could make a new class for the weights and make it a global and add it into the Scene_File script.
[edit]
I didn't edit the script that was posted, but i did edit the script that i have, and i seem to have fixed the problem.
################################################################################
# Item Weight V 1.0 #
# by Tidloc #
################################################################################
# V 1.6 #
# by Mr Wiggles - Drop to map. #
################################################################################
# This script allows the player to carry only a limited ammount of weight. #
# To define the weight of an item, weapon or armor simply enter \w<*VALUE*> #
# in the description box of that item. If left out the weight will be 0! #
################################################################################
# Definition of the constants: if a switch is 0, it's not used #
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAX ................. limit of weight, where the #
# player will be slowed down. #
TIDLOC_GROUPWEIGHT_MAX = 10 # Set by players Skill
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX ...... maximum weight, if exceeding #
# this limit, no more items can be #
# picked up. #
TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX = 1000000000
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAT_POWER ........... Number of decimal algarisms. #
TIDLOC_GROUPWEIGHT_MAT_POWER = 2
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH .... the number of the global switch #
# which shall be turned true if #
# the max-limit is exceeded. #
TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH = 20
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH ... the number of the global switch #
# which shall be turned true if #
# you cannot carry any more. #
TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH = 3
################################################################################
# To alter this limits in game use the following script-commads: #
# $game_weight.pweight(*VALUE*) for GROUPWEIGHT_MAX #
# $game_weight.pmax(*VALUE*) for CARRY_OVER_MAX #
# You may leave Value empty to reset to the constants. #
################################################################################
# You are free to use this script in what ever game you want, but please #
# credit me for this hell of work ^_^ #
# Credits also to Albertfish for his help when it was needed! #
################################################################################
# Mr Wiggles: #
# #
# This version will store recently droped items, which then can be picked #
# up through an event that calls a chest in Game_Guy's Item Storage Script. #
# #
# Use $game_weight.recentdrop for the chest that will house the recently #
# droped items from Tidloc's Weighted Items Script. #
################################################################################
module CHEST_DROP # Mr Wiggles
# Switch that when false erases items that where droped (like for a map change)
DROPED_ITEM_SW = 5
# This switch is Turned on when player drops new items
RELOCATE_ITEM = 9
# Button to drop item
DROP_ITEM = Keys::D
# Button to use item
USE_ITEM = Input::C # Space, Enter, "C"
# Chest that will store items
DROP_CHEST_ID = 1
end # Mr Wiggles
#-------------------------------------------------------------------------------
# * Window_Weight
#-------------------------------------------------------------------------------
class Window_Weight < Window_Base
def initialize
super(0, 0, 640, 480) # 140, 80
self.z = 200
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.font.name = "Times New Roman"
self.contents.font.size = 20
self.contents.clear
self.contents.font.color = system_color
a = 1
for i in 0...TIDLOC_GROUPWEIGHT_MAT_POWER
a*=10.0
end
# Draw Weight in Maxed out color if over max
if $game_weight.groupweight/a > $game_weight.groupweight_max/a
self.contents.font.color = knockout_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
# Draw Weight in Warning color if close to max
elsif $game_weight.groupweight/a >= $game_weight.groupweight_max/a - 15
self.contents.font.color = crisis_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
else
# Draw Weight in normal color if under max
self.contents.font.color = normal_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
end
# Draw Weight Total:
self.contents.draw_text(0,-9, 120, 32, "Weight Total:\n")
self.contents.font.color = normal_color
# Draw Weight help
self.contents.font.color = normal_color
self.contents.draw_text(280, -9, 200, 32, "Use items with Space,")
self.contents.draw_text(280, 9, 200, 32, "Drop items with \"D\".")
end
end
#==============================================================================
# * Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
if self.item != nil
help = self.item.description.to_s
$game_weight.item_description_lentgh = help.length
end
end
end
#-------------------------------------------------------------------------------
# * Game_Weight
#-------------------------------------------------------------------------------
class Game_Weight
attr_accessor :itemweight
attr_accessor :weaponweight
attr_accessor :armorweight
attr_accessor :groupweight
attr_accessor :groupweight_max
attr_accessor :groupweight_carry_over_max
attr_accessor :iweight_slow
attr_accessor :item_description_lentgh
attr_accessor :clear_item_bag
alias wo_weight_initialize initialize
def initialize
@itemweight = []
@weaponweight = []
@armorweight = []
@groupweight = 0
@groupweight_max = TIDLOC_GROUPWEIGHT_MAX
@groupweight_carry_over_max = TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
@iweight_slow = false
@item_description_lentgh = 0
@clear_item_bag = false
@data_items = load_data("Data/Items.rxdata")
@data_weapons = load_data("Data/Weapons.rxdata")
@data_armors = load_data("Data/Armors.rxdata")
for i in 1...@data_items.size
if @data_items[i].description[0] != nil
text = @data_items[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@itemweight[i]=$1.to_i
end
end
@data_items[i].description = text2
end
@itemweight[i] = 0 if @itemweight[i].nil?
end
for i in 1...@data_weapons.size
if @data_weapons[i].description[0] != nil
text = @data_weapons[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@weaponweight[i]=$1.to_i
end
end
@data_weapons[i].description = text2
end
@weaponweight[i] = 0 if @weaponweight[i].nil?
end
for i in 1...@data_armors.size
if @data_armors[i].description[0] != nil
text = @data_armors[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c == "\1"
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@armorweight[i]=$1.to_i
else
text2 += c
end
end
@data_armors[i].description = text2
end
@armorweight[i] = 0 if @armorweight[i].nil?
end
wo_weight_initialize
end
def pweight(new_weight=TIDLOC_GROUPWEIGHT_MAX)
@groupweight_max = new_weight
end
def pmax(new_max=TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX)
@groupweight_carry_over_max = new_max
end
end
$game_weight = Game_Weight.new
#-------------------------------------------------------------------------------
# Saves weight to save game file
#-------------------------------------------------------------------------------
class Scene_Save
alias game_weight_write_save_data write_save_data
def write_save_data(file)
game_weight_write_save_data(file)
Marshal.dump($game_weight, file)
end
end
#-------------------------------------------------------------------------------
# Loads weight from save game file
#-------------------------------------------------------------------------------
class Scene_Load
alias game_weight_read_save_data read_save_data
def read_save_data(file)
game_weight_read_save_data(file)
$game_weight = Marshal.load(file)
end
end
#-------------------------------------------------------------------------------
# * Game_Party
#-------------------------------------------------------------------------------
class Game_Party
def tidloc_slowing(slow=true)
if slow
$game_player.tidloc_alt_speed -1
else
$game_player.tidloc_alt_speed 1
end
end
#----------------------
# Gain Item
#----------------------
alias tidloc_iweight_item gain_item
def gain_item(item_id, n)
# Add Wieght
if item_id > 0
$game_weight.groupweight += $game_weight.itemweight[item_id] * n #([[item_number(item_id) + n, 0].max, 999].min - item_number(item_id))
end
# check if over weight
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif ($game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow)
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_item(item_id, n)
elsif ($game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow)
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_item(item_id, n)
else
tidloc_iweight_item(item_id, n)
end
end
#----------------------
# Gain Weapon
#----------------------
alias tidloc_iweight_weap gain_weapon
def gain_weapon(weapon_id, n)
if weapon_id > 0
$game_weight.groupweight += $game_weight.weaponweight[weapon_id] * n #([[weapon_number(weapon_id) + n, 0].max, 99].min - weapon_number(weapon_id))
end
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif $game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_weap(weapon_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_weap(weapon_id, n)
else
tidloc_iweight_weap(weapon_id, n)
end
end
#----------------------
# Gain Armor
#----------------------
alias tidloc_iweight_arm gain_armor
def gain_armor(armor_id, n)
if armor_id > 0
$game_weight.groupweight += $game_weight.armorweight[armor_id] * n #([[armor_number(armor_id) + n, 0].max, 99].min - armor_number(armor_id))
end
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif $game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_arm(armor_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_arm(armor_id, n)
else
tidloc_iweight_arm(armor_id, n)
end
end
end
#-------------------------------------------------------------------------------
# * Game_Player : Slows player when over weight
#-------------------------------------------------------------------------------
class Game_Player
def tidloc_set_speed(speed=4)
@move_speed = speed
end
def tidloc_alt_speed(speed=0)
@move_speed += speed
end
end
#-------------------------------------------------------------------------------
# * Scene_Item
#-------------------------------------------------------------------------------
class Scene_Item
alias iweight_main main
def main
@weight_window = Window_Weight.new
@weight_window.x = 0
@weight_window.y = 0
iweight_main
@weight_window.dispose
end
alias iweight_update update
def update
@weight_window.update
iweight_update
@weight_window.refresh
end
#-------------------------------------------------------------------------------
alias iweight_item update_item
def update_item
@item = @item_window.item
#------------------
if Input.trigger?(CHEST_DROP::USE_ITEM)
# If not an item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end # if scope == 4
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play($data_system.decision_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end # if consumable
$scene = Scene_Map.new
return
end # if common event
end # if item scope >= 3
@item_window.refresh
@weight_window.refresh
return
end # if Input::C
#------------------
if Input.trigger?(CHEST_DROP::DROP_ITEM) # Drop Item
# move item bag
$game_switches[CHEST_DROP::RELOCATE_ITEM] = true
# define $chest
if $game_weight.clear_item_bag == true
$chest = Game_Chest.new(GameGuy::ChestMaxItems)
$game_weight.clear_item_bag = false
else
$chest = $game_system.chests[CHEST_DROP::DROP_CHEST_ID]
end
# if it is an Item
if @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_item(@item.id,-1)
# add items into drop bag
$chest.add_item(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
# if it is a Weapon
elsif @item.is_a?(RPG::Weapon)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_weapon(@item.id,-1)
# add items into drop bag
$chest.add_weapon(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
# if it is an Armor
elsif @item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_armor(@item.id,-1)
# add items into drop bag
$chest.add_armor(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
end # item type
$game_map.refresh
@item_window.refresh
@weight_window.refresh
# update droped items
$game_system.add_chest(CHEST_DROP::DROP_CHEST_ID)
$game_map.game_chest_size(CHEST_DROP::DROP_CHEST_ID)
chest_size = $number_of_droped_items
return
end # Input Drop button
#------------------
iweight_item
end # def
end # class
#-------------------------------------------------------------------------------
# * Scene_Shop : Dis-allows buying past paty weight limit
#-------------------------------------------------------------------------------
class Scene_Shop
alias iweight_buy update_buy
def update_buy
iweight_buy
if Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil or @item.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
max2 = $game_weight.itemweight[@item.id]
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
max2 = $game_weight.weaponweight[@item.id]
when RPG::Armor
number = $game_party.armor_number(@item.id)
max2 = $game_weight.armorweight[@item.id]
end
if number == 999
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 999 : $game_party.gold / @item.price
return if max2 == 0
max2 = ($game_weight.groupweight_max - $game_weight.groupweight) / max2
max = [max, 999 - number, max2].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
#-------------------------------------------------------------------------------
# Scene Map : Updates players strength skill
#-------------------------------------------------------------------------------
class Scene_Map
alias wieght_init initialize
def initialize
wieght_init
@carry_max = 0
@old_skill = 0
@chest_size = 0
end
alias wieght_update update
def update
wieght_update
# Limits how oftin weight updates
if $game_party.skills($game_party.actors[0].name, "Strength") != @old_skill
@old_skill = $game_party.skills($game_party.actors[0].name, "Strength")
# Update carry max with Strength skill
@carry_max = $game_party.skills($game_party.actors[0].name, "Strength") * 5
# Add Strengths acording to Character Name
@carry_max += 15 if $game_party.actors[0].name == "James"
@carry_max += 25 if $game_party.actors[0].name == "Vic"
@carry_max += 10 if $game_party.actors[0].name == "Lisa"
@carry_max = @carry_max * 100
@old_carry_max = @carry_max
# Update Weight
$game_weight.pweight(@carry_max)
end
# Limits how oftin Item bag updates
if $number_of_droped_items != @chest_size
# Erase items that where droped if DROPED_ITEM_SW switch is off or if
# there are no droped items to pick up
if $game_system.chests[CHEST_DROP::DROP_CHEST_ID] != nil
$game_map.game_chest_size(CHEST_DROP::DROP_CHEST_ID)
end
# Create droped item bag
if $game_switches[CHEST_DROP::DROPED_ITEM_SW] == true and
$game_switches[CHEST_DROP::RELOCATE_ITEM] == true
$game_switches[CHEST_DROP::RELOCATE_ITEM] = false
$game_player.shoot(19) if $arcade_mode == nil or $arcade_mode == false
end
# check if bag is empty
@chest_size = $number_of_droped_items
if @chest_size == 0 and $game_switches[CHEST_DROP::DROPED_ITEM_SW] == true
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = false
@droped_bag = false
end
end
# if bag is empty clear bag and prep for next drop
if $game_switches[CHEST_DROP::DROPED_ITEM_SW] == false
$number_of_droped_items = 0
unless $game_switches[CHEST_DROP::RELOCATE_ITEM] == true
$game_switches[CHEST_DROP::RELOCATE_ITEM] = true
end
$game_weight.clear_item_bag = true
end
end
end
Thanks for your help, but I'm afraid didn't work.
I copied your script over, but I received an error with the drop key as soon as I started up the game. The next thing I tried was I had a look at how your script saved and loaded the data. I copied it over to my version of the script, but that didn't save or load (not sure which, or both) the data. I then copied the relevant bits of the script over to the load and save screens and put them underneath the item weights script. No joy there either.
I've noticed another effect from loading, which may be relevant (but it's annoying anyway. lol). After I load a game, if I add an item to the inventory it won't add any weight even if it's really heavy. I'm wondering if, for some reason, when I reload the game it's just not running the script.
There's also another possibility. I've got the SDK in the game as well and I don't know how compatible the two scripts are. I put the Save and Load scripts underneath, though, so it shouldn't interfere with those.
OHHHH... sorry man, that's my bad...
i am using an input script, and the key its looking for isn't there. you'll have to change it to "Input::C" or B, A, and such.
Before:
# Button to drop item
DROP_ITEM = Keys::D
After
# Button to drop item
DROP_ITEM = Input::A
And i have tested this script, it does work.
Thanks so much! It works! I've also learnt a thing or two about script editing as well, which is good.
Edit:
Got another problem now. I'll stop being a pain soon, I promise! XD
Anyway, I don't know if it does it on your game but with this new script it displays the "\w<1>" bit in the description in the inventory. If you don't have the same thing on yours then don't worry about it. I had to do a bit of editing to the UMS to get the new script to work. It may just be a problem with that.
I haven't seen this problem in my game, and its kinda late where i am, so i will just post what i think it is tomorrow if i get the chance.
K. No probs. It's just a graphics glitch, so it's not particularly urgent.
Yea i was getting the same problem, I fixed it and here is the updated script:
################################################################################
# Item Weight V 1.0 #
# by Tidloc #
################################################################################
# V 1.7 #
# by Mr Wiggles - Drop to map. #
################################################################################
# This script allows the player to carry only a limited ammount of weight. #
# To define the weight of an item, weapon or armor simply enter \w<*VALUE*> #
# in the description box of that item. If left out the weight will be 0! #
################################################################################
# Definition of the constants: if a switch is 0, it's not used #
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAX ................. limit of weight, where the #
# player will be slowed down. #
TIDLOC_GROUPWEIGHT_MAX = 10 # Set by players Skill
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX ...... maximum weight, if exceeding #
# this limit, no more items can be #
# picked up. #
TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX = 1000000000
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAT_POWER ........... Number of decimal algarisms. #
TIDLOC_GROUPWEIGHT_MAT_POWER = 2
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH .... the number of the global switch #
# which shall be turned true if #
# the max-limit is exceeded. #
TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH = 20
#-------------------------------------------------------------------------------
# TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH ... the number of the global switch #
# which shall be turned true if #
# you cannot carry any more. #
TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH = 3
################################################################################
# To alter this limits in game use the following script-commads: #
# $game_weight.pweight(*VALUE*) for GROUPWEIGHT_MAX #
# $game_weight.pmax(*VALUE*) for CARRY_OVER_MAX #
# You may leave Value empty to reset to the constants. #
################################################################################
# You are free to use this script in what ever game you want, but please #
# credit me for this hell of work ^_^ #
# Credits also to Albertfish for his help when it was needed! #
################################################################################
# Mr Wiggles: #
# #
# This version will store recently droped items, which then can be picked #
# up through an event that calls a chest in Game_Guy's Item Storage Script. #
# #
# Use $game_weight.recentdrop for the chest that will house the recently #
# droped items from Tidloc's Weighted Items Script. #
################################################################################
module CHEST_DROP # Mr Wiggles
# Switch that when false erases items that where droped (like for a map change)
DROPED_ITEM_SW = 5
# This switch is Turned on when player drops new items
RELOCATE_ITEM = 9
# Button to drop item
DROP_ITEM = Keys::D
# Button to use item
USE_ITEM = Input::C # Space, Enter, "C"
# Chest that will store items
DROP_CHEST_ID = 1
end # Mr Wiggles
#-------------------------------------------------------------------------------
# * Window_Weight
#-------------------------------------------------------------------------------
class Window_Weight < Window_Base
def initialize
super(0, 0, 640, 480) # 140, 80
self.z = 200
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.font.name = "Times New Roman"
self.contents.font.size = 20
self.contents.clear
self.contents.font.color = system_color
a = 1
for i in 0...TIDLOC_GROUPWEIGHT_MAT_POWER
a*=10.0
end
# Draw Weight in Maxed out color if over max
if $game_weight.groupweight/a > $game_weight.groupweight_max/a
self.contents.font.color = knockout_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
# Draw Weight in Warning color if close to max
elsif $game_weight.groupweight/a >= $game_weight.groupweight_max/a - 15
self.contents.font.color = crisis_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
else
# Draw Weight in normal color if under max
self.contents.font.color = normal_color
weight = ($game_weight.groupweight/a).to_s
max_weight = ($game_weight.groupweight_max/a).to_s
self.contents.draw_text(5, 9, 160, 32,weight+" / "+max_weight, 0)
end
# Draw Weight Total:
self.contents.draw_text(0,-9, 120, 32, "Weight Total:\n")
self.contents.font.color = normal_color
# Draw Weight help
self.contents.font.color = normal_color
self.contents.draw_text(280, -9, 200, 32, "Use items with Space,")
self.contents.draw_text(280, 9, 200, 32, "Drop items with \"D\".")
end
end
#==============================================================================
# * Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
if self.item != nil
help = self.item.description.to_s
$game_weight.item_description_lentgh = help.length
end
end
end
#-------------------------------------------------------------------------------
# * Game_Weight
#-------------------------------------------------------------------------------
class Game_Weight
attr_accessor :itemweight
attr_accessor :weaponweight
attr_accessor :armorweight
attr_accessor :groupweight
attr_accessor :groupweight_max
attr_accessor :groupweight_carry_over_max
attr_accessor :iweight_slow
attr_accessor :item_description_lentgh
attr_accessor :clear_item_bag
alias wo_weight_initialize initialize
def initialize
@itemweight = []
@weaponweight = []
@armorweight = []
@groupweight = 0
@groupweight_max = TIDLOC_GROUPWEIGHT_MAX
@groupweight_carry_over_max = TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
@iweight_slow = false
@item_description_lentgh = 0
@clear_item_bag = false
for i in 1...$data_items.size
if $data_items[i].description[0] != nil
text = $data_items[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@itemweight[i]=$1.to_i
end
end
$data_items[i].description = text2
end
@itemweight[i] = 0 if @itemweight[i].nil?
end
for i in 1...$data_weapons.size
if $data_weapons[i].description[0] != nil
text = $data_weapons[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c != "\1"
text2 += c
else
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@weaponweight[i]=$1.to_i
end
end
$data_weapons[i].description = text2
end
@weaponweight[i] = 0 if @weaponweight[i].nil?
end
for i in 1...$data_armors.size
if $data_armors[i].description[0] != nil
text = $data_armors[i].description
text2 = ""
text.gsub!(/\\w<([0-9]+)>/) {"\1[#{$1}]"}
while ((c = text.slice!(/./m)) != nil)
if c == "\1"
text.sub!(/\[([_A-Za-z0-9-]+)\]/, "")
@armorweight[i]=$1.to_i
else
text2 += c
end
end
$data_armors[i].description = text2
end
@armorweight[i] = 0 if @armorweight[i].nil?
end
wo_weight_initialize
end
def pweight(new_weight=TIDLOC_GROUPWEIGHT_MAX)
@groupweight_max = new_weight
end
def pmax(new_max=TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX)
@groupweight_carry_over_max = new_max
end
end
#==============================================================================
# Creates the Weight object
#==============================================================================
class Scene_Title
#------------------------------------------------------------------------------
# * MAIN
#------------------------------------------------------------------------------
alias weight_new_game command_new_game
def command_new_game
$game_weight = Game_Weight.new
weight_new_game
end
end
#-------------------------------------------------------------------------------
# Saves weight to save game file
#-------------------------------------------------------------------------------
class Scene_Save
alias game_weight_write_save_data write_save_data
def write_save_data(file)
game_weight_write_save_data(file)
Marshal.dump($game_weight, file)
end
end
#-------------------------------------------------------------------------------
# Loads weight from save game file
#-------------------------------------------------------------------------------
class Scene_Load
alias game_weight_read_save_data read_save_data
def read_save_data(file)
game_weight_read_save_data(file)
$game_weight = Marshal.load(file)
end
end
#-------------------------------------------------------------------------------
# * Game_Party
#-------------------------------------------------------------------------------
class Game_Party
def tidloc_slowing(slow=true)
if slow
$game_player.tidloc_alt_speed -1
else
$game_player.tidloc_alt_speed 1
end
end
#----------------------
# Gain Item
#----------------------
alias tidloc_iweight_item gain_item
def gain_item(item_id, n)
# Add Wieght
if item_id > 0
$game_weight.groupweight += $game_weight.itemweight[item_id] * n #([[item_number(item_id) + n, 0].max, 999].min - item_number(item_id))
end
# check if over weight
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif ($game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow)
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_item(item_id, n)
elsif ($game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow)
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_item(item_id, n)
else
tidloc_iweight_item(item_id, n)
end
end
#----------------------
# Gain Weapon
#----------------------
alias tidloc_iweight_weap gain_weapon
def gain_weapon(weapon_id, n)
if weapon_id > 0
$game_weight.groupweight += $game_weight.weaponweight[weapon_id] * n #([[weapon_number(weapon_id) + n, 0].max, 99].min - weapon_number(weapon_id))
end
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif $game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_weap(weapon_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_weap(weapon_id, n)
else
tidloc_iweight_weap(weapon_id, n)
end
end
#----------------------
# Gain Armor
#----------------------
alias tidloc_iweight_arm gain_armor
def gain_armor(armor_id, n)
if armor_id > 0
$game_weight.groupweight += $game_weight.armorweight[armor_id] * n #([[armor_number(armor_id) + n, 0].max, 99].min - armor_number(armor_id))
end
if $game_weight.groupweight > $game_weight.groupweight_carry_over_max
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH != -1
if !$game_weight.iweight_slow
$game_weight.iweight_slow = true
tidloc_slowing
end
elsif $game_weight.groupweight > $game_weight.groupweight_max && !$game_weight.iweight_slow
$game_weight.iweight_slow = true
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, true) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing
tidloc_iweight_arm(armor_id, n) if TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
$game_switches.[]=(TIDLOC_GROUPWEIGHT_OVERWEIGHT_SWITCH, true) if !TIDLOC_GROUPWEIGHT_CARRY_OVER_MAX
elsif $game_weight.groupweight <= $game_weight.groupweight_max && $game_weight.iweight_slow
$game_weight.iweight_slow = false
$game_switches.[]=(TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH, false) if TIDLOC_GROUPWEIGHT_MAXWEIGHT_SWITCH != -1
tidloc_slowing false
tidloc_iweight_arm(armor_id, n)
else
tidloc_iweight_arm(armor_id, n)
end
end
end
#-------------------------------------------------------------------------------
# * Game_Player : Slows player when over weight
#-------------------------------------------------------------------------------
class Game_Player
def tidloc_set_speed(speed=4)
@move_speed = speed
end
def tidloc_alt_speed(speed=0)
@move_speed += speed
end
end
#-------------------------------------------------------------------------------
# * Scene_Item
#-------------------------------------------------------------------------------
class Scene_Item
alias iweight_main main
def main
@weight_window = Window_Weight.new
@weight_window.x = 0
@weight_window.y = 0
iweight_main
@weight_window.dispose
end
alias iweight_update update
def update
@weight_window.update
iweight_update
@weight_window.refresh
end
#-------------------------------------------------------------------------------
alias iweight_item update_item
def update_item
@item = @item_window.item
#------------------
if Input.trigger?(CHEST_DROP::USE_ITEM)
# If not an item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end # if scope == 4
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play($data_system.decision_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end # if consumable
$scene = Scene_Map.new
return
end # if common event
end # if item scope >= 3
@item_window.refresh
@weight_window.refresh
return
end # if Input::C
#------------------
if Input.trigger?(CHEST_DROP::DROP_ITEM) # Drop Item
# move item bag
$game_switches[CHEST_DROP::RELOCATE_ITEM] = true
# define $chest
if $game_weight.clear_item_bag == true
$chest = Game_Chest.new(GameGuy::ChestMaxItems)
$game_weight.clear_item_bag = false
else
$chest = $game_system.chests[CHEST_DROP::DROP_CHEST_ID]
end
# if it is an Item
if @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_item(@item.id,-1)
# add items into drop bag
$chest.add_item(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
# if it is a Weapon
elsif @item.is_a?(RPG::Weapon)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_weapon(@item.id,-1)
# add items into drop bag
$chest.add_weapon(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
# if it is an Armor
elsif @item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
$game_party.gain_armor(@item.id,-1)
# add items into drop bag
$chest.add_armor(@item.id, 1)
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = true
end # item type
$game_map.refresh
@item_window.refresh
@weight_window.refresh
# update droped items
$game_system.add_chest(CHEST_DROP::DROP_CHEST_ID)
$game_map.game_chest_size(CHEST_DROP::DROP_CHEST_ID)
chest_size = $number_of_droped_items
return
end # Input Drop button
#------------------
iweight_item
end # def
end # class
#-------------------------------------------------------------------------------
# * Scene_Shop : Dis-allows buying past paty weight limit
#-------------------------------------------------------------------------------
class Scene_Shop
alias iweight_buy update_buy
def update_buy
iweight_buy
if Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil or @item.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
max2 = $game_weight.itemweight[@item.id]
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
max2 = $game_weight.weaponweight[@item.id]
when RPG::Armor
number = $game_party.armor_number(@item.id)
max2 = $game_weight.armorweight[@item.id]
end
if number == 999
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 999 : $game_party.gold / @item.price
return if max2 == 0
max2 = ($game_weight.groupweight_max - $game_weight.groupweight) / max2
max = [max, 999 - number, max2].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
#-------------------------------------------------------------------------------
# Scene Map : Updates players strength skill
#-------------------------------------------------------------------------------
class Scene_Map
alias wieght_init initialize
def initialize
wieght_init
@carry_max = 0
@old_skill = 0
@chest_size = 0
end
alias wieght_update update
def update
wieght_update
# Limits how oftin weight updates
if $game_party.skills($game_party.actors[0].name, "Strength") != @old_skill
@old_skill = $game_party.skills($game_party.actors[0].name, "Strength")
# Update carry max with Strength skill
@carry_max = $game_party.skills($game_party.actors[0].name, "Strength") * 5
# Add Strengths acording to Character Name
@carry_max += 15 if $game_party.actors[0].name == "James"
@carry_max += 25 if $game_party.actors[0].name == "Vic"
@carry_max += 10 if $game_party.actors[0].name == "Lisa"
@carry_max = @carry_max * 100
@old_carry_max = @carry_max
# Update Weight
$game_weight.pweight(@carry_max)
end
# Limits how oftin Item bag updates
if $number_of_droped_items != @chest_size
# Erase items that where droped if DROPED_ITEM_SW switch is off or if
# there are no droped items to pick up
if $game_system.chests[CHEST_DROP::DROP_CHEST_ID] != nil
$game_map.game_chest_size(CHEST_DROP::DROP_CHEST_ID)
end
# Create droped item bag
if $game_switches[CHEST_DROP::DROPED_ITEM_SW] == true and
$game_switches[CHEST_DROP::RELOCATE_ITEM] == true
$game_switches[CHEST_DROP::RELOCATE_ITEM] = false
$game_player.shoot(19) if $arcade_mode == nil or $arcade_mode == false
end
# check if bag is empty
@chest_size = $number_of_droped_items
if @chest_size == 0 and $game_switches[CHEST_DROP::DROPED_ITEM_SW] == true
$game_switches[CHEST_DROP::DROPED_ITEM_SW] = false
@droped_bag = false
end
end
# if bag is empty clear bag and prep for next drop
if $game_switches[CHEST_DROP::DROPED_ITEM_SW] == false
$number_of_droped_items = 0
unless $game_switches[CHEST_DROP::RELOCATE_ITEM] == true
$game_switches[CHEST_DROP::RELOCATE_ITEM] = true
end
$game_weight.clear_item_bag = true
end
end
end
also this was not a pain cause i like that you where able to find an error with something that i am using that i haven't found yet so i can fix it now.