'Item Storage' script umschreiben
Hi,
ich hatte vor den 'Item Storage' script zu verwenden, er hat jedoch 'ne Funktion die sehr hinderlich wär.
...und zwar geht es um die Option "Ablegen", wenn mir das jemand rauslöschen könnte wär ich sehr dankbar.
Code is hier:
Ich hoffe auf 'ne Antwort von euch, dankeschön!
Gits
ich hatte vor den 'Item Storage' script zu verwenden, er hat jedoch 'ne Funktion die sehr hinderlich wär.
...und zwar geht es um die Option "Ablegen", wenn mir das jemand rauslöschen könnte wär ich sehr dankbar.
Code is hier:
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
#===============================================================================
# Item Storage
# Author game_guy
# Version 1.2
#-------------------------------------------------------------------------------
# Intro:
# Okay. Well if you've played the Elder Scrolls Series or Fallout then you'd
# know that it has an item storage system. What it does is lets you open up
# closets, chests, ect and store and take items out of it.
#
# Features:
# Store and Take Items Out of Chests, Closets, ect
# Have Seperate Chests, Closets, ect
# Easy to Use
# Stores Chests into Game System Instead of Variables
# Have Max Amount of Items In Chest
# Set Default Items in Chest
#
# Instructions:
# First lets go over the syntaxes.
#
# Calling the Item Storage:
# $scene = Scene_Chest.new(chest_id, max_items)
# chest_id is the number chest you want open
# max_items is the max amount of any item the chest can hold
# you can just use this to
# $scene = Scene_Chest.new(chest_id)
# because in the config this ChestMaxItems is the default so if you dont use
# the long one, it'll use the default.
#
# Adding/Removing Items from Chest:
# This feature is still being worked on. But what it will allow you to do
# is add an item or remove it whithout actually opening the chest.
#
# Okay so thats done with the syntaxes. Now onto the configuration.
# Go down to Begin Config and do all your configuration there.
#
# Credits:
# game_guy ~ for making it
# MightyLink ~ requesting the system
#===============================================================================
module GameGuy
#============================================================================
# ChestMaxItems = The max amount of any item a chest can hold. So example
# Its 9999 so it can have 9999 of any item.
#============================================================================
ChestMaxItems = 9999
def self.chest_items(id)
case id
#==========================================================================
# Config Chest Items
# Use this
# when chest_id then return [[id, amount, type], [id, amount, type]]
# id = item, weapon, or armor id
# amount = the amount
# type = 0, 1, or 2 0 = item, 1 = weapon, 2 = armor
# Example:
# when 1 then return [[1, 3, 0], [1, 1, 1]]
# This has 3 potions, and 1 bronze sword. So when this is called
# $scene = Scene_Chest.new(1)
# it will have those items in the chest already.
#==========================================================================
when 1 then return [[1, 999, 0], [1, 1, 1]]
when 2 then return [[1, 10, 0], [1, 1, 2], [1, 2, 1]]
when 3 then return [[1, 10, 2], [3, 1, 1], [9, 1, 1]]
end
return []
end
end
#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Modded it so it makes it store every chest.
#==============================================================================
class Game_System
attr_accessor :chests
alias gg_add_item_storage initialize
def initialize
@chests = []
return gg_add_item_storage
end
def add_chest(chest)
@chests[chest] = $chest
end
end
#==============================================================================
# Game_Chest
#------------------------------------------------------------------------------
# Holds all the data for a single chest.
#==============================================================================
class Game_Chest
attr_accessor :max
def initialize(max)
@max = max
@items = {}
@weapons = {}
@armors = {}
end
def item_amount(item_id)
return @items.include?(item_id) ? @items[item_id] : 0
end
def weapon_amount(weapon_id)
return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
end
def armor_amount(armor_id)
return @armors.include?(armor_id) ? @armors[armor_id] : 0
end
def add_item(item_id, n)
if item_id > 0
@items[item_id] = [[item_amount(item_id) + n, 0].max, @max].min
end
end
def add_weapon(weapon_id, n)
if weapon_id > 0
@weapons[weapon_id] = [[weapon_amount(weapon_id) + n, 0].max, @max].min
end
end
def add_armor(armor_id, n)
if armor_id > 0
@armors[armor_id] = [[armor_amount(armor_id) + n, 0].max, @max].min
end
end
def take_item(item_id, n)
add_item(item_id, -n)
end
def take_weapon(weapon_id, n)
add_weapon(weapon_id, -n)
end
def take_armor(armor_id, n)
add_armor(armor_id, -n)
end
end
#==============================================================================
# Window_Chest_Choices
#------------------------------------------------------------------------------
# The choices for the chest when the scene is opened.
#==============================================================================
class Window_Chest_Choices < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["Ablegen", "Aufnehmen", "Fertig"]
self.z = 200
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
x = 4 + index * 215
self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
end
end
#==============================================================================
# Window_Chest_Item
#------------------------------------------------------------------------------
# Displays all items in the chest.
#==============================================================================
class Window_Chest_Item < Window_Selectable
def initialize
super(320, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $chest.item_amount(i) > 0
@data.push($data_items[i])
end
end
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $chest.weapon_amount(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $chest.armor_amount(i) > 0
@data.push($data_armors[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $chest.item_amount(item.id)
when RPG::Weapon
number = $chest.weapon_amount(item.id)
when RPG::Armor
number = $chest.armor_amount(item.id)
end
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Window_Party_Item
#------------------------------------------------------------------------------
# Displays all items the party has.
#==============================================================================
class Window_Party_Item < Window_Selectable
def initialize
super(0, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Scene_Chest
#------------------------------------------------------------------------------
# The scene that controls storing and taking items.
#==============================================================================
class Scene_Chest
def initialize(chest=1, max=GameGuy::ChestMaxItems)
@chestid = chest
if $game_system.chests[chest] == nil
$chest = Game_Chest.new(max)
items = GameGuy.chest_items(chest)
for i in 0...items.size
item = items[i][2]
case item
when 0
$chest.add_item(items[i][0], items[i][1])
when 1
$chest.add_weapon(items[i][0], items[i][1])
when 2
$chest.add_armor(items[i][0], items[i][1])
else
$chest.add_item(items[i][0], items[i][1])
end
end
else
$chest = $game_system.chests[chest]
end
end
def main
@help_window = Window_Help.new
@help_window.visible = false
@command_window = Window_Chest_Choices.new
@party_window = Window_Party_Item.new
@party_window.active = false
@chest_window = Window_Chest_Item.new
@chest_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@help_window.dispose
@command_window.dispose
@party_window.dispose
@chest_window.dispose
end
def update
@help_window.update
@command_window.update
@party_window.update
@chest_window.update
if @command_window.active
update_command
return
end
if @party_window.active
update_party
return
end
if @chest_window.active
update_chest
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$game_system.add_chest(@chestid)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@party_window.active = true
@party_window.help_window = @help_window
@command_window.active = false
@help_window.z = 500
@help_window.visible = true
when 1
$game_system.se_play($data_system.decision_se)
@chest_window.active = true
@chest_window.help_window = @help_window
@command_window.active = false
@help_window.z = 500
@help_window.visible = true
when 2
$game_system.se_play($data_system.cancel_se)
$game_system.add_chest(@chestid)
$scene = Scene_Map.new
end
return
end
end
def update_party
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@help_window.visible = false
@party_window.help_window = nil
@party_window.active = false
return
end
if Input.repeat?(Input::C)
@item = @party_window.item
unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
@item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
return
end
case @item
when RPG::Item
amount = $chest.item_amount(@item.id)
if amount < $chest.max
$game_system.se_play($data_system.decision_se)
$chest.add_item(@item.id, 1)
$game_party.lose_item(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Weapon
amount = $chest.weapon_amount(@item.id)
if amount < $chest.max
$game_system.se_play($data_system.decision_se)
$chest.add_weapon(@item.id, 1)
$game_party.lose_weapon(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Armor
amount = $chest.armor_amount(@item.id)
if amount < $chest.max
$game_system.se_play($data_system.decision_se)
$chest.add_armor(@item.id, 1)
$game_party.lose_armor(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
@party_window.refresh
@chest_window.refresh
return
end
end
def update_chest
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@help_window.visible = false
@chest_window.help_window = nil
@chest_window.active = false
return
end
if Input.repeat?(Input::C)
@item = @chest_window.item
unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
@item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
return
end
case @item
when RPG::Item
amount = $game_party.item_number(@item.id)
if amount < 99
$game_system.se_play($data_system.decision_se)
$chest.take_item(@item.id, 1)
$game_party.gain_item(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Weapon
amount = $game_party.weapon_number(@item.id)
if amount < 99
$game_system.se_play($data_system.decision_se)
$chest.take_weapon(@item.id, 1)
$game_party.gain_weapon(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Armor
amount = $game_party.armor_number(@item.id)
if amount < 99
$game_system.se_play($data_system.decision_se)
$chest.take_armor(@item.id, 1)
$game_party.gain_armor(@item.id, 1)
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
@party_window.refresh
@chest_window.refresh
return
end
end
end |
zum Lesen den Text mit der Maus markieren
Ich hoffe auf 'ne Antwort von euch, dankeschön!
Gits
...und so
Probier mal dieses veränderte Script aus.
Script:
MFG
Script:
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
#=============================================================================== # Item Storage # Author game_guy # Version 1.2 #------------------------------------------------------------------------------- # Intro: # Okay. Well if you've played the Elder Scrolls Series or Fallout then you'd # know that it has an item storage system. What it does is lets you open up # closets, chests, ect and store and take items out of it. # # Features: # Store and Take Items Out of Chests, Closets, ect # Have Seperate Chests, Closets, ect # Easy to Use # Stores Chests into Game System Instead of Variables # Have Max Amount of Items In Chest # Set Default Items in Chest # # Instructions: # First lets go over the syntaxes. # # Calling the Item Storage: # $scene = Scene_Chest.new(chest_id, max_items) # chest_id is the number chest you want open # max_items is the max amount of any item the chest can hold # you can just use this to # $scene = Scene_Chest.new(chest_id) # because in the config this ChestMaxItems is the default so if you dont use # the long one, it'll use the default. # # Adding/Removing Items from Chest: # This feature is still being worked on. But what it will allow you to do # is add an item or remove it whithout actually opening the chest. # # Okay so thats done with the syntaxes. Now onto the configuration. # Go down to Begin Config and do all your configuration there. # # Credits: # game_guy ~ for making it # MightyLink ~ requesting the system #=============================================================================== module GameGuy #============================================================================ # ChestMaxItems = The max amount of any item a chest can hold. So example # Its 9999 so it can have 9999 of any item. #============================================================================ ChestMaxItems = 9999 def self.chest_items(id) case id #========================================================================== # Config Chest Items # Use this # when chest_id then return [[id, amount, type], [id, amount, type]] # id = item, weapon, or armor id # amount = the amount # type = 0, 1, or 2 0 = item, 1 = weapon, 2 = armor # Example: # when 1 then return [[1, 3, 0], [1, 1, 1]] # This has 3 potions, and 1 bronze sword. So when this is called # $scene = Scene_Chest.new(1) # it will have those items in the chest already. #========================================================================== when 1 then return [[1, 999, 0], [1, 1, 1]] when 2 then return [[1, 10, 0], [1, 1, 2], [1, 2, 1]] when 3 then return [[1, 10, 2], [3, 1, 1], [9, 1, 1]] end return [] end end #============================================================================== # Game_System #------------------------------------------------------------------------------ # Modded it so it makes it store every chest. #============================================================================== class Game_System attr_accessor :chests alias gg_add_item_storage initialize def initialize @chests = [] return gg_add_item_storage end def add_chest(chest) @chests[chest] = $chest end end #============================================================================== # Game_Chest #------------------------------------------------------------------------------ # Holds all the data for a single chest. #============================================================================== class Game_Chest attr_accessor :max def initialize(max) @max = max @items = {} @weapons = {} @armors = {} end def item_amount(item_id) return @items.include?(item_id) ? @items[item_id] : 0 end def weapon_amount(weapon_id) return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0 end def armor_amount(armor_id) return @armors.include?(armor_id) ? @armors[armor_id] : 0 end def add_item(item_id, n) if item_id > 0 @items[item_id] = [[item_amount(item_id) + n, 0].max, @max].min end end def add_weapon(weapon_id, n) if weapon_id > 0 @weapons[weapon_id] = [[weapon_amount(weapon_id) + n, 0].max, @max].min end end def add_armor(armor_id, n) if armor_id > 0 @armors[armor_id] = [[armor_amount(armor_id) + n, 0].max, @max].min end end def take_item(item_id, n) add_item(item_id, -n) end def take_weapon(weapon_id, n) add_weapon(weapon_id, -n) end def take_armor(armor_id, n) add_armor(armor_id, -n) end end #============================================================================== # Window_Chest_Choices #------------------------------------------------------------------------------ # The choices for the chest when the scene is opened. #============================================================================== class Window_Chest_Choices < Window_Selectable def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 2 @column_max = 3 @commands = ["Aufnehmen", "Fertig"] self.z = 200 refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end def draw_item(index) x = 4 + index * 215 self.contents.draw_text(x, 0, 128, 32, @commands[index], 1) end end #============================================================================== # Window_Chest_Item #------------------------------------------------------------------------------ # Displays all items in the chest. #============================================================================== class Window_Chest_Item < Window_Selectable def initialize super(320, 64, 320, 416) @column_max = 1 refresh self.index = 0 if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end def item return @data[self.index] end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 1...$data_items.size if $chest.item_amount(i) > 0 @data.push($data_items[i]) end end unless $game_temp.in_battle for i in 1...$data_weapons.size if $chest.weapon_amount(i) > 0 @data.push($data_weapons[i]) end end for i in 1...$data_armors.size if $chest.armor_amount(i) > 0 @data.push($data_armors[i]) end end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] case item when RPG::Item number = $chest.item_amount(item.id) when RPG::Weapon number = $chest.weapon_amount(item.id) when RPG::Armor number = $chest.armor_amount(item.id) end x = 4 + index % @column_max * (288 + 32) y = index / @column_max * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 216, y, 16, 32, ":", 1) self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================================== # Window_Party_Item #------------------------------------------------------------------------------ # Displays all items the party has. #============================================================================== class Window_Party_Item < Window_Selectable def initialize super(0, 64, 320, 416) @column_max = 1 refresh self.index = 0 if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end def item return @data[self.index] end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end unless $game_temp.in_battle for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end x = 4 + index % @column_max * (288 + 32) y = index / @column_max * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 216, y, 16, 32, ":", 1) self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================================== # Scene_Chest #------------------------------------------------------------------------------ # The scene that controls storing and taking items. #============================================================================== class Scene_Chest def initialize(chest=1, max=GameGuy::ChestMaxItems) @chestid = chest if $game_system.chests[chest] == nil $chest = Game_Chest.new(max) items = GameGuy.chest_items(chest) for i in 0...items.size item = items[i][2] case item when 0 $chest.add_weapon(items[i][0], items[i][1]) when 1 $chest.add_armor(items[i][0], items[i][1]) else $chest.add_item(items[i][0], items[i][1]) end end else $chest = $game_system.chests[chest] end end def main @help_window = Window_Help.new @help_window.visible = false @command_window = Window_Chest_Choices.new @party_window = Window_Party_Item.new @party_window.active = false @chest_window = Window_Chest_Item.new @chest_window.active = false Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end @help_window.dispose @command_window.dispose @party_window.dispose @chest_window.dispose end def update @help_window.update @command_window.update @party_window.update @chest_window.update if @command_window.active update_command return end if @party_window.active update_party return end if @chest_window.active update_chest return end end def update_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $game_system.add_chest(@chestid) $scene = Scene_Map.new return end if Input.trigger?(Input::C) case @command_window.index when 0 $game_system.se_play($data_system.decision_se) @chest_window.active = true @chest_window.help_window = @help_window @command_window.active = false @help_window.z = 500 @help_window.visible = true when 1 $game_system.se_play($data_system.cancel_se) $game_system.add_chest(@chestid) $scene = Scene_Map.new end return end end def update_party if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @help_window.visible = false @party_window.help_window = nil @party_window.active = false return end if Input.repeat?(Input::C) @item = @party_window.item unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor) $game_system.se_play($data_system.buzzer_se) return end case @item when RPG::Item amount = $chest.item_amount(@item.id) if amount < $chest.max $game_system.se_play($data_system.decision_se) $chest.add_item(@item.id, 1) $game_party.lose_item(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end when RPG::Weapon amount = $chest.weapon_amount(@item.id) if amount < $chest.max $game_system.se_play($data_system.decision_se) $chest.add_weapon(@item.id, 1) $game_party.lose_weapon(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end when RPG::Armor amount = $chest.armor_amount(@item.id) if amount < $chest.max $game_system.se_play($data_system.decision_se) $chest.add_armor(@item.id, 1) $game_party.lose_armor(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end end @party_window.refresh @chest_window.refresh return end end def update_chest if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @help_window.visible = false @chest_window.help_window = nil @chest_window.active = false return end if Input.repeat?(Input::C) @item = @chest_window.item unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor) $game_system.se_play($data_system.buzzer_se) return end case @item when RPG::Item amount = $game_party.item_number(@item.id) if amount < 99 $game_system.se_play($data_system.decision_se) $chest.take_item(@item.id, 1) $game_party.gain_item(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end when RPG::Weapon amount = $game_party.weapon_number(@item.id) if amount < 99 $game_system.se_play($data_system.decision_se) $chest.take_weapon(@item.id, 1) $game_party.gain_weapon(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end when RPG::Armor amount = $game_party.armor_number(@item.id) if amount < 99 $game_system.se_play($data_system.decision_se) $chest.take_armor(@item.id, 1) $game_party.gain_armor(@item.id, 1) else $game_system.se_play($data_system.buzzer_se) return end end @party_window.refresh @chest_window.refresh return end end end |
zum Lesen den Text mit der Maus markieren
MFG
Realität ist auch nur eine Art von Rollenspiel.
Ähnliche Themen
-
Taverne zum philosophischen Phönix »-
Die User Gallerie
(18. Februar 2005, 16:07)
-
Skript-Anfragen »-
Tag-Nacht Script von German D ohne Tag, Woche, Monat, Jahr umschreiben
(18. Januar 2010, 19:37)
-
RGSS 1 Probleme & Talk »-
VX Script für XP umschreiben
(8. Juni 2009, 16:14)
