• Anmelden

1

Samstag, 4. April 2009, 01:41

max Slots in der Tasche - Script?

Spoiler
Ich wollte mal fragen ob es ein Script gibt, oder ob man eins machen kann, mit dem man festlegen kann wieviele Slots die Tasche hat? also max anzahl verschiedener Gegenstände.
wäre echt nett, damit man den Spieler zum nachdenken bringt welche Gegenstände er nu in nen Dungeon mit nimmt und welche nicht ^^.

schonma danke im voraus!
zum Lesen den Text mit der Maus markieren


edit:Lösung: Script ohne abbrechmöglichkeit im Wahlbildschirm
Spoiler

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
#==============================================================================
# Item Entfernen Window Skript 
# von Hüpfende Kokosnuss, 5.4.2009, rpg-studio.de
#------------------------------------------------------------------------------
# "Item_Entfernen.new" als Scriptbefehl ruft ein Window auf, mit dem der Spieler 
# Items aus dem Inventar entfernen kann. Diese sind dann gelöscht.
#==============================================================================
class Game_Party
  attr_reader :items
end
class Item_Entfernen
  def initialize
	return if $game_party.items.size == 0
	# Make help window, item window
	@help_window = Window_Help.new
	@item_window = Window_Item.new
	# Associate help window
	@item_window.help_window = @help_window
	# Main loop
	loop do
  	# Update game screen
  	Graphics.update
  	# Update input information
  	Input.update
  	# Update windows
  	@help_window.update
  	@item_window.update
  	# If item window is active: call update_item
  	if @item_window.active
    	# If C button was pressed
    	if Input.trigger?(Input::C)
      	# Get currently selected data on the item window
      	@item = @item_window.item
      	# If not a use item
      	if @item.is_a?(RPG::Item)
        	unless @item.consumable
        	$game_system.se_play($data_system.buzzer_se)
        	else
          	# Play decision SE
          	$game_system.se_play($data_system.decision_se)
          	$game_party.lose_item(@item.id, 1)
          	@item_window.draw_item(@item_window.index)
          	$game_system.se_play($data_system.cancel_se)
        	break
        	end
      	elsif @item.is_a?(RPG::Weapon)
        	# Play decision SE
        	$game_system.se_play($data_system.decision_se)
        	$game_party.lose_weapon(@item.id, 1)
        	@item_window.draw_item(@item_window.index)
      	elsif @item.is_a?(RPG::Armor)
        	# Play decision SE
        	$game_system.se_play($data_system.decision_se)
        	$game_party.lose_armor(@item.id, 1)
        	@item_window.draw_item(@item_window.index)
      	end
    	end
  	end
	end
	# Dispose of windows
	@help_window.dispose
	@item_window.dispose
  end
end
zum Lesen den Text mit der Maus markieren

Script über Main einfügen.
Füg noch das SKript hier ein (irgendwo im Skripteditor, nur nicht unter Main):

Ruby Quellcode

1
2
3
4
5
class Game_Party
attr_accessor :items
attr_accessor :weapons
attr_accessor :armors
end


und das Event sieht so aus
Spoiler
Bild
zum Lesen den Text mit der Maus markieren

Original Script von Hüpfende Kokosnuss (weiter unten im thread)

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Beni« (5. April 2009, 20:05)


2

Samstag, 4. April 2009, 22:42

Ne aber kannst du selber per Events machen ^^
Die anzahl der Items der Party bekommst du über
$game_party.items.size
...

Abfragen in einem Conditional Branch (dort Seite 4, "Script" anwählen):
Conditional Branch: Script
($game_party.items.size >= 20)
Message ausgeben: "Du kannst das Item nicht erhalten!"
else
Message ausgeben: "Item erhalten!"
end

Das war jetzt Pseodo-Eventcode ^^
Ein richtiges Skript wird es dafür eh nicht geben, du musst sowieso jedes mal wenn die Party ein Item bekommt manuell ne Nachricht ausgeben, falls das Inventar voll ist, sonst wäre das Skript ja nicht variabel.

3

Samstag, 4. April 2009, 23:36

es hätt mir fast geholfen, aber da kommt ein error

Spoiler
undefinied method for `items' for #<Game_Party:x.....>
zum Lesen den Text mit der Maus markieren

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

4

Sonntag, 5. April 2009, 10:37

Füg noch das SKript hier ein (irgendwo im Skripteditor, nur nicht unter Main):

Ruby Quellcode

1
2
3
4
5
class Game_Party
attr_accessor :items
attr_accessor :weapons
attr_accessor :armors
end
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

5

Sonntag, 5. April 2009, 13:35

ui es funktioniert ohne error :3
gibts denn auch noch eine Möglichkeit abzufragen ob man ein Item wegwerfen möchte wenn das Inventar voll ist und das wenn kein Item wegeworfen wird, dann das Item in der Truhe einfach verschwindet so alà Grandia?

sonst wird die message geloopt wenn ich das event auf parallel prozess habe :/

Ich könnt solange abfragen lassen ob der Koffer - Itemkiste - geöffnet werden soll bis der spieler das macht, aber das wäre auf Dauer nicht der Sinn davon, dass der Spieler stets provozieren kann, den Koffer in den er Items ablegen kann und wieder rausholen kann zu öffnen.

wenns die Möglichkeit nicht gibt, ist das Thema auch gelöst :rolleyes:

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

6

Sonntag, 5. April 2009, 13:38

Pseudo-Eventcode :D

Nachricht: O_O Awesome. Du hast eine Kiste gefunden.
In ihr ist... Ein schimmliges Brot!
Bedingung $game_party.items < 20
Nachricht: Katsching, Gammelbrot erhalten!
Ein Gammelbrot zum Inventar oacken
else
Nachricht: Oh noes. Du hast keinen Platz mehr D:
end
Self Switch A: ON
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

7

Sonntag, 5. April 2009, 14:29

Das klingt schon logisch, aber kann man net abfragen ob man ein Item wegwerfen will bevor das in der Truhe ganz verschwindet :/?
so ähnlich wie im Itemkiste script?
Spoiler
Bild
zum Lesen den Text mit der Maus markieren

eben nur mit den Optionen "wegwerfen" und "liegen lassen" ?
ich denke mal man könnte das aus dem Script rausholen was man davon braucht, aber leider kann ich keine Scripte lesen, da ich bis jetzt kaum großartig damit in Berührung gekommen bin.

hier das script von thunderbolt256 falls interesse besteht das da rauszuholn @_@
Spoiler

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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
#==============================================================================
#
#                             	Itemkiste
#
#==============================================================================
#                                               	scripted by thunderbolt256
#------------------------------------------------------------------------------
#
class Scene_Box
  #--------------------------------------------------------------------------
  def main
	@info_window = Window_Help.new
	@help_window = Window_Help.new
	@help_window.y = @info_window.height
	@item_window = Window_Box.new(0)
	@item_window.active = false
	@item_window.y = @help_window.y + @help_window.height
	@item_window.height = 480 - @item_window.y - @help_window.height
	@box_window = Window_Box.new(1)
	@box_window.active = false
	@box_window.visible = false
	@box_window.y = @item_window.y
	@box_window.height = @item_window.height
	@item_window.refresh
	@box_window.refresh
	@ort_window = Window_Help.new
	@ort_window.x = @item_window.x
	@ort_window.y = @item_window.y + @item_window.height
	@ort_window.width = @item_window.width
	@ort_window.height = 480 - @ort_window.y
	@ort_window.bitmap_adapt
	s1 = "Ablegen"
	s2 = "Aufnehmen"
	s3 = "Wegwerfen (Tasche)"
	s4 = "Wegwerfen (Koffer)"
	s5 = "Gehen"
	@command_window = Window_Command.new(320, [s1, s2, s3, s4, s5])
	@command_window.x = 0
	@command_window.y = @help_window.y + @help_window.height
	@command_window.set_align(1)
	@command_window.refresh
	@command_window.index = 0
	@command_window.active = true
	@layout_window = Window_Help.new
	@layout_window.y = @command_window.y + @command_window.height
	@layout_window.width = 640 - @item_window.x
	@layout_window.height = 480 - @layout_window.y
	@layout_window.bitmap_adapt
	s1 = "Ja"
	s2 = "Ich will nicht"
	s3 = "Abbrechen"
	@command2_window = Window_Command.new(@layout_window.width, [s1, s2, s3])
	@command2_window.y = @layout_window.y
	@command2_window.height = @layout_window.height
	@command2_window.width = @layout_window.width
	@command2_window.set_align(1)
	@command2_window.refresh
	@command2_window.visible = false
	@command2_window.active = false
	@number_input = Window_InputNumber.new(1)
	@number_input.active = false
	@number_input.visible = false
	@number_input.x = 160
	@number_input.y = @layout_window.y + 48
	@item_window.ort_window = @ort_window
	@box_window.ort_window = @ort_window
	@item_window.help_window = @help_window
	@box_window.help_window = @help_window
	@item_window.update_help
	@anzahl = 1
	Graphics.transition
	loop do
  	Graphics.update
  	Input.update
  	update
  	if $scene != self
    	break
  	end
	end
	Graphics.freeze
	@help_window.dispose
	@ort_window.dispose
	@info_window.dispose
	@item_window.dispose
	@box_window.dispose
	@command_window.dispose
	@layout_window.dispose
	@number_input.dispose
	@command2_window.dispose
  end
  #--------------------------------------------------------------------------
  def update
	@help_window.update
	@ort_window.update
	@info_window.update
	@item_window.update
	@box_window.update
	if !@item_window.eof
  	@command_window.disable_item(0)
  	@command_window.disable_item(2)
	else
  	@command_window.enable_item(0)
  	@command_window.enable_item(2)
	end
	if !@box_window.eof
  	@command_window.disable_item(1)
  	@command_window.disable_item(3)
	else
  	@command_window.enable_item(1)
  	@command_window.enable_item(3)
	end
	@command_window.update
	if @command_window.active
  	case @command_window.index
  	when 0
    	@item_window.visible = true
    	@box_window.visible = false
    	@item_window.update_help
    	@info_window.set_text("Willst etwas aus der Tasche in den Koffer tun?")
  	when 1
    	@item_window.visible = false
    	@box_window.visible = true
    	@box_window.update_help
    	@info_window.set_text("Willst du etwas aus dem Koffer in die Tasche tun?")
  	when 2
    	@item_window.visible = true
    	@box_window.visible = false
    	@item_window.update_help
    	@info_window.set_text("Willst du etwas aus der Tasche wegwerfen?")
  	when 3
    	@item_window.visible = false
    	@box_window.visible = true
    	@box_window.update_help
    	@info_window.set_text("Willst du etwas aus dem Koffer wegwerfen?")
  	when 4
    	@item_window.visible = true
    	@box_window.visible = false
    	@item_window.update_help
    	@info_window.set_text("Willst du gehen?")
  	end
  	update_command
  	return
	end
	@layout_window.update
	@number_input.update
	@command2_window.update
	if @item_window.active
  	update_item
  	return
	end
	if @box_window.active
  	update_box
  	return
	end
	if @number_input.active
  	update_input
  	return
	end
	if @command2_window.active
  	update_c2
  	return
	end
  end
  #--------------------------------------------------------------------------
  def zehn(hoch)
	if hoch == 0 
  	return 0  	# nur speziell hierfür. Normal return 1
	end
	temp=1
	for i in 1..hoch
  	temp = temp*10
	end
	return temp
  end
  #--------------------------------------------------------------------------
  def digits_number(n)
	n=n.abs
	for i in 0..5
  	if n>= zehn(i) and n<zehn(i+1)
    	return i+1
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_item
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	@item_window.index = 0
  	@item_window.update_help
  	@item_window.active = false
  	@command_window.active = true
  	return
	end
	if Input.trigger?(Input::C)
  	@item = @item_window.item
  	case @item
  	when RPG::Item
    	@number = $game_party.item_number(@item.id)
    	@cnumber = $game_party.item_box_number(@item.id)
    	@maxnumber = $game_party.maxitemb
  	when RPG::Weapon
    	@number = $game_party.weapon_number(@item.id)
    	@cnumber = $game_party.weapon_box_number(@item.id)
    	@maxnumber = $game_party.maxweaponb
  	when RPG::Armor
    	@number = $game_party.armor_number(@item.id)
    	@cnumber = $game_party.armor_box_number(@item.id)
    	@maxnumber = $game_party.maxarmorb
  	end 
  	if @number == 1
    	case @command_window.index
    	when 0
      	@info_window.set_text("Willst du "+@item.name+" ablegen?")
    	when 2
      	@info_window.set_text("Willst du "+@item.name+" wegwerfen?")
    	end
    	@anzahl = 1
    	@command2_window.visible = true
    	@command2_window.active = true
    	@item_window.active = false
    	return
  	elsif @number > 1
    	@number_input = Window_InputNumber.new(digits_number(@number))
    	@number_input.x = 160 - @number_input.width
    	@number_input.y = @layout_window.y + 48
    	@item_window.active = false
    	case @command_window.index
    	when 0
      	@info_window.set_text("Wie viel von "+@item.name+" willst du aus der Tasche ablegen?")
      	@layout_window.set_text("Wie viele ablegen?")
    	when 2
      	@info_window.set_text("Viel von "+@item.name+" willst du aus der Tasche wegwerfen?")
      	@layout_window.set_text("Wie viele wegwerfen?")
    	end
  	else
    	$game_system.se_play($data_system.buzzer_se)
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_command
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	$scene = Scene_Map.new
  	return
	end
	if Input.trigger?(Input::C)
  	case @command_window.index
  	when 0
    	if @item_window.eof
      	$game_system.se_play($data_system.decision_se)
      	@item_window.active = true
      	@command_window.active = false
      	@info_window.set_text("Was möchtest du ablegen?")
    	else
      	$game_system.se_play($data_system.buzzer_se)
    	end
  	when 1
    	if @box_window.eof
      	$game_system.se_play($data_system.decision_se)
      	@item_window.visible = false
      	@box_window.visible = true
      	@box_window.active = true
      	@command_window.active = false
      	@info_window.set_text("Was möchtest du aufnehmen?")
    	else
      	$game_system.se_play($data_system.buzzer_se)
    	end
  	when 2
    	if @item_window.eof
      	$game_system.se_play($data_system.decision_se)
      	@item_window.active = true
      	@command_window.active = false
      	@info_window.set_text("Was möchtest du aus der Tasche wegwerfen?")
    	else
      	$game_system.se_play($data_system.buzzer_se)
    	end
  	when 3
    	if @box_window.eof
      	$game_system.se_play($data_system.decision_se)
      	@item_window.visible = false
      	@box_window.visible = true
      	@box_window.active = true
      	@command_window.active = false
      	@info_window.set_text("Was möchtest du aus dem Koffer wegwerfen?")
    	else
      	$game_system.se_play($data_system.buzzer_se)
    	end
  	when 4
    	$scene = Scene_Map.new
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_c2
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	case @command_window.index
  	when 0
    	@item_window.active = true
    	@info_window.set_text("Was willst du ablegen?")
  	when 1
    	@box_window.active = true
    	@info_window.set_text("Was willst du aufnehmen?")
  	when 2
    	@item_window.active = true
    	@info_window.set_text("Was willst du aus der Tasche wegwerfen?")
  	when 3
    	@box_window.active = true
    	@info_window.set_text("Was willst du aus dem Koffer wegwerfen?")
  	end
  	@command2_window.active = false
  	@command2_window.visible = false
  	@command2_window.index = 0
  	return
	end
	if Input.trigger?(Input::C)
  	$game_system.se_play($data_system.decision_se)
  	case @command2_window.index
  	when 0
    	case @command_window.index
    	when 0
      	case @item
      	when RPG::Item
        	$game_party.lose_item(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_item_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Weapon
        	$game_party.lose_weapon(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_weapon_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Armor
        	$game_party.lose_armor(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_armor_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	end
      	@item_window.index = 0
      	@item_window.refresh
      	if @item_window.eof
        	@info_window.set_text("Was willst du ablegen?")
        	@item_window.active = true
      	else
        	@command_window.index = 0
        	@command_window.active = true
      	end
    	when 1
      	case @item
      	when RPG::Item
        	$game_party.lose_item_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_item(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Weapon
        	$game_party.lose_weapon_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_weapon(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Armor
        	$game_party.lose_armor_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
        	$game_party.gain_armor(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	end
      	@box_window.index = 0
      	@box_window.refresh
      	if @box_window.eof
        	@info_window.set_text("Was willst du aufnehmen?")
        	@box_window.active = true
      	else
        	@command_window.index = 0
        	@command_window.active = true
      	end
    	when 2
      	case @item
      	when RPG::Item
        	$game_party.lose_item(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Weapon
        	$game_party.lose_weapon(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Armor
        	$game_party.lose_armor(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	end
      	@item_window.index = 0
      	@item_window.refresh
      	if @item_window.eof
        	@info_window.set_text("Was willst du aus der Tasche wegwerfen?")
        	@item_window.active = true
      	else
        	@command_window.index = 0
        	@command_window.active = true
      	end
    	when 3
      	case @item
      	when RPG::Item
        	$game_party.lose_item_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Weapon
        	$game_party.lose_weapon_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	when RPG::Armor
        	$game_party.lose_armor_box(@item.id, (@anzahl>=@number) ? @number : @anzahl)
      	end
      	@box_window.index = 0
      	@box_window.refresh
      	if @box_window.eof
        	@info_window.set_text("Was willst du aus dem Koffer wegwerfen?")
        	@box_window.active = true
      	else
        	@command_window.index = 0
        	@command_window.active = true
      	end
    	end
    	@command2_window.active = false
    	@command2_window.visible = false
    	@command2_window.index = 0
    	@item_window.refresh
    	@box_window.refresh
  	when 1
    	case @command_window.index
    	when 0
      	@item_window.active = true
      	@info_window.set_text("Was willst du ablegen?")
    	when 1
      	@box_window.active = true
      	@info_window.set_text("Was willst du aufnehmen?")
    	when 2
      	@item_window.active = true
      	@info_window.set_text("Was willst du aus der Tasche wegwerfen?")
    	when 3
      	@box_window.active = true
      	@info_window.set_text("Was willst du aus dem Koffer wegwerfen?")
    	end
    	@command2_window.active = false
    	@command2_window.visible = false
    	@command2_window.index = 0
  	when 2
    	@command2_window.active = false
    	@command2_window.visible = false
    	@command2_window.index = 0
    	@command_window.index = 0
    	@command_window.active = true
    	@item_window.visible = true
    	@box_window.visible = false
    	@item_window.index = 0
    	@item_window.update_help
    	@box_window.index = 0
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_input
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	@layout_window.set_text(" ")
  	case @command_window.index
  	when 0
    	@item_window.active = true
    	@info_window.set_text("Was willst du ablegen?")
  	when 1
    	@box_window.active = true
    	@info_window.set_text("Was willst du aufnehmen?")
  	when 2
    	@item_window.active = true
    	@info_window.set_text("Was willst du aus der Tasche wegwerfen?")
  	when 3
    	@box_window.active = true
    	@info_window.set_text("Was willst du aus dem Koffer wegwerfen?")
  	end
  	@number_input.active = false
  	@number_input.visible = false
  	@number_input.number = 0
  	return
	end
	if Input.trigger?(Input::C)
  	@anzahl = @number_input.number
  	if @anzahl > 0
    	@anzahl = (@anzahl > @number) ? @number : @anzahl
    	case @command_window.index
    	when 0
      	if (@anzahl + @cnumber) > @maxnumber
        	@info_window.set_text("Von "+@item.name+" kannst nur noch höchstens "+(@maxnumber - @cnumber).to_s+" ablegen.")
        	@number_input.number = 0
        	return
      	elsif @anzahl >= @number
        	@info_window.set_text("Willst du alles von "+@item.name+" ablegen?")
      	else
        	@info_window.set_text("Willst du "+@anzahl.to_s+" von "+@item.name+" ablegen?")
      	end
    	when 1
      	if (@anzahl + @cnumber) > @maxnumber
        	@info_window.set_text("Von "+@item.name+" kannst nur noch höchstens "+(@maxnumber - @cnumber).to_s+" ablegen.")
        	@number_input.number = 0
        	return
      	elsif @anzahl >= @number
        	@info_window.set_text("Willst du alles von "+@item.name+" aufnehmen?")
      	else
        	@info_window.set_text("Willst du "+@anzahl.to_s+" von "+@item.name+" aufnehmen?")
      	end
    	when 2
      	if @anzahl >= @number
        	@info_window.set_text("Willst du alles von "+@item.name+" aus der Tasche wegwerfen?")
      	else
        	@info_window.set_text("Willst du "+@anzahl.to_s+" von "+@item.name+" aus der Tasche wegwerfen?")
      	end
    	when 3
      	if @anzahl >= @number
        	@info_window.set_text("Willst du alles von "+@item.name+" aus dem Koffer wegwerfen?")
      	else
        	@info_window.set_text("Willst du "+@anzahl.to_s+" von "+@item.name+" aus dem Koffer wegwerfen?")
      	end
    	end
    	@layout_window.set_text(" ")
    	@command2_window.active = true
    	@command2_window.visible = true
    	@number_input.number = 0
    	@number_input.active = false
    	@number_input.visible = false
  	else 
    	$game_system.se_play($data_system.buzzer_se)
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_box
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	@box_window.active = false
  	@box_window.visible = false
  	@box_window.index = 0
  	@item_window.index = 0
  	@item_window.update_help
  	@item_window.visible = true
  	@command_window.active = true
  	return
	end
	if Input.trigger?(Input::C)
  	@item = @box_window.item
  	case @item
  	when RPG::Item
    	@number = $game_party.item_box_number(@item.id)
    	@cnumber = $game_party.item_number(@item.id)
    	@maxnumber = $game_party.maxitemt
  	when RPG::Weapon
    	@number = $game_party.weapon_box_number(@item.id)
    	@cnumber = $game_party.weapon_number(@item.id)
    	@maxnumber = $game_party.maxweapont
  	when RPG::Armor
    	@number = $game_party.armor_box_number(@item.id)
    	@cnumber = $game_party.armor_number(@item.id)
    	@maxnumber = $game_party.maxarmort
  	end 
  	if @number == 1
    	case @command_window.index
    	when 1
      	@info_window.set_text("Willst du "+@item.name+" aufnehmen?")
    	when 3
      	@info_window.set_text("Willst du aus dem Koffer "+@item.name+" wegwerfen?")
    	end
    	@anzahl = 1
    	@command2_window.visible = true
    	@command2_window.active = true
    	@box_window.active = false
    	return
  	elsif @number > 1
    	@number_input = Window_InputNumber.new(digits_number(@number))
    	@number_input.x = 160 - @number_input.width
    	@number_input.y = @layout_window.y + 48
    	@box_window.active = false
    	case @command_window.index
    	when 1
      	@info_window.set_text("Viel von "+@item.name+" willst du aufnehmen?")
      	@layout_window.set_text("Wie viele aufnehmen?")
    	when 3
      	@info_window.set_text("Viel von "+@item.name+" willst du aus dem Koffer wegwerfen?")
      	@layout_window.set_text("Wie viele wegwerfen?")
    	end
  	elsif
    	$game_system.se_play($data_system.buzzer_se)
  	end
	end
  end
end
#==============================================================================
class Window_Box < Window_Selectable
  #--------------------------------------------------------------------------
  attr_reader   :ort_window
  #--------------------------------------------------------------------------
  def initialize(n)
	super(320, 64, 320, 416)
	refresh
	self.index = 0
	if $game_temp.in_battle
  	self.y = 64
  	self.height = 256
  	self.back_opacity = 160
	end
	# typ == 0 -> tasche   typ == 1 -> kiste
	@typ = n
  end
  #--------------------------------------------------------------------------
  def item
	return @data[self.index]
  end
  #--------------------------------------------------------------------------
  def eof
	return @data != []
  end
  #--------------------------------------------------------------------------
  def ort_window=(ort_window)
	@ort_window = ort_window
  end
  #--------------------------------------------------------------------------
  def refresh
	if self.contents != nil
  	self.contents.dispose
  	self.contents = nil
	end
	@data = []
	case @typ
	when 0
  	for i in 1...$data_items.size
    	if $game_party.item_number(i) > 0
      	@data.push($data_items[i])
    	end
  	end
  	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
	when 1
  	for i in 1...$data_items.size
    	if $game_party.item_box_number(i) > 0
      	@data.push($data_items[i])
    	end
  	end
  	for i in 1...$data_weapons.size
    	if $game_party.weapon_box_number(i) > 0
      	@data.push($data_weapons[i])
    	end
  	end
  	for i in 1...$data_armors.size
    	if $game_party.armor_box_number(i) > 0
      	@data.push($data_armors[i])
    	end
  	end
	end
	# If item count is not 0, make a bit map and draw all items
	@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 = (@typ == 0) ? $game_party.item_number(item.id) : $game_party.item_box_number(item.id)
	when RPG::Weapon
  	number = (@typ == 0) ? $game_party.weapon_number(item.id) : $game_party.weapon_box_number(item.id)
	when RPG::Armor
  	number = (@typ == 0) ? $game_party.armor_number(item.id) : $game_party.armor_box_number(item.id)
	end
	self.contents.font.color = normal_color
	x = 4
	y = index * 32
	rect = Rect.new(x, y, self.width - 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 + 240, y, 16, 32, ":", 1)
	self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  def update_help
	@help_window.set_text(self.item == nil ? "" : self.item.description)
	@ort_window.set_text((@typ == 0) ? "Tasche" : "Koffer")
  end
end
#==============================================================================
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  def bitmap_adapt
	self.contents = Bitmap.new(width - 32, height - 32)
  end
end
#==============================================================================
class Window_Command < Window_Selectable
  alias initialize_ikssbt   :initialize
  def initialize(width, commands)
	@align = 0
	initialize_ikssbt(width, commands)
  end
  #--------------------------------------------------------------------------
  def set_align(n)
	if n>=0 and n<=2
  	@align = n
	end
  end	
  #--------------------------------------------------------------------------
  def draw_item(index, color)
	self.contents.font.color = color
	rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
	self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
	self.contents.draw_text(rect, @commands[index], @align)
  end
  #--------------------------------------------------------------------------
  def enable_item(index)
	draw_item(index, normal_color)
  end
end
#==============================================================================
class Game_Party
 
  attr_reader   :maxitemt             	# max Anz. für Items (Tasche)
  attr_reader   :maxweapont           	# max Anz. für Weapon (Tasche)
  attr_reader   :maxarmort            	# max Anz. für Armor (Tasche)
  attr_reader   :maxitemb             	# max Anz. für Items (Box)
  attr_reader   :maxweaponb           	# max Anz. für Weapon (Box)
  attr_reader   :maxarmorb            	# max Anz. für Armor (Box)
 
  alias initialize_ikssbt   :initialize
  def initialize
	initialize_ikssbt
	@items_box = {}
	@weapons_box = {}
	@armors_box = {}
	@maxitemt = 100	# man kann 100 Items von der selben Sorte tragen
	@maxweapont = 10   # man kann 10 Waffen von der selben Sorte tragen
	@maxarmort = 10	# man kann 10 Rüstungen von der selben Sorte tragen
	@maxitemb = 500	# man kann 500 Items von der selben Sorte lagern
	@maxweaponb = 30   # man kann 30 Waffen von der selben Sorte lagern
	@maxarmorb = 30	# man kann 30 Rüstungen von der selben Sorte lagern
  end
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
	if item_id > 0
  	@items[item_id] = [[item_number(item_id) + n, 0].max, @maxitemt].min
	end
  end
  #--------------------------------------------------------------------------
  def gain_weapon(weapon_id, n)
	if weapon_id > 0
  	@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, @maxweapont].min
	end
  end
  #--------------------------------------------------------------------------
  def gain_armor(armor_id, n)
	if armor_id > 0
  	@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, @maxarmort].min
	end
  end
  #--------------------------------------------------------------------------
  def item_box_number(item_id)
	return @items_box.include?(item_id) ? @items_box[item_id] : 0
  end
  #--------------------------------------------------------------------------
  def weapon_box_number(weapon_id)
	return @weapons_box.include?(weapon_id) ? @weapons_box[weapon_id] : 0
  end
  #--------------------------------------------------------------------------
  def armor_box_number(armor_id)
	return @armors_box.include?(armor_id) ? @armors_box[armor_id] : 0
  end
  #--------------------------------------------------------------------------
  def gain_item_box(item_id, n)
	if item_id > 0
  	@items_box[item_id] = [[item_box_number(item_id) + n, 0].max, @maxitemb].min
	end
  end
  #--------------------------------------------------------------------------
  def gain_weapon_box(weapon_id, n)
	if weapon_id > 0
  	@weapons_box[weapon_id] = [[weapon_box_number(weapon_id) + n, 0].max, @maxweaponb].min
	end
  end
  #--------------------------------------------------------------------------
  def gain_armor_box(armor_id, n)
	if armor_id > 0
  	@armors_box[armor_id] = [[armor_box_number(armor_id) + n, 0].max, @maxarmorb].min
	end
  end
  #--------------------------------------------------------------------------
  def lose_item_box(item_id, n)
	gain_item_box(item_id, -n)
  end
  #--------------------------------------------------------------------------
  def lose_weapon_box(weapon_id, n)
	gain_weapon_box(weapon_id, -n)
  end
  #--------------------------------------------------------------------------
  def lose_armor_box(armor_id, n)
	gain_armor_box(armor_id, -n)
  end
end
zum Lesen den Text mit der Maus markieren


Doppelpost das nächste mal selber entfernen. ~Monsta

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Monsta« (5. April 2009, 14:49)


8

Sonntag, 5. April 2009, 15:50

Ich hab grad mal was gescriptet...
Spoiler

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
#==============================================================================
# Item Entfernen Window Skript 
# von Hüpfende Kokosnuss, 5.4.2009, rpg-studio.de
#------------------------------------------------------------------------------
# "Item_Entfernen.new" als Scriptbefehl ruft ein Window auf, mit dem der Spieler 
# Items aus dem Inventar entfernen kann. Diese sind dann gelöscht.
#==============================================================================
class Game_Party
  attr_reader :items
end
class Item_Entfernen
  def initialize
    return if $game_party.items.size == 0
    # Make help window, item window
    @help_window = Window_Help.new
    @item_window = Window_Item.new
    # Associate help window
    @item_window.help_window = @help_window
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Update windows
      @help_window.update
      @item_window.update
      # If item window is active: call update_item
      if @item_window.active
        # If B button was pressed
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          break
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          # Get currently selected data on the item window
          @item = @item_window.item
          # If not a use item
          if @item.is_a?(RPG::Item)
            unless @item.consumable
            $game_system.se_play($data_system.buzzer_se)
            else
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              $game_party.lose_item(@item.id, 1)
              @item_window.draw_item(@item_window.index)
            end
          elsif @item.is_a?(RPG::Weapon)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_weapon(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          elsif @item.is_a?(RPG::Armor)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_armor(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
        end
      end
    end
    # Dispose of windows
    @help_window.dispose
    @item_window.dispose
  end
end
zum Lesen den Text mit der Maus markieren

Musste mich nicht an deinen Skripts bedienen, der RGSS-Standard hat völlig ausgereicht ^^
Aufrufen mit "Item_Entfernen.new".
Es ist nicht perfekt, ich habs mal provisorisch gemacht, aber nach ner halben Stunde hatte ich kein Bock mehr xD
Probiers einfach aus, ich hab extra darauf geachtet dass es auch mitten in einem Event aufrufbar ist, so dass das Event danach weiterläuft ^^

9

Sonntag, 5. April 2009, 19:43

juhu es funktioniert, vielen dank, und du bekommst trotzdem eintrag in den credits :3!
soa nurnoch eine frage, was muss ich machen, damit die truhe immer wieder abfragt, bis man wirklich 1 gegenstand weggelegt hat? bei mir ist das grade so dass wenn dann dein Script geöffnet wird und dann mit ESC abbricht, man trotzdem das Item erhählt und nicht wieder die max anzahl an Gegenständen abgefragt wird.
Könnte man evtl. das Script noch so umbauen dass man weder mit Esc, X oder 0 abbrechen kann?
wenn man das ganze mit eventcode lösen kann auch gut :3

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

10

Sonntag, 5. April 2009, 19:47

Damit man nicht mehr ESC drücken kann, entferne das hier:

Ruby Quellcode

1
2
3
4
5
6
# If B button was pressed
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          break
        end


Mit Event gings so:

Loop:
Call Script dingens
Conditional Branch: $game_party.items < 20
Break
End
End
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

11

Sonntag, 5. April 2009, 19:57

jap es funktioniert :D
musste nurnoch

Ruby Quellcode

1
2
$game_system.se_play($data_system.cancel_se)
        	break

vor das end von

Ruby Quellcode

1
if @item.is_a?(RPG::Item)

setzen :3

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

12

Sonntag, 5. April 2009, 19:59

Mit Event gings so:

Loop:
Call Script dingens
Conditional Branch: $game_party.items < 20
Break
End
End

So hätte ichs gelöst, so wars von mir gedacht.

Sonst könnte man das Window gar nicht mehr verlassen ^^
Willst du, dass sich das Window automatisch schließt, wenn man ein Item weggibt? Dann ersetze diese Zeilen...
Spoiler

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
        if Input.trigger?(Input::C)
          # Get currently selected data on the item window
          @item = @item_window.item
          # If not a use item
          if @item.is_a?(RPG::Item)
            unless @item.consumable
            $game_system.se_play($data_system.buzzer_se)
            else
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              $game_party.lose_item(@item.id, 1)
              @item_window.draw_item(@item_window.index)
            end
          elsif @item.is_a?(RPG::Weapon)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_weapon(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          elsif @item.is_a?(RPG::Armor)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_armor(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
       end
zum Lesen den Text mit der Maus markieren

...durch diese:
Spoiler

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
        if Input.trigger?(Input::C)
          # Get currently selected data on the item window
          @item = @item_window.item
          # If not a use item
          if @item.is_a?(RPG::Item)
            unless @item.consumable
            $game_system.se_play($data_system.buzzer_se)
            else
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              $game_party.lose_item(@item.id, 1)
              @item_window.draw_item(@item_window.index)
            end
          elsif @item.is_a?(RPG::Weapon)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_weapon(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          elsif @item.is_a?(RPG::Armor)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            $game_party.lose_armor(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
       break if !@item.is_a?(RPG::Item) or @item.consumable
       end
zum Lesen den Text mit der Maus markieren

Edit:
So wie ihr es gelöst habt, kann es erstens zu nem Fehler kommen wenn das Item keine Waffe oder Rüstung ist, und zweitens kann der User nicht mehr abbrechen wenn er doch das Item aus der Truhe wegwerfen will =D
Nimm anstatt deiner eigenen Änderung lieber die obige von mir, und das mit dem Escape rausnehmen würd ich auch rückgängig machen, wenn ich du wär. Die Eventlösung wäre imo am besten (siehe Zitat von Neo-Bahamut).

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Süleyman der Prächtige« (5. April 2009, 20:06)


13

Sonntag, 5. April 2009, 20:25

und wie muss dann der rest vom conditionalBranch aussehen?
es kann sein dass ich blind bin, aber jetzt bin ich ein bisschen verwirrt.

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

14

Sonntag, 5. April 2009, 22:33

Gar nicht anders...
Event:

Quellcode

1
2
3
4
5
6
7
8
9
10
Loop
  Conditional Branch ($game_party.items.size >= 20)
     Message ausgeben: "Du kannst das Item nicht erhalten! Wirf eines weg."
     SKRIPTAUFRUF
  else
    Message ausgeben: "Item erhalten!"
    Item hinzufügen
    break
  end
end

15

Sonntag, 5. April 2009, 22:53

ah xD
i c!
Ja funktioniert komplett, dass muss auch ans ende von battle processings oder? sonst würde sich das ja auch beißen :x
kann man das ganze auch als commonevent machen oder würds dann wieder errorn?
nur ja oder nein obs errort nicht dass ihr das auch noch in ein common event packt...

CHoB - Chival - History of Boltin Sucht dich (vielleicht)!
[WiP]

Social Bookmarks