To program do tworzenia gier RPG - jest też możliwość stworzenia gier innego gatunku poprzez "grzebanie" w skryptach.
2.Co to jest skrypt?
To polecenie napisane w języku RUBY - mogą dotyczyć wszystkiego co jest związane z programem, gdyż on sam korzysta z RUBY.
3.Gdzie mogę znaleźć skrypty?
Możesz poszukać w Internecie na stronach poświęconych programowi lub na forum w odpowiednim dziale.
4.Czy mogę sam napisać skrypt?
Jasne, ale to wymaga znajomości tego języka - a to nie jest takie proste :)
5.Jak dodawać skrypty?
Na pasku u góry w programie masz kilka ikonek. Ikona notesu to edytor skryptów. Po lewej stronie znajdziesz listę, a na samym jej dole punkt na liście o nazwie "main". Nad "main" możesz pisać/wklejać nowe/gotowe skrypty.
6.Czego dotyczy reszta skryptów?
Dotyczą działania całego programu i wyglądu twojej gry. Jeśli nie wiesz co robisz - nie ruszaj tego! Nawet najmniejsza zmiana może uszkodzić grę w postaci błędu przy odtwarzaniu.
7.Co jeśli przy nowym skrypcie wyskoczy mi błąd?
Musisz dokładnie przeczytać instrukcję skryptu lub po prostu kombinować. Jeśli nadal nie działa poszukaj pomocy na forum.
8.Co to są Tilesety/Charsety/Battlersy/Facesety?
Tile(set) - to zestaw pojedynczych kwadracików (komórek), które tworzą mapę.
Char(set) - to animacja postaci składająca się zazwyczaj z dwunastu klatek (ang. character-postać).
Battler - to każdy przeciwnik w grze (ang. dosł. postać bitewna)
Face(set) - to portrety bohaterów lub potworów (anf. face-twarz/faceset-zestaw twarzy).
9.Do czego służy baza danych?
To tutaj znajduję się centrala twojej gry. W bazie danych możesz:
- zmienić nazwę gry oraz dźwięki,
- ustawić typowe zdarzenia,
- stworzyć przedmioty wraz z brońmi i pancerzami,
- stworzyć postacie,
- stworzyć klasy i umiejętności,
- stworzyć przeciwników,
10.Dobrze przeczytałem instrukcje skryptu ale on nie działa!
Nie wszystkie skrypty są ze sobą kompatybilne. Poszukaj pomocy na forum lub zrezygnuj ze skryptu.
11.Co to jest zdarzenie?
To każda możliwa czynność, wykonana w programie, np. wiadomość, walka, ruch postaci itp.
12.Co to są typowe zdarzenia?
To zdarzenia, które po aktywacji przełącznika są dostępne wszędzie i zawsze, gdyż obejmują całą grę - później dowiesz się że są bardzo przydatne :)
13.Jaka jest różnica między dotknięciem zdarzenia a bohatera?
Ta różnica jest bardzo zauważalna przy tworzeniu potworów chodzących po mapie. Walka z nimi odbędzie się wtedy kiedy to ty wejdziesz na nie (zdarzenia) lub kiedy one dotkną ciebie (bohatera).
14.Nie umiem jeszcze dobrze obsługiwać programu - co robić?
Podczas załadowania pliku do programu, program poprosi cię o podanie, który z kolorów jest tłem i pół-tłem. Wystarczy, że klikniesz na tło lewym przyciskiem myszy.
22.Jak dodawać nowe obrazki?
Kliknij na ikonkę (czerwoną) koło edytora skryptu i bazy danych. Potem wybierz do jakiego folderu go importować.
23.Jak spakować mój projekt, aby można było w niego grać, ale nie można było wnim grzebać?
Wystarczy zrobić "utwórz plik instalacyjny/compress data" i zaznaczyć "zakoduj grę".
25.Jak mogę zwiększyć poziom i statystyki mojego bohatera?
Jest odpowiedni skrypt zwiększający umiejętności bohatera na większe niż w bazie danych - niestety możesz to zmienić tylko w grze, a nie w bazie danych.
26.Jaki program usunie tło z charsetów?
Wypróbuj Paint.Net - idealny do usuwania tła. Program jest na darmowej licencji.
27.Czy mogę wrzucić swoją grę na stronę jako grę MMO?
Możesz to zrobić na pojedynczych mapach oraz w całej grze.
Mapa - Disable dashing
Gra - skrypt Game_Player, linijka return Input.press?(Input::A) do usunięcia
38. Jak zmienić czcionkę w programie?
Skorzystaj ze skryptu zmiany czcionki dla całego programu - dla pojedynczych skryptów zmień to w ich kodzie. Pamiętaj aby czcionkę spakować razem z projektem.
http://www.ultimateam.pl/viewtopic.php?t=1919
39. Czy mogę w RPG Makerze stworzyć grę strategiczną?
class Window_ActorCommand < Window_Command
def setup(actor)
s1 = Vocab::skill
s2 = Vocab::guard
s3 = Vocab::item
if actor.class.skill_name_valid # Skill command name is valid?
s2 = actor.class.skill_name # Replace command name
end
@commands = [s1, s2, s3]
@item_max = 3
refresh
self.index = 0
end
end
class Scene_Battle < Scene_Base
def update_actor_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
prior_actor
elsif Input.trigger?(Input::C)
case @actor_command_window.index
when 0 # Skill
Sound.play_decision
start_skill_selection
when 1 # Guard
Sound.play_decision
@active_battler.action.set_guard
next_actor
when 2 # Item
Sound.play_decision
start_item_selection
end
end
end
end
KOMENDA = "Rzut" # nazwa komendy
ID_UMIEJĘTNOŚCI = 1 # ID umiejętnośc w bazie danych
end
class Window_ActorCommand < Window_Command
def setup(actor)
s1 = Vocab::skill
s2 = Vocab::guard
s3 = Vocab::item
s4 = AYENE::KOMENDA
if actor.class.skill_name_valid # Skill command name is valid?
s1 = actor.class.skill_name # Replace command name
end
@commands = [s1, s2, s3, s4]
@item_max = 4
refresh
self.index = 0
end
end
class Scene_Battle < Scene_Base
def update_actor_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
prior_actor
elsif Input.trigger?(Input::C)
case @actor_command_window.index
when 0 # Skill
Sound.play_decision
start_skill_selection
when 1 # Guard
Sound.play_decision
@active_battler.action.set_guard
next_actor
when 2 # Item
Sound.play_decision
start_item_selection
when 3 # Rzut
Sound.play_decision
@active_battler.action.set_skill(AYENE::ID_UMIEJĘTNOŚCI)
start_target_enemy_selection
end
end
end
end
[/code]
49. Dlaczego na moim komputerze działa gra, a na komputerze kolegi nie?
Pewnie dlatego, że kolega nie ma zainstalowanego programu. Aby gra działała poprawnie, musisz spakować całe RTP podczas kompresji gry oraz wszystko co masz na komputerze, a korzystasz z tego w projekcie.
50. Czy można zmienić ekwipunek bohatera w czasie walki?
def setup(actor)
s1 = Vocab::attack
s2 = Vocab::skill
s3 = Vocab::guard
s4 = Vocab::item
s5 = Vocab::equip # Ekwipunek
if actor.class.skill_name_valid
s2 = actor.class.skill_name
end
@commands = [s1, s2, s3, s4, s5]
@item_max = 5 # odpowiada ilości komend
refresh
self.index = 0
update
end
end
#--------------------------------------------------------------------------
# Scene_Battle
#--------------------------------------------------------------------------
class Scene_Battle < Scene_Base
def update
super
update_basic(true)
update_info_viewport
if $game_message.visible
@info_viewport.visible = false
@message_window.visible = true
end
unless $game_message.visible
return if judge_win_loss
update_scene_change
if @target_enemy_window != nil
update_target_enemy_selection
elsif @target_actor_window != nil
update_target_actor_selection
elsif @skill_window != nil
update_skill_selection
elsif @item_window != nil
update_item_selection
elsif @party_command_window.active
update_party_command_selection
elsif @actor_command_window.active
update_actor_command_selection
elsif @equip_window != nil
update_equip
else
process_battle_event
process_action
process_battle_event
end
end
end
def update_actor_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
prior_actor
elsif Input.trigger?(Input::C)
case @actor_command_window.index
when 0
Sound.play_decision
@active_battler.action.set_attack
start_target_enemy_selection
when 1
Sound.play_decision
start_skill_selection
when 2
Sound.play_decision
@active_battler.action.set_guard
next_actor
when 3
Sound.play_decision
start_item_selection
when 4 # Ekwipunek
Sound.play_decision
start_equip_selection
end
end
end
def create_equip_windows
@item_windows = []
for i in 0...5
@item_windows[i] = Window_EquipItem.new(0, 208, 544, 80, @active_battler, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].y = 208
@item_windows[i].height = 80
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
def update_equip_windows
for i in 0...5
@item_windows[i].visible = (@equip_window.index == i)
@item_windows[i].update
end
@equip_item_window = @item_windows[@equip_window.index]
end
def update_equip
@help_window.update
update_equip_window
update_equip_windows
update_equip_status_window
if @equip_window.active
update_equip_selection
elsif @equip_item_window.active
update_equip_item_selection
end
end
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_equip_selection
elsif Input.trigger?(Input::C)
if @active_battler.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@equip_item_window.active = true
@equip_item_window.index = 0
end
end
end
def end_equip_selection
if @equip_window != nil
@equip_window.dispose
@equip_window = nil
@equip_status_window.dispose
@equip_status_window = nil
@help_window.dispose
@help_window = nil
@actor_command_window.active = true
for window in @item_windows
window.dispose
end
end
end
def update_equip_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@equip_item_window.index = -1
@equip_item_window.active = false
elsif Input.trigger?(Input::C)
Sound.play_equip
@active_battler.change_equip(@equip_window.index, @equip_item_window.item)
@equip_window.active = true
@equip_window.refresh
@equip_item_window.active = false
@equip_item_window.index = -1
for equip_item_window in @item_windows
equip_item_window.refresh
end
end
end
end
#==============================================================================
# Limited Inventory
# Version: 1.1c
# Author: modern algebra
# Date: September 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
# This script allows you to set an inventory limit to how many item slots
# your inventory can hold. It allows some items to be stackable, and you can
# also set items to be undiscardable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
# Place this script above Main and below other custom scripts.
#
# To set a number of the default conditions for this script, please see the
# Editable Regions at 53, 84, and 109. Be sure to read the comments next to
# each consant to see what it does.
#
# To set an item as non-discardable, put this command into its note box:
#
# \NONDISCARD
#
# To set an item to have a stack size different from the default, use this
# command in its note box:
#
# \STACKMAX[x]
#
# where x is and integer and the new maximum stack size for that item.
#
# To resize the party inventory in-game, say after an event where the get a
# new backpack or whatever, then all you need to do is put this code into a
# call script:
#
# resize_inventory (x)
#
# where x is an integer and the new number of slots in the party inventory.
#==============================================================================
module Vocab
#==========================================================================
# * Constants
#==========================================================================
#//////////////////////////////////////////////////////////////////////////
# EDITABLE REGION
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
MA_AMOUNT_PREFIX = "x" # Prefix before item amount in each stack
MA_LOOT_LABEL = "Loot" # Label for Discard Pile items
MA_COMMAND_DISCARD = "Discard" # Command to discard items
MA_COMMAND_EXCHANGE = "Exchange" # Command to switch loot item with party item
MA_COMMAND_TAKE = "Take" # Command to take from Loot pile
MA_COMMAND_USE = "Use" # Command to Use an item
MA_COMMAND_DESTROY = "Destroy" # Command to completely destroy item
# Question printed when deciding whether or not to leave inventory when loot
# still has items in it
MA_WARNING_LABEL = "#{MA_COMMAND_DESTROY} all items in #{MA_LOOT_LABEL}?"
MA_WARNING_YES = "Yes" # Command to Leave inventory when warned
MA_WARNING_NO = "No" # Command to stay in inventory when warned.
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////
end
#==============================================================================
# *** Sound
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new constants - MA_DISCARD_SE, MA_EXCHANGE_SE, MA_TAKE_SE, MA_DESTROY_SE
#==============================================================================
module Sound
#==========================================================================
# * Constants
#==========================================================================
#//////////////////////////////////////////////////////////////////////////
# EDITABLE REGION
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
MA_DISCARD_SE = "Move" # SE played when discarding item from inventory
MA_EXCHANGE_SE = "Move" # SE played when switching loot item for party item
MA_TAKE_SE = "Equip" # SE played when taking item from loot
MA_DESTROY_SE = "Close1" # SE played when destroying item from loot
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////
end
#==============================================================================
# *** RPG
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new constants - MA_DEFAULT_STACK_AMOUNT, MA_DEFAULT_INVENTORY_SIZE,
# MA_EMPTYSLOTS_ICON_ID, MA_WARN_WINDOW
# modified class - BaseItem
#==============================================================================
module RPG
#==========================================================================
# * Constants
#==========================================================================
#//////////////////////////////////////////////////////////////////////////
# EDITABLE REGION
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
MA_DEFAULT_STACK_AMOUNT = 1 # The default maximum stack amount for items
MA_DEFAULT_INVENTORY_SIZE = 18 # The default maximum slot number for inventory
MA_EMPTYSLOTS_ICON_ID = 144 # The icon for empty slots
MA_WARN_WINDOW = true # Warn before leaving inventory with items in loot?
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////
#==========================================================================
# ** BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new methods - ma_stack_amount, ma_discardable?
#==========================================================================
class BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Stack Amount
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_stack_amount
return self.note[/\\STACKMAX\[(\d+)\]/i] != nil ? $1.to_i : RPG::MA_DEFAULT_STACK_AMOUNT
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Non-Discardable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_discardable?
return self.note[/\\NONDISCARD/i] == nil
end
end
end
#==============================================================================
# ** Game Temp
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new public instance variables - slots_to_discard
#==============================================================================
class Game_Temp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :slots_to_discard # A Game_LimitedInventory object
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias algmod_grafikal009_init_tmp_lim_inventory_94n6 initialize
def initialize
# Run Original method
algmod_grafikal009_init_tmp_lim_inventory_94n6
# Create Inventory object
@slots_to_discard = Game_LimitedInventory.new (-1)
end
end
#==============================================================================
# ** Game LimInvSlot
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This class holds the data on a single slot of the inventory
#==============================================================================
class Game_LimInvSlot
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :item_type # The type of item held in this slot
attr_reader :item_id # The ID of the item currently held
attr_reader :amount # The number of items this slot holds
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
@item_type = -1
@item_id = 0
@amount = 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add Item
# n : the amount to add
# item_type : the type of item being added
# item_id : the ID of item being added
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def add_item (n, item_type = -1, item_id = 0)
# Set item if that is sent through
if item_type != -1
@item_type = item_type
@item_id = item_id
end
x = space_left
# Check amount
if n > x
# If more given than can fit
@amount += x
return n - x
else
# If the n given will fit
@amount += n
return 0
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Item
# n : the amount to remove
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def remove_item (n)
@amount -= n
if @amount <= 0
n = -1*@amount
# Delete item from this slot
@item_type = -1
@item_id = 0
@amount = 0
return n
end
return 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def item
return case @item_type
when -1 then nil # No item stored
when 0 then $data_items[@item_id] # Item
when 1 then $data_weapons[@item_id] # Weapon
when 2 then $data_armors[@item_id] # Armour
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Space Left
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def space_left
return 1 if item == nil
return item.ma_stack_amount - @amount
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Equal?
# other : another Game_LimInvSlot
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def == (other)
return false if !other.is_a? (Game_LimInvSlot)
return false if other.item_type != @item_type
return false if other.item_id != @item_id
return false if other.amount != @amount
return super (other)
end
end
#==============================================================================
# ** Game_LimitedInventory
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This is an array to store the party's inventory
#==============================================================================
class Game_LimitedInventory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :max_size # The maximum number of slots. If -1, infinite.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
# size : the number of slots available
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (size)
@max_size = size
clear
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear
@items = []
@weapons = []
@armors = []
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Resize
# size : the number of slots available
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def resize (size)
old_size = slots.size
# If new size is smaller
if size < old_size
# Save discarded items
index = slots.size - 1
while slots.size > @max_size
slot = slots[index]
if slot.item.ma_discardable?
type, id, n = slot.item_type, slot.item_id, slot.amount
# Discard additional slots
remove_item (type, id, n)
$game_temp.slots_to_discard.add_item (type, id, n)
else
index -= 1
end
break if index < 0
end
end
@max_size = size
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add Item
# type : the type of item being added
# id : the ID of item being added
# n : the amount to add
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def add_item (type, id, n = 1)
array = case type
when 0 then @items
when 1 then @weapons
when 2 then @armors
end
sort_index = 0
# Go through all slots
array.each { |slot|
# If you can place the item in this slot
if slot.item_id == id
n = slot.add_item (n, type, id)
break if n == 0
sort_index += 1
elsif slot.item_id < id
sort_index += 1
else
break
end
}
if n > 0
# If there are empty slots
while @max_size == -1 || ((@items.size + @weapons.size + @armors.size) < @max_size)
slot = Game_LimInvSlot.new
n = slot.add_item (n, type, id)
array.insert (sort_index, slot)
sort_index += 1
break if n == 0
end
end
return n
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Item
# type : the type of item being removed
# id : the ID of item being removed
# n : the amount to remove
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def remove_item (type, id, n = 1)
array = case type
when 0 then @items
when 1 then @weapons
when 2 then @armors
end
# Go through all slots in reverse order
array.reverse.each { |slot|
# If this slot has the right item in it, remove from this slot
if slot.item_type == type && slot.item_id == id
n = slot.remove_item (n)
array.delete (slot) if slot.amount == 0
break if n == 0
end
}
return n
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Item Slots
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def slots
return @items + @weapons + @armors
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check Space
# item : an RPG::Item, RPG::Weapon, or RPG::Armor object
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def enough_space? (slot)
return true if @max_size == -1 || slots.size < @max_size
# Check array for other instances of the item
array = [@items, @weapons, @armors][slot.item_type]
array.each { |i|
if i.item_id > slot.item_id
break
elsif i.item_id == slot.item_id
return true if i.space_left < slot.item.ma_stack_amount
end
}
return false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Equals?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def == (other)
return false unless other.is_a? (Game_LimitedInventory)
return false if @max_size != other.max_size
return false if slots != other.slots
return super (other)
end
end
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - change_equip
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 change_equip
def change_equip (*args)
# Run Original Method
mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 (*args)
# Since you gain items before you lose them, check if item is Loot when it
# could be in Party inventory
if !$game_temp.slots_to_discard.slots.empty?
# Take as many from loot as possible
$game_temp.slots_to_discard.slots.reverse.each { |slot|
break unless $game_party.limit_inventory.enough_space? (slot)
item, type, id, n = slot.item, slot.item_type, slot.item_id, slot.amount
$game_party.gain_item (item, n)
$game_temp.slots_to_discard.remove_item (type, id, n)
}
end
end
end
#==============================================================================
# ** Game Party
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new instance variable - limit_inventory
# aliased methods - initialize, gain_item
#==============================================================================
class Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :limit_inventory # A Game_LimitedInventory object
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modlg_lm_inv_grafkal_init_4n56 initialize
def initialize
# Run Original method
modlg_lm_inv_grafkal_init_4n56
# Create Inventory object
@limit_inventory = Game_LimitedInventory.new (RPG::MA_DEFAULT_INVENTORY_SIZE)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Gain Items (or lose)
# item : Item
# n : Number
# include_equip : Include equipped items
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias drnlgbr_grafikal_limited_inventory_gn_itm_94n6 gain_item
def gain_item(item, n, include_equip = false)
# Run Original method
drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (item, n, include_equip)
if item != nil
type = item.is_a? (RPG::Item) ? 0 : item.is_a? (RPG::Weapon) ? 1 : 2
# Gain or lose item depending on everything.
if n > 0
n2 = @limit_inventory.add_item (type, item.id, n)
n -= n2
# If it is a nondiscardable item and you cannot hold all of them
if !item.ma_discardable?
while n2 > 0
# Find first nondiscardable item in the inventory
for i in 0...@limit_inventory.slots.size
slot = @limit_inventory.slots[i]
if slot.item.ma_discardable?
l_type, id = slot.item_type, slot.item_id
# Find smallest slot of that item
while l_type == slot.item_type && id == slot.item_id
i += 1
slot = @limit_inventory.slots[i]
end
l_item, l_n = @limit_inventory.slots[i - 1].item, @limit_inventory.slots[i - 1].amount
break
end
end
# Remove that item from inventory
lose_item (l_item, l_n)
$game_temp.slots_to_discard.add_item (l_type, id, l_n)
n3 = @limit_inventory.add_item (type, item.id, n2)
n -= n3
n2 = n3
end
end
else
n2 = @limit_inventory.remove_item (type, item.id, -1*n)
n += n2
n2 *= -1
end
end
return if item == nil
# Send rest to loot
if n2 > 0
$game_temp.slots_to_discard.add_item (type, item.id, n2)
elsif n2 < 0
$game_temp.slots_to_discard.remove_item (type, item.id, -1*n2)
end
end
end
#==============================================================================
# ** Game Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - command_end
# new method - resize_inventory
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Resize Inventory
# new_size : the size you now want the inventory to be
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def resize_inventory (new_size)
$game_party.limit_inventory.resize (new_size)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Command End
#``````````````````````````````````````````````````````````````````````````
# If there are items in $game_temp.loot, open up the inventory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_grid_inventory_open_inventory_end_command command_end
def command_end
# Run Original Method
modalg_grid_inventory_open_inventory_end_command
unless $game_temp.slots_to_discard.slots.empty?
$scene = Scene_Item.new
end
end
end
class Window_Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalg_gral9_ivntlim_rfrsh_2n45 refresh
def refresh (inventory = $game_party.limit_inventory, columns = @column_max)
if self.is_a? (Window_EquipItem)
mdrnalg_gral9_ivntlim_rfrsh_2n45
return
end
@is_loot = inventory == $game_temp.slots_to_discard
@spacing = 32
@data = []
@empty_sprites.each { |sprite| sprite.dispose } unless @empty_sprites == nil
@empty_sprites = []
@column_max = columns
for slot in inventory.slots
next unless include?(slot.item)
@data.push(slot)
if slot.item.is_a?(RPG::Item) and slot.item_id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@item_max = inventory.max_size == -1 ? @data.size : inventory.max_size
create_contents
# Calculate number of empty slots to draw
empty_slots = (inventory.max_size == -1 || !$scene.is_a? (Scene_Item)) ? 0 : inventory.max_size - inventory.slots.size
@wlh = (self.contents.height * @column_max) / ([@data.size + empty_slots, 1].max)
@wlh = @wlh > 32 ? 32 : @wlh < WLH ? WLH : @wlh
for i in 0...@data.size
draw_item(i)
end
sprite_viewport = Viewport.new (self.x + 16, self.y + 16, self.width - 32, self.height - 32)
viewport_adjusted = false
for i in @data.size...empty_slots + @data.size
rect = item_rect (i)
if rect.y + rect.height > page_row_max*@wlh && !viewport_adjusted
sprite_viewport.rect.height = rect.y
viewport_adjusted = true
end
sprite = Sprite_Base.new (sprite_viewport)
sprite.x, sprite.y = rect.x, rect.y
sprite.visible = self.visible
sprite.blend_type = 2
empty_bmp = Bitmap.new (rect.width, rect.height) if empty_bmp == nil
sprite.bitmap = empty_bmp.dup
sprite.bitmap.fill_rect (0, 1, rect.width, rect.height - 2, Color.new (127, 127, 127, 105))
@empty_sprites.push (sprite)
end
empty_bmp.dispose unless empty_bmp == nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Item Rect
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def item_rect (index)
wlh = @wlh == nil ? WLH : @wlh
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = wlh
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * wlh
return rect
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Top Row
# row : row shown on top
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def top_row=(row)
old_oy = self.oy
super (row)
@empty_sprites.each { |sprite| sprite.y -= (self.oy - old_oy) }
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Item
# index : item number
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 draw_item
def draw_item(index)
if self.is_a? (Window_EquipItem)
mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 (index)
return
end
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index].item
if item != nil
n = @data[index].amount
enabled = @is_loot ? true : enable?(item)
rect.width -= 4
y = rect.y + ((rect.height - WLH) / 2)
draw_item_name(item, rect.x, y, enabled)
self.contents.draw_text(rect, sprintf("#{Vocab::MA_AMOUNT_PREFIX}%2d", n), 2) unless n < 2
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_grfkl_lim_nvtry_item_8rn item
def item
return ma_grfkl_lim_nvtry_item_8rn if self.is_a? (Window_EquipItem)
return ma_grfkl_lim_nvtry_item_8rn == nil ? nil : ma_grfkl_lim_nvtry_item_8rn.item
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Sprite Disposal
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def dispose
super
@empty_sprites.each { |sprite| sprite.dispose } unless self.is_a? (Window_EquipItem)
end
end
#==============================================================================
# ** Window_EmptyCount
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This window displays the number of free slots in the inventory.
#==============================================================================
#==============================================================================
# ** Window_InvCommand
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This is a Window_Command, specialized to allow for frequent resetting of the
# commands
#==============================================================================
#==============================================================================
# ** Window Warning
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This window checks before destroying slot items
#==============================================================================
class Window_Warning < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
x = (Graphics.width - 256) / 2
y = (Graphics.height - (32 + 2*WLH)) / 2
super (x, y, 256, 32 + 2*WLH)
@item_max = 2
@column_max = 2
@index = 1
create_contents
# Draw Warning Label
self.contents.draw_text (0, 0, contents.width, WLH, Vocab::MA_WARNING_LABEL, 1)
# Draw Yes and No Options
index = 0
[Vocab::MA_WARNING_YES, Vocab::MA_WARNING_NO].each { |command|
rect = item_rect (index)
self.contents.draw_text (rect, command, 1)
index += 1
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get rectangle for displaying items
# index : item number
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (self.contents.width / 4) - 10
rect.height = WLH
rect.x = rect.width + (index*(20 + rect.width))
rect.y = WLH
return rect
end
end
#==============================================================================
# ** Scene Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - return_scene
#==============================================================================
class Scene_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Return Scene
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4 return_scene
def return_scene
if $game_temp.slots_to_discard.slots.empty?
rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4
else
$scene = Scene_Item.new
end
end
end
#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - battle_end
#==============================================================================
class Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * End Battle
# result : Results (0: win, 1: escape, 2:lose)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mrnagbr_gkal009_vntrylim_bttlend_5dm4 battle_end
def battle_end(result)
# Run original Method
mrnagbr_gkal009_vntrylim_bttlend_5dm4 (result)
if !$game_temp.slots_to_discard.slots.empty? && !$scene.is_a? (Scene_Gameover)
$scene = Scene_Item.new
end
end
end
#==============================================================================
# ** Scene Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - start, terminate
#==============================================================================
class Scene_Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def start
super
create_menu_background
@activated_frame = false
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@help_window = Window_Help.new
@help_window.width = Graphics.width
@help_window.viewport = @viewport
wlh = Window_Base::WLH
@item_window = Window_Item.new(0, 32 + wlh, Graphics.width, Graphics.height - 32 - wlh)
@item_window.help_window = @help_window
@item_window.active = false
@item_window.viewport = @viewport
@active_window = @item_window
@target_window = Window_MenuStatus.new(0, 0)
@target_window.x = Graphics.width - @target_window.width
@target_window.height = Graphics.height
@target_window.z = 150
hide_target_window
# Create Empty Counter
@emptycount_window = Window_EmptyCount.new
@emptycount_window.viewport = @viewport
# Create Loot Window
wdth = Graphics.width / 2
hght = Graphics.height - 64 - 2*wlh
@loot_window = Window_Item.new (wdth, 64 + (2*wlh), wdth, hght)
@loot_window.index = -1
@loot_window.viewport = @viewport
# Create Loot Label Window
@lootlabel_window = Window_Base.new (wdth, 32 + wlh, wdth, 32 + wlh)
@lootlabel_window.visible = false
@lootlabel_window.contents.font.color = @lootlabel_window.system_color
@lootlabel_window.contents.draw_text (0, 0, 240, wlh, Vocab::MA_LOOT_LABEL, 1)
@lootlabel_window.viewport = @viewport
commands = [Vocab::MA_COMMAND_USE, Vocab::MA_COMMAND_DISCARD]
@command_window = Window_InvCommand.new (160, commands)
@command_window.visible = false
@command_window.active = 0
@loot_window.active = false
# If no loot, hide the window
if $game_temp.slots_to_discard.slots.empty?
@loot_window.visible = false
@loot_window.refresh ($game_temp.slots_to_discard, 1)
@overloaded_initially = false
else
show_loot
@overloaded_initially = true
end
@last_index = $game_party.last_item_id
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Return Scene
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_grfk_inventoy_lmt_rtrnscn_1h45 return_scene
def return_scene
# If Still items left in Loot
if RPG::MA_WARN_WINDOW && !$game_temp.slots_to_discard.slots.empty?
# Give warning
@warning_window = Window_Warning.new
return
end
if @overloaded_initially
$scene = Scene_Map.new
else
# Run Original Method
malg_grfk_inventoy_lmt_rtrnscn_1h45
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Show Target Window
# right : Right justification flag (if false, left justification)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def show_target_window(right)
right = @loot_window.visible ? @active_window == @item_window : right
@item_window.active = false
width_remain = Graphics.width - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, @target_window.height)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, @target_window.height)
@viewport.ox = @target_window.width
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Hide Target Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def hide_target_window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, Graphics.width, Graphics.height)
@viewport.ox = 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Termination processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdlg_graf009_invlimit_trmnte_itemscene_5bd3 terminate
def terminate (*args)
# Run Original Method
mdlg_graf009_invlimit_trmnte_itemscene_5bd3 (*args)
# Dispose of new windows
@emptycount_window.dispose
@loot_window.dispose
@lootlabel_window.dispose
@command_window.dispose
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Frame
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_gfl009_limitedinventory_upt_2h45 update
def update
# If Warning Window Active
if @warning_window != nil
update_warning_window
return
end
malg_gfl009_limitedinventory_upt_2h45
@loot_window.update
@command_window.update
if @activated_frame
@activated_frame = false
return
end
if @loot_window.active
update_item_selection
elsif @command_window.active
update_command_selection
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Item Selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias moal_rfkl9_invntr_limit_upditmselect_1hr4 update_item_selection
def update_item_selection
@command_window.visible = false if @command_window.visible
# Switch between windows by pressing Left or Right
if @loot_window.visible && (Input.trigger? (Input::LEFT) || Input.trigger? (Input::RIGHT))
Sound.play_cursor
@active_window.index = -1
loot_window_active = @loot_window.active
@active_window.active = false
@active_window = loot_window_active ? @item_window : @loot_window
@active_window.active = true
@active_window.index = 0
@activated_frame = true
end
# IF ESC pressed
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
# If exchanging
if @loot_window.index > -1 && @item_window.active
slot = @active_window.ma_grfkl_lim_nvtry_item_8rn
slot2 = @loot_window.ma_grfkl_lim_nvtry_item_8rn
type, id, n = slot2.item_type, slot2.item_id, slot2.amount
if slot != nil
if !slot.item.ma_discardable? # Undiscardable Item
Sound.play_buzzer
return
else
type2, id2, n2 = slot.item_type, slot.item_id, slot.amount
$game_temp.slots_to_discard.add_item (type2, id2, n2)
$game_party.limit_inventory.remove_item (type2, id2, n2)
end
end
$game_party.limit_inventory.add_item (type, id, n)
$game_temp.slots_to_discard.remove_item (type, id, n)
RPG::SE.new (Sound::MA_EXCHANGE_SE).play
check_to_hide_loot
@loot_window.active = false
@loot_window.index = -1
else # If selecting
item = @active_window.item
if item != nil && (@loot_window.active || item.ma_discardable? || $game_party.item_can_use? (item))
Sound.play_decision
@active_window = @loot_window.active ? @loot_window : @item_window
start_command_window
else
Sound.play_buzzer
end
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_command_selection
removed_from_loot = false
if Input.trigger?(Input::B)
Sound.play_cancel
# Deactivate Command Window
@command_window.active = false
@command_window.index = -1
@command_window.visible = false
# Reactivat previous Window
@active_window.active = true
elsif Input.trigger?(Input::C)
if @active_window == @item_window
case @command_window.index
when 0 # Use
moal_rfkl9_invntr_limit_upditmselect_1hr4
@command_window.active = false if $game_party.item_can_use?(@item) && @item.scope != 0
when 1 # Discard
# Get slot
slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
unless slot.item.ma_discardable?
Sound.play_buzzer
return
end
type, id, n = slot.item_type, slot.item_id, slot.amount
# Discard additional slots
$game_party.limit_inventory.remove_item (type, id, n)
$game_temp.slots_to_discard.add_item (type, id, n)
# Deactivate Command Window
@command_window.active = false
@command_window.index = -1
@command_window.visible = false
# Reactivate previous Window
if @loot_window.visible
@item_window.refresh ($game_party.limit_inventory, 1)
@loot_window.refresh ($game_temp.slots_to_discard, 1)
else
show_loot
end
@item_window.active = true
RPG::SE.new (Sound::MA_DISCARD_SE).play
end
@emptycount_window.refresh ($game_party.limit_inventory)
else # Called from Loot Window
slot = @loot_window.ma_grfkl_lim_nvtry_item_8rn
# Get slot stats
type, id, n = slot.item_type, slot.item_id, slot.amount
case @command_window.index
when 0 # Take
# If inventory has empty spaces
if $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn)
# Remove from loot and add to Inventory
n2 = $game_party.limit_inventory.add_item (type, id, n)
$game_temp.slots_to_discard.remove_item (type, id, n - n2)
RPG::SE.new (Sound::MA_TAKE_SE).play
removed_from_loot = true
else
Sound.play_buzzer
end
when 1 # Exchange
# Deactivate Command Window
@command_window.visible = false
@command_window.active = false
# Activate Item Window
@item_window.active = true
@item_window.index = 0
@active_window = @item_window
Sound.play_decision
when 2 # Destroy
$game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*n)
$game_temp.slots_to_discard.remove_item (type, id, n)
RPG::SE.new (Sound::MA_DESTROY_SE).play
removed_from_loot = true
end
if removed_from_loot
@command_window.active = false
@command_window.visible = false
check_to_hide_loot
end
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Warning
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_warning_window
@warning_window.update
if Input.trigger? (Input::B)
# Play Cancel SE
Sound.play_cancel
# Dispose Warning
@warning_window.dispose
@warning_window = nil
elsif Input.trigger? (Input::C)
# Play Decision SE
Sound.play_decision
# When Yes
if @warning_window.index == 0
# End Scene
clear_loot_slots
return_scene
end
@warning_window.dispose
@warning_window = nil
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Use Item (apply effects to non-ally targets)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_grkl_liminv_ustmnntrgt_2hb4 use_item_nontarget
def use_item_nontarget
# Get last instance of this item in the inventory.
id = @item_window.index
while id == @item_window.index
@item_window.index += 1
id += 1 if @item == @item_window.item
end
@item_window.index -= 1
modalg_grkl_liminv_ustmnntrgt_2hb4
$game_party.last_item_id = @item_window.index
# Refresh Item Window if that slot is now empty
if @item_window.item == nil
@item_window.refresh
@emptycount_window.refresh ($game_party.limit_inventory)
hide_target_window
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Show Loot
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def show_loot
@loot_window.refresh ($game_temp.slots_to_discard, 1)
@loot_window.update
@loot_window.visible = true
@lootlabel_window.visible = true
@item_window.width = Graphics.width / 2
@item_window.refresh ($game_party.limit_inventory, 1)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check to Hide Loot
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def check_to_hide_loot
@loot_window.refresh ($game_temp.slots_to_discard, 1)
@emptycount_window.refresh ($game_party.limit_inventory)
# If there are no more items in loot
if $game_temp.slots_to_discard.slots.size == 0
# Hide Loot Window
@loot_window.visible = false
@loot_window.active = false
@loot_window.index = -1
@lootlabel_window.visible = false
@item_window.width = Graphics.width
@item_window.index = 0
@item_window.refresh ($game_party.limit_inventory, 2)
@item_window.active = true
@active_window = @item_window
else
@item_window.refresh ($game_party.limit_inventory, 1)
@loot_window.active = true
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Command Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def start_command_window
# Set command window based on which window it is called from
if @item_window.active
@command_window.reset_commands ([Vocab::MA_COMMAND_USE, Vocab::MA_COMMAND_DISCARD])
item = @item_window.item
@command_window.draw_item (0, false) unless $game_party.item_can_use? (item)
@command_window.draw_item (1, false) unless item.ma_discardable?
elsif @loot_window.active
cmnds = [Vocab::MA_COMMAND_TAKE, Vocab::MA_COMMAND_EXCHANGE, Vocab::MA_COMMAND_DESTROY]
@command_window.reset_commands (cmnds)
@command_window.draw_item (0, $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn))
end
rect = @active_window.item_rect (@active_window.index)
x = @active_window.x + 16 + rect.x
if x < (Graphics.width / 2)
x += rect.width
else
x -= @command_window.width
end
@command_window.x = x
# Get y coordinate
y = @active_window.y + 16 + rect.y - ((@command_window.height - rect.height) / 2)
y = (y + @command_window.height) > Graphics.height ? (Graphics.height - @command_window.height) : y
@command_window.y = y < @active_window.y ? @active_window.y : y
@command_window.index = 0
@command_window.visible = true
@command_window.active = true
# Deactivate last window
@active_window.active = false
@activated_frame = true
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear Loot Slots
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear_loot_slots
# Destroy all items in Loot
unless $game_temp.slots_to_discard.slots.empty?
# Update Party Hash and remove items
$game_temp.slots_to_discard.slots.each { |slot|
$game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*slot.amount)
}
RPG::SE.new (Sound::MA_DESTROY_SE).play
$game_temp.slots_to_discard.clear
end
end
end
56. Jaki jest dobry format do programu?
Najlepszy to "png". Staraj się nie używać formatu jpg. gdyż nie ma on tła wg programu.
57. Chcę stworzyć tutorial/poradnik na początku mojej gry. Jaki jest najprostszy sposób?
Użyj tego skryptu - przeniesie on twoich bohateów początkowo na inną mapę, a tam będziesz mógł przeprowadzić dla nich poradnik.
class Scene_Title < Scene_Base
def update
super
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_new_game
when 1
command_continue
when 2
command_tutorial
when 3
command_shutdown
end
end
end
Następnie wejdź w klasę Window_Base i znajdź dwukrotnie:
Kod:
if width < 120
i zmień na:
Kod:
if width < 120 && width != 0
Jeśli chcesz trochę przesunąć paski HP i MP to znajdź i zmień wartości:
Kod:
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a
59. Chcę usunąć opcję "wczytaj". Czy istnieje taki skrypt?
Tak! Ten skrypt zmienia komendy w menu - wypróbuj go.
Spoiler:
Kod:
class Scene_Title < Scene_Base
def update
super
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_new_game
when 1
command_shutdown
end
end
end
def create_command_window
s1 = Vocab::new_game
s2 = Vocab::shutdown
@command_window = Window_Command.new(172, [s1, s2])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = 288
@command_window.openness = 0
@command_window.open
end
end
17.Skończyła mi się licencja na program - co robić?
Masz dwa wyjścia - albo ściągniesz polską piracką wersję, albo kupisz oryginalną za 60 USD.
lub ściągnąć keygen generator
________________________ Lubię tu WSZYSTKICH!!!!!
Oprócz złych moderatorów dających bany za nic :)
szkoły.
-------------------------------------------------------
Ukończenie gry:0%
I się wszystko znowu zepsuło...co za...
==============================
A co do obrazka błędy celowe...naprawdę...
Ja osobiście zmieniłbym tytuł z FAQ (Frequently Asked Questions) na IRAQ (Intensively Repeated Annoying Questions), bardziej pasuje do obecnej sytuacji w dziale "pomoc" i można by odsyłać wszelkich idiotów do IRAQ (Iraku)
Spoiler:
Tak, pomysł wzięty z Basha
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum