Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ITEM WEIGHT
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Autor: Andrzej 'mc' Głuszak
- # Wersja: 1.1
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Opis: Dzięki temu skryptowi ustalisz limit wagi noszonych przez drużynę
- # przedmiotów. Od teraz drużyna noszące ze sobą tysiąc czołgów nie będzie
- # mogła się poruszać. UWAGA: do pozbycia się zbędnych czołgów serdecznie
- # polecam skrypt mojego autorstwa 'Drop Item'.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Instrukcja: Ustaw mnożnik (służy do obliczania maksymalnego obciążenia postaci,
- # wzór wygląda tak: maksymalne obciążenie = siła * mnożnik),
- # jednostkę i przypisz każdemu przedmiotowi jego wagę.
- #
- # Aby sprawdzić, czy drużyna jest przeciążona wywołaj skrypt
- # $game_party.burdened?
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Kompatybilność: Nie testowany z SDK.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Licencja: CREATIVE COMMONS Uznanie autorstwa 3.0 Unported (CC BY 3.0)
- # Wolno: kopiować, rozpowszechniać, odtwarzać i wykonywać utwór,
- # tworzyć utwory zależne
- # Na następujących warunkach: Uznanie autorstwa —
- # należy wpisać twórcę skryptu (mcgluszak)
- # do credits (podziękowań).
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Zmiany: v1.0 (18.05.11) - wydanie skryptu
- # v1.1 (21.07.11) - zmiana prędkości jeśli drużyna jest przeciążona,
- # otwieranie ekwipunku jeśli drużyna jest przeciążona
- #==============================================================================
- # KONFIGURACJA
- module Gluszak
- module Item_Weight
- # Mnożnik - maksymalne obciążenie = mnożnik * siła
- Multiplier = 1.1
- # Jednostka
- Unit = 'kg'
- # Przedmioty
- # id => waga, id => waga, itd.
- Items =
- {1 => 0.2,
- 2 => 0.25,
- 3 => 0.4}
- # Bronie
- # id => waga, id => waga, itd.
- Weapons =
- {1 => 3,
- 2 => 5,
- 3 => 10}
- # Zbroje
- # id => waga, id => waga, itd.
- Armors =
- {1 => 20,
- 2 => 15,
- 3 => 1.5}
- Burdened_Speed = 2 # Prędkość przeciążonej drużyny (0-6)
- Open_Equipment = true # Czy otworzyć ekwipunek jeśli drużyna jest przeciążona?
- end
- end
- # KONIEC KONFIGURACJI
- $item_weight = 1.1
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Obciążenie
- #--------------------------------------------------------------------------
- def encumbrance
- return Gluszak::Item_Weight::Multiplier * self.str
- end
- end
- #==============================================================================
- # ** Game_Party
- #==============================================================================
- class Game_Party
- attr_reader :max_encumbrance
- attr_reader :encumbrance
- #--------------------------------------------------------------------------
- # * Inicjalizacja
- #--------------------------------------------------------------------------
- alias :initialize_item_weight :initialize
- def initialize
- initialize_item_weight
- @max_encumbrance = 0
- @encumbrance = 0
- end
- #--------------------------------------------------------------------------
- # * Maksymalne obciążenie drużyny
- #--------------------------------------------------------------------------
- def max_encumbrance
- me = 0
- $game_party.actors.each {|actor| me += actor.encumbrance}
- return me
- end
- #--------------------------------------------------------------------------
- # * Obciążenie drużyny
- #--------------------------------------------------------------------------
- def encumbrance
- e = 0
- for i in 1..$data_items.size
- e += $game_party.item_number(i) * (Gluszak::Item_Weight::Items[i] != nil ? Gluszak::Item_Weight::Items[i] : 0)
- end
- for i in 1..$data_weapons.size
- e += $game_party.weapon_number(i) * (Gluszak::Item_Weight::Weapons[i] != nil ? Gluszak::Item_Weight::Weapons[i] : 0)
- end
- for i in 1..$data_armors.size
- e += $game_party.armor_number(i) * (Gluszak::Item_Weight::Armors[i] != nil ? Gluszak::Item_Weight::Armors[i] : 0)
- end
- $game_party.actors.each {|actor|
- e += Gluszak::Item_Weight::Weapons[actor.weapon_id] != nil ? Gluszak::Item_Weight::Weapons[actor.weapon_id] : 0
- e += Gluszak::Item_Weight::Armors[actor.armor1_id] != nil ? Gluszak::Item_Weight::Armors[actor.armor1_id] : 0
- e += Gluszak::Item_Weight::Armors[actor.armor2_id] != nil ? Gluszak::Item_Weight::Armors[actor.armor2_id] : 0
- e += Gluszak::Item_Weight::Armors[actor.armor3_id] != nil ? Gluszak::Item_Weight::Armors[actor.armor3_id] : 0
- e += Gluszak::Item_Weight::Armors[actor.armor4_id] != nil ? Gluszak::Item_Weight::Armors[actor.armor4_id] : 0
- }
- return e
- end
- #--------------------------------------------------------------------------
- # * Drużyna przeciążona?
- #--------------------------------------------------------------------------
- def burdened?
- return encumbrance > max_encumbrance
- end
- end
- #==============================================================================
- # ** Window_Base
- #==============================================================================
- class Window_Base
- #--------------------------------------------------------------------------
- # * Rysuj obciążenie drużyny
- #--------------------------------------------------------------------------
- def draw_encumbrance(x,y)
- e = $game_party.encumbrance.to_f
- em = $game_party.max_encumbrance.to_f
- if e/em < 0.85
- self.contents.font.color = system_color
- elsif e/em > 0.85 and e/em < 1
- self.contents.font.color = crisis_color
- else
- self.contents.font.color = knockout_color
- end
- self.contents.draw_text(x, y, 48, 32, e.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 50, y, 8, 32, '/')
- self.contents.draw_text(x + 60, y, 64, 32, em.to_s + 'kg')
- end
- end
- #==============================================================================
- # ** Window_Encumbrance
- #==============================================================================
- class Window_Encumbrance < Window_Base
- #--------------------------------------------------------------------------
- # * Inicjalizacja
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Odśwież
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_encumbrance(0,0)
- end
- end
- #==============================================================================
- # ** Scene_Item
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # * Główny proces
- #--------------------------------------------------------------------------
- alias :main_item_weight :main
- def main
- @encumbrance_window = Window_Encumbrance.new
- @encumbrance_window.x = 480
- @encumbrance_window.y = 414
- @encumbrance_window.z = 200
- main_item_weight
- @encumbrance_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Uaktualnij
- #--------------------------------------------------------------------------
- alias :update_item_weight :update
- def update
- update_item_weight
- @encumbrance_window.refresh
- end
- end
- #+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- # *** RPG
- #+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- module RPG
- #==============================================================================
- # ** RPG::Weapon
- #==============================================================================
- class Weapon
- #--------------------------------------------------------------------------
- # * Opis
- #--------------------------------------------------------------------------
- def description
- if Gluszak::Item_Weight::Weapons[@id] != nil
- weight = 'Waga: '
- unit = Gluszak::Item_Weight::Unit
- weight += Gluszak::Item_Weight::Weapons[@id].to_s + unit + ', '
- else
- weight = ''
- end
- return weight + @description
- end
- end
- #==============================================================================
- # ** RPG::Armor
- #==============================================================================
- class Armor
- #--------------------------------------------------------------------------
- # * Opis
- #--------------------------------------------------------------------------
- def description
- if Gluszak::Item_Weight::Armors[@id] != nil
- weight = 'Waga: '
- unit = Gluszak::Item_Weight::Unit
- weight += Gluszak::Item_Weight::Armors[@id].to_s + unit + ', '
- else
- weight = ''
- end
- return weight + @description
- end
- end
- #==============================================================================
- # ** RPG::Item
- #==============================================================================
- class Item
- #--------------------------------------------------------------------------
- # * Opis
- #--------------------------------------------------------------------------
- def description
- if Gluszak::Item_Weight::Items[@id] != nil
- weight = 'Waga: '
- unit = Gluszak::Item_Weight::Unit
- weight += Gluszak::Item_Weight::Items[@id].to_s + unit + ', '
- else
- weight = ''
- end
- return weight + @description
- end
- end
- end
- #==============================================================================
- # ** Game_Map
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Uaktualnij
- #--------------------------------------------------------------------------
- alias :update_item_weight :update
- def update
- update_item_weight
- $item_weight_open_once = false if !$game_party.burdened?
- if $game_party.burdened?
- $game_player.move_speed = Gluszak::Item_Weight::Burdened_Speed
- if Gluszak::Item_Weight::Open_Equipment and !$item_weight_open_once
- $item_weight_open_once = true
- $scene = Scene_Item.new
- end
- else
- $game_player.move_speed = 4
- end
- end
- end
- #==============================================================================
- # ** Game_Character
- #==============================================================================
- class Game_Character
- attr_accessor :move_speed
- end
- #==============================================================================
- # ** Scene_Title
- #==============================================================================
- class Scene_Title
- alias :main_item_weight :main
- def main
- $item_weight_open_once = false
- main_item_weight
- end
- end
Add Comment
Please, Sign In to add comment