Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ITEM WEIGHT
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Autor: Andrzej 'mc' Głuszak
- # Wersja: 1.0
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # 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ę.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # 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
- #==============================================================================
- # KONFIGURACJA
- module Gluszak
- module Item_Weight
- # Mnożnik
- 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 => 2,
- 2 => 3,
- 3 => 10}
- # Zbroje
- # id => waga, id => waga, itd.
- Armors =
- {1 => 20,
- 2 => 15,
- 3 => 1.5}
- end
- end
- # KONIEC KONFIGURACJI
- $item_weight = 1.0
- #==============================================================================
- # ** 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
- 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_Player
- #==============================================================================
- class Game_Player
- #--------------------------------------------------------------------------
- # * Uaktualnij
- #--------------------------------------------------------------------------
- def update
- last_moving = moving?
- unless moving? or $game_system.map_interpreter.running? or
- @move_route_forcing or $game_temp.message_window_showing or
- $game_party.encumbrance > $game_party.max_encumbrance
- # dopóki drużyna nie jest przeciążona
- case Input.dir4
- when 2
- move_down
- when 4
- move_left
- when 6
- move_right
- when 8
- move_up
- end
- end
- last_real_x = @real_x
- last_real_y = @real_y
- super
- if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
- $game_map.scroll_down(@real_y - last_real_y)
- end
- if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
- $game_map.scroll_left(last_real_x - @real_x)
- end
- if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
- $game_map.scroll_right(@real_x - last_real_x)
- end
- if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
- $game_map.scroll_up(last_real_y - @real_y)
- end
- unless moving?
- if last_moving
- result = check_event_trigger_here([1,2])
- if result == false
- unless $DEBUG and Input.press?(Input::CTRL)
- if @encounter_count > 0
- @encounter_count -= 1
- end
- end
- end
- end
- if Input.trigger?(Input::C)
- check_event_trigger_here([0])
- check_event_trigger_there([0,1,2])
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment