Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Load System, Give a weight value to your inventory
snstar2006
post Feb 22 2009, 04:35 PM
Post #1


Level 3
Group Icon

Group: Member
Posts: 34
Type: Scripter
RM Skill: Skilled




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 66RPG

Introduction
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


Customization
Enter [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
[Show/Hide] Screenshots
Attached File  load_scrn1.png ( 39.68K ) Number of downloads: 425

Sorry about the chinese in this screenshot, I'm too lazy to change it tongue.gif
There are just the name and description set in my database
Attached File  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

Credits
snstar2006, Snowy Star or in Chinese 雪流星

This post has been edited by snstar2006: Feb 23 2009, 08:31 PM
Go to the top of the page
 
+Quote Post
   
SuperMega
post Feb 22 2009, 04:48 PM
Post #2


Public memberTitle(String n)
Group Icon

Group: Revolutionary
Posts: 683
Type: Developer
RM Skill: Skilled




Awesome job snstar2006, this is a pretty nice script! This should be useful for something I'm cooking up.

This post has been edited by SuperMega: Feb 22 2009, 04:49 PM


__________________________
Translated Scripts:
Diagonal Movement (Eight Direction) and Smooth Jumping
Attack Party, Heal Enemies
Display Party Status On Map (DQ Style)
Display Maps Under Maps
Save Screen Customization
Subtitled Menus

If you want to suggest a translation for something, PM me, and I'll take a look. I AM TRYING TO GIVE AWAY LOCKERZ.com INVITES, SO PLEASE LET ME KNOW IF YOU WANT ONE.
Currently Working on 2 RPG Maker VX Projects. They are very unique, and have a different kind of style then the usual RPGs. So don't think of them as just another RPG. Did that sound rude? :D Not sure if I want them to go public yet, but we'll see how it goes.
Need a script translated? Come talk to me, and I'll see what I can do.
Go to the top of the page
 
+Quote Post
   
woratana
post Feb 22 2009, 06:05 PM
Post #3


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Very nice~!
Could you put the script in code tag, so the indentation doesn't go wrong. biggrin.gif

By the way, are you the same snstar that make Active Time Battle System?
I thought you were Japanese. tongue.gif


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
snstar2006
post Feb 22 2009, 06:25 PM
Post #4


Level 3
Group Icon

Group: Member
Posts: 34
Type: Scripter
RM Skill: Skilled




QUOTE (woratana @ Feb 22 2009, 08:05 PM) *
Very nice~!
Could you put the script in code tag, so the indentation doesn't go wrong. biggrin.gif

By the way, are you the same snstar that make Active Time Battle System?
I thought you were Japanese. tongue.gif

I added the code tag

And no, I don't think so.
I have never written a battle system,
and I am Chinese, not Japanese.
Go to the top of the page
 
+Quote Post
   
guzzleboy478
post Feb 23 2009, 06:00 PM
Post #5


Level 7
Group Icon

Group: Revolutionary
Posts: 109
Type: None
RM Skill: Skilled




Is it possible to change the max load?
Go to the top of the page
 
+Quote Post
   
woratana
post Feb 23 2009, 06:12 PM
Post #6


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Sorry. >_>
Your script is also nice as the other snstar. Keep up the good work!


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
snstar2006
post Feb 23 2009, 06:45 PM
Post #7


Level 3
Group Icon

Group: Member
Posts: 34
Type: Scripter
RM Skill: Skilled




QUOTE (guzzleboy478 @ Feb 23 2009, 08:00 PM) *
Is it possible to change the max load?

Max load is automatically calculated with this formula:
Actor's (maxhp + maxmp) * level / agi
Go to the top of the page
 
+Quote Post
   
Kovu
post Feb 23 2009, 07:43 PM
Post #8


NEWB HUNTER
Group Icon

Group: Revolutionary
Posts: 361
Type: Event Designer
RM Skill: Masterful




Is it Possible to event it so that when you have certain characters or a certtain amount of Actors in the party to change how much you can carry?


__________________________
All your cookies are belong yo us!
[Show/Hide] Puella Bellum

[Show/Hide] Starwars
Go to the top of the page
 
+Quote Post
   
snstar2006
post Feb 23 2009, 08:26 PM
Post #9


Level 3
Group Icon

Group: Member
Posts: 34
Type: Scripter
RM Skill: Skilled




QUOTE (Kovu @ Feb 23 2009, 09:43 PM) *
Is it Possible to event it so that when you have certain characters or a certtain amount of Actors in the party to change how much you can carry?

find and replace this part:
CODE

class Game_Actor < Game_Battler
# get the load for each member
def load
return (maxhp + maxmp) * @level / agi
end
end

with this:
CODE

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

Then in events you can use

$game_party.members[index].extra_load = X
or
$game_actors[id].extra_load = X

to add X to the actor's load

This post has been edited by snstar2006: Feb 23 2009, 08:31 PM
Go to the top of the page
 
+Quote Post
   
CrimsonPride
post Feb 23 2009, 08:27 PM
Post #10


Level 3
Group Icon

Group: Member
Posts: 30
Type: Event Designer
RM Skill: Skilled




That calculation for load is changeable, right? smile.gif
And would this be compatible with KGC_CategorizeItem? I would test it but I'm not at home for the next couple days =\
Go to the top of the page
 
+Quote Post
   
snstar2006
post Feb 23 2009, 08:29 PM
Post #11


Level 3
Group Icon

Group: Member
Posts: 34
Type: Scripter
RM Skill: Skilled




QUOTE (CrimsonPride @ Feb 23 2009, 10:27 PM) *
That calculation for load is changeable, right? smile.gif
And would this be compatible with KGC_CategorizeItem? I would test it but I'm not at home for the next couple days =\

Yeah you can change it if you know little about script

And I don't think it would have any problem working with KGC's script.
If it does, please tell me so that I can make some changes.
Go to the top of the page
 
+Quote Post
   
CrimsonPride
post Feb 23 2009, 08:49 PM
Post #12


Level 3
Group Icon

Group: Member
Posts: 30
Type: Event Designer
RM Skill: Skilled




I will let you know once i find out.
Go to the top of the page
 
+Quote Post
   
Brutanos
post May 13 2010, 01:07 AM
Post #13



Group Icon

Group: Member
Posts: 3
Type: Event Designer
RM Skill: Skilled




Does anyone know, if this have been made for RMXP too?
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 04:51 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker