Opis:
Ten skrypt pozwala nam na przechowywanie ekwipunku, przedmiotów, złota w depozycie. Może to być system banków w całej krainie, może to być magazyn w domu bohatera, albo skrzynia w każdym mieście.
Info:
Autor: Deriru
Tłumaczenie: Angius
Skrypt:
Spoiler:
Kod:
#===============================================================================
# Deriru's Simple Storage System v1.2
# by Deriru
#
# Co to robi?:
# - Tworzy system przechowywania, jak magazyn, czy skrzynia na skarby
#
# Jak użyć?:
# - Skonfiguruj skrypt jak chcesz
# - Wywołaj depozyt komendą:
# $scene = Scene_StorageSystem.new
# - By odblokować miejsca w depozycie użyj:
# $game_system.unlock_storages(X)
# Gdzie X jest ilością slotów do odblokowania.
# - By uniemożliwić przechowywanie jakiegoś przedmiotu użyj w jego notatkach
# tagu określonego w konfiguracji ujętego w [].
# Na przykład: [NoStore]
# - Aby użyć nazwy waluty wstaw #{gVocab} do komendy.
# Na przykład: Withdraw #{gVocab}
# Jeśli nazwą waluty będzie Yen, wyświetlało będzie: Withdraw Yen
# Wersje:
# v1.0:
# - Pierwsze wypuszczenie
#
# Creditsy:
# cmpsr2000 for his Shopoholic Script and the Storage_Slot class
#
# Dodaj mnie do credits, jeśli tego użyłeś. Enjoy!
#===============================================================================
$data_system = load_data("Data/System.rvdata")# NIE TYKAĆ!
gVocab = Vocab::gold # TEGO TEŻ NIE TYKAĆ!
#===============================================================================
# KONFIGURACJA
#===============================================================================
SlotsAmount = 30 #Maximum slotów w depozycie
InitialFree = 10 #Odblokowane sloty na początku gry
NonStorageTag = "NoStore" #Tag określający przedmiot nie do zdeponowania
DepositText = "Deposit Item" #Tekst w menu dla deponowania
WithdrawText = "Withdraw Item" #Tekst dla pobrania
GoldDepositText = "Deposit #{gVocab}" #Tekst dla zdeponowania złota
GoldWithdrawText = "Withdraw #{gVocab}" #Tekst dla pobrania złota
GoldInParty = "Gold in party: " #Ile złota ma drużyna
GoldInWarehouse = "Gold in storage: " #Ile złota jest w depozycie
EmptyText = "Empty" #Pusto
LockedText = "Locked" #Zablokowany
AmountText = "Amount:"#Ilość
MenuDepositHelp = "Deposit items." #Zdeponuj przedmioty
MenuWithdrawHelp = "Withdraw deposited items." #Pobierz przedmioty
StorageSelectHelp = "Select storage slot." #Wybierz slot depozytu
InventorySelectHelp = "Choose the item to be deposited." #Wybierz przedmiot do zdeponowania
AmountSelectHelp = "Left(-1), Right(+1), Up(+10), Down(-10)" #Ustalanie ilości
GoldDepositHelp = "Deposit #{gVocab}." #Zdeponuj (waluta)
GoldWithdrawHelp = "Withdraw #{gVocab}." #Pobierz (waluta)
GoldAmountHelp = "Insert amount of #{gVocab}." #Wprowadź ilość (waluta)
ExitHelp = "Exit warehouse." #Komenda wyjścia
#===============================================================================
# KONIEC KONFIGU [NIE TYKAJ PONIŻEJ JEŚLI NIE WIESZ CO ROBISZ!]
#===============================================================================
#===============================================================================
# ItemStorageSlot: Basic Item Slot for Storage System (thanks to cmpsr2000!)
#===============================================================================
class ItemStorageSlot
def takeItem(amt)
$game_party.gain_item(@item, amt)
@amount -= amt
if @amount <= 0
@item = nil
end
end
def lock
@locked = true
end
def unlock
@locked = false
end
end
#===============================================================================
# Game_System Modification: Adds the storage variables.
#===============================================================================
class Game_System
attr_accessor :storage
attr_accessor :stored_gold
alias :initialize_deriru initialize
def initialize
initialize_deriru
@stored_gold = Integer(0)
@storage = []
for i in 0..SlotsAmount - 1
@storage.push(ItemStorageSlot.new)
end
for i in 0..InitialFree - 1
@storage[i].unlock
end
end
def unlock_storages(max_amt)
for i in 0..max_amt - 1
$game_system.storage[i].unlock
end
end
def withdraw_money(amt)
$game_party.gain_gold(amt)
@stored_gold -= amt
@stored_gold = 9999999 if @stored_gold > 9999999
end
def store_money(amt)
$game_party.lose_gold(amt)
@stored_gold += amt
@stored_gold = 0 if @stored_gold < 0
end
end
#===============================================================================
# Window_Storage: For the Storage Window in the Storage Scene.
#===============================================================================
class Window_Storage < Window_Selectable
def refresh
@data = []
@data = $game_system.storage
@item_max = @data.size
create_contents
for i in 0..@item_max - 1
draw_storage(i)
end
end
def draw_storage(index)
slot = @data[index]
disabled = @data[index].locked
rect = item_rect(index)
self.contents.clear_rect(rect)
unless disabled
unless slot.item == nil
draw_item(index)
else
self.contents.font.color.alpha = 255
self.contents.draw_text(rect.x,rect.y,rect.width,WLH,EmptyText)
end
else
self.contents.font.color.alpha = 128
self.contents.draw_text(rect.x,rect.y,rect.width,WLH,LockedText)
end
end
def draw_item(index)
rect = item_rect(index)
slot = @data[index]
if slot != nil
number = $game_system.storage[index].amount
rect.width -= 4
draw_item_name(slot.item, rect.x, rect.y, true)
self.contents.font.size = 12
self.contents.draw_text(rect.x + 12,rect.y + 12, 15, 15, number, 1)
self.contents.font.size = 20
rect.width += 4
end
end
end
#===============================================================================
# Window_ItemForStage: For the Item Window in the Storage Scene.
#===============================================================================
class Window_ItemForStorage < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 2
self.index = 0
refresh
end
def item
return @data[self.index]
end
def include?(item)
return false if item == nil
return true
end
def enable?(item)
return false if item.note.include?("[#{NonStorageTag}]")
return true
end
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.font.size = 12
self.contents.draw_text(rect.x + 12,rect.y + 12, 15, 15, number, 1)
self.contents.font.size = 20
end
end
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
#===============================================================================
# Window_ItemNumInput: Item Number Input Window
#===============================================================================
class Window_ItemNumInput < Window_Base
def set_max(number)
@maxQn = number
@maxQn = 99 if @maxQn > 99
@maxQn = 1 if @maxQn < 1
@qn = 1
end
def update
refresh
if Input.repeat?(Input::UP)
Sound.play_cursor
@qn += 10
@qn = @maxQn if @qn > @maxQn
elsif Input.repeat?(Input::DOWN)
Sound.play_cursor
@qn -= 10
@qn = 0 if @qn < 0
elsif Input.repeat?(Input::LEFT)
Sound.play_cursor
@qn -= 1
@qn = 0 if @qn < 0
elsif Input.repeat?(Input::RIGHT)
Sound.play_cursor
@qn += 1
@qn = @maxQn if @qn > @maxQn
end
end
end
#===============================================================================
# Window_HelpStorage: A modified version of Window_Help
#===============================================================================
class Window_HelpStorage < Window_Base
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
end
#===============================================================================
# Window_GoldAmt: Inputs the amount of gold
#===============================================================================
class Window_GoldAmt < Window_Command
end
#===============================================================================
# Scene_StorageSystem: The Storage System Scene itself! xD
#===============================================================================
class Scene_StorageSystem < Scene_Base
def storage_menu_input
@storage_menu.update
if Input.trigger?(Input::C)
if @storage_menu.index == 0 or @storage_menu.index == 1
Sound.play_decision
@storage_menu.active = false
@storage_slots.active = true
elsif @storage_menu.index == 2 or @storage_menu.index == 3
Sound.play_decision
@gold_opp.refresh(@storage_menu.index)
@gold_opp.visible = true
@gold_amt.visible = true
elsif @storage_menu.index == 4
Sound.play_cancel
$scene = Scene_Map.new
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
end
end
def storage_slots_input
@storage_slots.update
if Input.trigger?(Input::C)
if $game_system.storage[@storage_slots.index].locked
Sound.play_buzzer
elsif @storage_menu.index == 1
unless $game_system.storage[@storage_slots.index].item == nil
# CRAPPY CALCULATION STARTZ! AAAAGH!
in_stock = $game_party.item_number($game_system.storage[@storage_slots.index].item)
item_possible = (in_stock + $game_system.storage[@storage_slots.index].amount)
if item_possible > 99
item_possible -= 99
elsif item_possible = 99
item_possible = $game_system.storage[@storage_slots.index].amount
else
item_possible = 99 - item_possible
end
# CRAPPY CALCULATION ENDZ! HURRAH!
if in_stock < 99
@num_input.set_max(item_possible)
@num_input.visible = true
@storage_slots.active = false
else
Sound.play_buzzer
end
else
Sound.play_buzzer
end
elsif @storage_menu.index == 0
if $game_system.storage[@storage_slots.index].item == nil
Sound.play_decision
switch_store_inv(false,true)
else
Sound.play_buzzer
end
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
@storage_slots.active = false
@storage_menu.active = true
end
end
def current_inv_input
@current_inv.update
if Input.trigger?(Input::C)
if $game_system.storage[@storage_slots.index].item == nil && @current_inv.item != nil && !@current_inv.item.note.include?("[#{NonStorageTag}]")
@current_inv.active = false
@num_input.visible = true
@num_input.set_max($game_party.item_number(@current_inv.item))
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
switch_store_inv(true,false)
end
end
def num_input_input
@num_input.update
if Input.trigger?(Input::C)
if @storage_menu.index == 0
$game_system.storage[@storage_slots.index].storeItem(@current_inv.item,@num_input.qn)
elsif @storage_menu.index == 1
$game_system.storage[@storage_slots.index].takeItem(@num_input.qn)
end
switch_store_inv(true,false)
@storage_slots.index = 0
@storage_slots.refresh
@current_inv.refresh
@num_input.visible = false
elsif Input.trigger?(Input::B)
if @storage_menu.index == 0
@current_inv.active = true
elsif @storage_menu.index == 1
@storage_slots.active = true
end
@num_input.visible = false
end
end
def help_update
if @gold_amt.visible
@storage_help.set_text(GoldAmountHelp)
elsif @num_input.visible
@storage_help.set_text(AmountSelectHelp)
elsif @current_inv.active
@storage_help.set_text(InventorySelectHelp)
elsif @storage_slots.active
@storage_help.set_text(StorageSelectHelp)
elsif @storage_menu.active
case @storage_menu.index
when 0
@storage_help.set_text(MenuDepositHelp)
when 1
@storage_help.set_text(MenuWithdrawHelp)
when 2
@storage_help.set_text(GoldDepositHelp)
when 3
@storage_help.set_text(GoldWithdrawHelp)
when 4
@storage_help.set_text(ExitHelp)
end
end
end
def gold_amt_update
@gold_amt.update
@gold_opp.update
if Input.trigger?(Input::C)
money_inp = @gold_amt.commands.to_s.to_i
if @storage_menu.index == 2
unless money_inp + $game_system.stored_gold.to_i > 9999999 and money_inp < $game_party.gold
if money_inp <= $game_party.gold
Sound.play_decision
$game_system.store_money(money_inp)
@gold_amt.reset
@gold_amt.visible = false
@gold_opp.refresh(@storage_menu.index)
@gold_opp.visible = false
@storage_menu.active = true
else
Sound.play_buzzer
end
else
Sound.play_buzzer
end
elsif @storage_menu.index == 3
unless money_inp + $game_party.gold > 9999999
if money_inp <= $game_system.stored_gold
Sound.play_decision
$game_system.withdraw_money(money_inp)
@gold_amt.reset
@gold_amt.visible = false
@gold_opp.refresh(@storage_menu.index)
@gold_opp.visible = false
@storage_menu.active = true
else
Sound.play_buzzer
end
else
Sound.play_buzzer
end
end
elsif Input.trigger?(Input::B)
Sound.play_decision
@gold_amt.reset
@gold_amt.visible = false
@gold_opp.refresh(@storage_menu.index)
@gold_opp.visible = false
@storage_menu.active = true
end
end
end
Skriny:
Spoiler:
Demo:
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."
Światło na świece itp.
Regeneracja HP i MP co poziom
(chyba) pkt co poziom
Szybsza gra po przez F5
(chyba) pauza w grze
Podświetlenie przeciwnika podczas walki
Scene Shop ReDux
Cień pod zdarzeniami
Folder z saves
GameOver Menu by Moon$
HUD Hp, MP, EXP
Napisy Końcowe
Dnie i Noce
Mapa Świata FF XII
I chyba tyle. Jestem teraz na laptopie, więc trudno mi zobaczyć, ale wszystko z pendrive brałem, więc to tyle co dodałem do projektu.
@Edit Sory, ale jednak teraz sobie przypomniałem, że systemu zapisu i wczytywania nie mam. Usunąłem go.
@Edit2 Aha xD Mam jeszcze Mape świata z FF XII oraz Dnie i Noce dodałem je go listy.
Ok to, jak tylko wejdę na drugiego kompa to usunę. Jak coś, jeżeli będę miał błąd to napiszę. Jak na razie wielkie dzięki za pomoc :)
@Edit Jednak nie miałem skryptu z Shop Scene. Tutaj zamieszczam wszystkie moje skrypty, jakie posiadam. Może dasz radę mi pomóc.
Podświetlenie przeciwników podczas walki
Avatary Podczas walki
Bestsariusz
Item dodający HP i MP
HP/MP Przeciwników poprawione przez Ozzma
Ikona złotej monety w Menu
Folder Zapisu Gry
Napisy Końcowe
Cienie pod zdarzeniami
GameOver Menu
HUD HP, MP, EXP
Regeneracja HP i MP co poziom
Skrypt z klawiszami (chyba Input skrypt by Vlad)
Dni i Noce
Thomas Edison VX
Szybsza gra poprzez klawisz F5
Mapa Świata FF XII
No i ten depozyt
@pw1602, Obecnie nie widze nic, co mogłoby się żreć. Jednak jeśli na czystym problem nie występuje, to spróbuj po kolei wyłączać te skrypty (ctrl+X, ctrl+V) i po usunięciu któregoś zacznie działać. Napisz wtedy, który to, postaramy się je jakoś z sobą pogodzić :)
________________________
"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