Load System
Version:2.1
Author: snstar2006 (i.e. me)
Release Date:2009/02/23
* 2009/02/23
- Script update: Make load to be changeable in event
Exclusive Script at RPG RPG Revolution and 66RPGIntroduction Give a weight value to each item/weapon/armor, the player's party can only get more item when they have enough load.
Features * Restrict the party to gain item when the load is insufficient
* Pop up a warning message when the load is insufficient
* Disable dash automatically when total load >= 75% of the max load
* Shows a load window in the Item scene
Script CODE
class RPG::BaseItem
# get the weight of an item
def load
return if self.is_a?(RPG::Skill)
self.note.split(/[\r\n]+/).each { |line|
if line =~ /\[(?:load) (\w+)\]/
return $1.nil? ? 0 : $1.to_i
end}
return 0
end
end
class Scene_Item < Scene_Base
alias load_start start
alias load_terminate terminate
alias load_update update
def start
# create load window
load_start
@load_window = Window_Base.new(392, 0, 152, 56)
@load_window.viewport = @viewport
end
def terminate
# dispose load window
@load_window.dispose
load_terminate
end
def update
@load_window.update
# update load window
if @temp_load != $game_party.current_load
@load_window.contents.draw_text(0, 0, 120, 24, "#{$game_party.current_load}/#{$game_party.total_load}")
@temp_load = $game_party.current_load
end
load_update
end
end
class Game_Party < Game_Unit
attr_reader :current_load
alias load_initialize initialize
alias load_gain_item gain_item
def initialize
load_initialize
@current_load = 0
end
# get the maximum load for the party
def total_load
party_load = 0
for i in 0...members.size
actor = members[i]
party_load += actor.load
end
return party_load
end
def gain_item(item, n, include_equip = false)
return if item.nil?
if ((item.load * n) + @current_load) > total_load
show_load_message
return
else
@current_load += item.load * n
end
load_gain_item(item, n, include_equip)
end
def show_load_message
$game_message.texts.push("Insuffient load, please clean up your inventory.")
$game_message.visible = true
end
end
class Game_Actor < Game_Battler
attr_accessor :extra_load
alias load_system_initialize initialize
def initialize(actor_id)
load_system_initialize(actor_id)
@extra_load = 0
end
# get the load for each member
def load
return ((maxhp + maxmp) * @level / agi) + @extra_load
end
end
class Game_Interpreter
alias load_command_126 command_126
alias load_command_127 command_127
alias load_command_128 command_128
def command_126
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 0, n)
load_command_126
end
def command_127
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 1, n)
load_command_127
end
def command_128
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load(@params[0], 2, n)
load_command_128
end
def check_load(item_id, type, n)
case type
when 0; item = $data_items[item_id]
when 1; item = $data_weapons[item_id]
when 2; item = $data_armors[item_id]
end
if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
$game_party.show_load_message
return true
end
return false
end
end
class Game_Map
alias load_disable_dash? disable_dash?
def disable_dash?
# disable dash when load is greater than 75% of the max load
k = (1.00 * $game_party.current_load / $game_party.total_load)
return true if (k >= 0.75)
load_disable_dash?
end
end
CustomizationEnter [load X]
when X is an integer in the "note" field of the item/weapon/armor tab
then the item is given X as its weight.
The items that are not given a weight value is assume as 0
You can use
$game_party.members[index].extra_load = X
or
$game_actors[id].extra_load = X
in the event to add X to the actor's load
Compatibility Little potential to have conflict with item-scene-related scripts, but possibility is low since the methods are aliased
Screenshot
load_scrn1.png ( 39.68K )
Number of downloads: 425Sorry about the chinese in this screenshot, I'm too lazy to change it
There are just the name and description set in my database
load_scrn2.png ( 33.54K )
Number of downloads: 380 DEMO Plug and play, so there is no need for a demo
Installation Plug and play......as long as you setup the weight values for the items
Max load is automatically calculated with this formula:
Actor's (maxhp + maxmp) * level / agi
Terms and Conditions Use it free as long as the credit is included
Creditssnstar2006, Snowy Star or in Chinese 雪流星
This post has been edited by snstar2006: Feb 23 2009, 08:31 PM