Lieber Besucher, herzlich willkommen bei: RPG Studio - Make your World real. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Donnerstag, 25. Juli 2013, 21:57

Crafting System - HILFE

Hallo zusammen,

ich suche jetzt seit einiger Zeit eine passende Möglichkeit Crafting in mein Spiel einzubauen, da der Hauptteil des Spieles aus dem verdienen von Geld besteht. Da ich weder der RGSS-Fan bin noch ein großer Kenner dieser Sprache habe ich mich schließlich entschlossen andere Scripts dieser Art zu suchen und bin auch fündig geworden, auch, wenn das oben genannte Script perfekt für mein Projekt wäre.

Verliebt habe ich mich sofort in den SynthShop von Cylindrical da.
Das Einfügen ist einfach gestaltet und auch die Bearbeitung der Rezepte ist simpel gestaltet.

Das einzige Problem ist, dass man für die Herstellung zusätzlich zu den Materialien auch Geld zahlen muss, und zwar den vollen in der Datenbank
angegebenen Preis. So kostet das King's Sword beispielsweise 65.000 Gold.

Da es in meinem Spiel wie gesagt um das Geld verdienen geht und nicht um das Geld ausgeben, müssten die Craftings kostenfrei sein.

Könnte jemand diese Funktion für mich einbasteln? Leider bin ich nicht der große RGSS-Kenner und würde mich über fachmännische Hilfe sehr freuen! :)


Liebe Grüße
zon3y

Hier der Code:
Spoiler

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
#-------------------------------------------------------------------------------
# Synthesis Shop v1.1
# by: Cylindrical
# May 24, 2010
#-------------------------------------------------------------------------------
# Aliases:
#   None
# Overwrites:
#   None
# Compatible with:
#   Most KGC scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
#   Most Yanfly scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
# Not Compatible with:
#   Probably no incompatibilities
#-------------------------------------------------------------------------------
# Version History
# v1.1 - The Requirements window now properly works.
#         * It grays out the item that you don't have.
#         * Many thanks to RPGI for this.
#      - Removed Game_Party#has_item? rewrite
#         * Replaced with a better one.
#         * Thanks again to RPGI.
# v1.0 - Initial release
#         * BUG: The Requirements window does not gray out an item if the
#                resulting item needs two of the same type of item and you have
#                only one. (Fixed on v1.1)
#-------------------------------------------------------------------------------
# What is it?
#   This script copies Final Fantasy IX's Synth Shops where the player is
# allowed to create new items using different materials.
#
# How to use
#   Place above Main. Before you open the synthesize shop, you need to define 
# the shop items. In the SETUP part, you can create arrays to add in your shop. 
# This is the format:
# 
#            Result Item       Requirement 1     Requirement 2
# NAME = [ ["<type>", <id>], ["<type>", <id>], ["<type>", <id>] ]
#
# where: NAME is what you call it. Should be relevant but unique. Must be ALLCAPS
#        <type> is either "WEAPON", "ARMOR", or "ITEM"
#        <id> is the item ID
#
#   Then, using $synth_items, put in the items you want to synth. It can be as
# many as you like.
#
#   $synth_items = [NAME1, NAME2, ... , NAMEn]
#
#   To open the shop window, use the 'Script' command in an event and put it
# this piece of code:
#
#    $scene = Scene_SynthShop.new
#
# Notes
#  * Make sure you fill in $synth_items first before opening the shop.
#  * You MUST GIVE ME CREDIT if you used this in your game.
#  * Free to use for commercial games, as long as you give credit to me.
#  * This is my first script so don't expect too much glamore. I still
#    consider myself a beginner.
#-------------------------------------------------------------------------------
# Special Thanks
#   Raukue for his KGCYanflyPLUS Base Demo
#   RPGI for his help with Window_SynthReq and check_required_item
#-------------------------------------------------------------------------------
# Bugs (v1.1)
#  * None. I hope it stays that way.
#-------------------------------------------------------------------------------
# FAQs
# Q: Can I make it require three ingredients?
# A: No, as of late. But I might do some updates.
#
# Q: How do I set up cost?
# A: The synthesis cost is equal to the item price of the resulting item.
#
# Q: Will this be compatible with <insert script here>?
# A: Most likely, yes since this script uses its own class/methods/functions.
#    With some tests, I find this one compatible with MOST commonly used scripts.
#    I tried this script with a script pack compiled by Raukue. It's called
#    'KGCYanflyPLUS Base'. It has many KGC and Yanfly scripts. I tested it there
#    and no errors were found. Phew! :)
#
# Q: What do you mean by 'relevant but unique' up there?
# A: It means you have to make a unique name for that item and make it so that
#    you can easily tell what it is. You can't use spaces and no repetition of
#    names. As much as possible, make it short.
#    Example:
#       GOOD                BAD
#    MAGIC_HAMMER     MAGIC HAMMER <- No spaces.
#    CYL_MAGHAMMER    SYNTH_ITEM1  <- No sense at all.
#    DEATHSCYTHE      A or X or D  <- AVOID this.
#    BIGBOMB_1        SUPER_ULTRA_HYPER_ETERNAL_MAGIC_BELL <- No comment.
#
#    So basically, make it 'unique' and 'relevant'.
#
# Q: I want more items to be synthesized but the Script Dialog in the Event
#    Editor can't hold too much letters. What should I do?
# A: You can make two arrays and combine them, like this:
#    Example:
#      $synth_items = [KATANA, MORNING_STAR] <- Assuming you can't type anymore.
#    Use the Script command again and do the same except that you need to add
#    a plus sign (+) before the equal sign (=). Like this:
#      $synth_items += [MANI_KATTI, TIGER_RACKET, EXCALIBUR_2]
#    
#    Another way is to place the whole array into another variable, like this.
#    This technique is good if you have several shops that offers the same items.
#      LINDBLUM_SYNTH_SHOP = [KATANA, MORNING_STAR, MANI_KATTI, TIGER_RACKET,
#                             EXCALIBUR_2]
#      $synth_items = LINDBLUM_SYNTH_SHOP
#
# Q: Can we trust you? You said you're a beginner.
# A: If you're a user that doesn't mind dirty codes, you can. This script works.
#    If you're a scripter who doesn't like dirty codes, I don't know. It's really
#    messy, if you know what I mean...
#-------------------------------------------------------------------------------
 
#-------------------------------------------------------------------------------
# SETUP START
#-------------------------------------------------------------------------------
 
  # Welcome Message
  SYNTH_WELCOME = "Welcome! What can I do for you?"
 
  # Replace 'Synthesize' with this.
  SYNTH_COMMAND = "Synthesize"
 
  # Replace 'Requirements' with this.
  SYNTH_REQUIREMENTS = "Requirements"
 
  # Synth-able Items Database - Follow the format. Spaces doesn't really matter.
  #                             The numbers here MUST exist in the database.
#                      Result         Material 1     Material 2
#      NAME           TYPE     ID     TYPE      ID    TYPE     ID
  BASTARD_SWORD = [ ["WEAPON", 10], ["WEAPON",  2], ["WEAPON", 6] ]
  FLAME_SHIELD  = [ ["ARMOR",   3], ["ARMOR",   1], ["ITEM",  15] ]
  FULL_POTION   = [ ["ITEM",    3], ["ITEM",    2], ["ITEM",   2] ]
  DRAGON_SWORD  = [ ["WEAPON", 29], ["WEAPON", 10], ["ARMOR", 29] ]
  LIFE_RING     = [ ["ARMOR",  29], ["ARMOR",  10], ["ITEM",   3] ]
  DRAGON_MAIL   = [ ["ARMOR",  22], ["ARMOR",   3], ["ARMOR",  3] ]
  FLAME_SCROLL  = [ ["ITEM",   16], ["ITEM",    2], ["ITEM",  15] ]
 
  # Common Shops - If you want to use a shop over and over again, you might
  #                want to use this. Define the synth-able items above and
  #                place them here. This is the format:
  #                       NAME = [ITEM1, ITEM2, ..., ITEMn]
  #                NAME must be ALLCAPS
  #                ITEMs must match with those above. If you put something that
  #                does not match with even one of those above, you'll get an error.
  #                Check the Whitesmith to see how to use this array.
  TEST_MAP_SYNTH_SHOP = [BASTARD_SWORD, FLAME_SHIELD, FLAME_SCROLL, FULL_POTION,
                         LIFE_RING, DRAGON_SWORD, DRAGON_MAIL]
 
  # If you use Common Shops, create a list by doing this:
  #             $synth_items = TEST_MAP_SYNTH_SHOP
  # If not, do this:
  #             $synth_items = [BASTARD_SWORD, FLAME_SHIELD, ETC]
  #                            ^(Notice the square brackets)
 
 
#-------------------------------------------------------------------------------
# SETUP END - Do not touch anything beyond this point unless you know what you
#             are doing.
#-------------------------------------------------------------------------------
 
#===============================================================================
# ** Scene_SynthShop
#-------------------------------------------------------------------------------
#  This class performs the synthesis shop processing.
#===============================================================================
class Scene_SynthShop < Scene_Base
  #-----------------------------------------------------------------------------
  # * Start Processing
  #-----------------------------------------------------------------------------
  def start
    super
    @synth_items = []
    @item_index = 0
    @sold_item = nil
    @checking = []
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @synth_window = Window_Synth.new(0, 112)
    @synth_window.active = false
    @synth_window.visible = false
    @status_window = Window_ShopStatus.new(304, 112)
    @status_window.visible = false
    @requirements_window = Window_SynthReq.new(0, 264, @item_index)
    @requirements_window.visible = false
    @synth_window.index = 0
    @help_window.set_text(SYNTH_WELCOME)
  end
  #-----------------------------------------------------------------------------
  # * Terminate Process
  #-----------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
    @help_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @synth_window.dispose
    @status_window.dispose
    @requirements_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #-----------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @synth_window.update
    @status_window.update
    @requirements_window.update(@item_index)
    @gold_window.update
    if @command_window.active
      update_command_selection
    elsif @synth_window.active
      update_synth_selection
    end
    update_help
  end
  #-----------------------------------------------------------------------------
  # * Create Command Window
  #-----------------------------------------------------------------------------
  def create_command_window
    s1 = SYNTH_COMMAND
    s2 = Vocab::ShopCancel
    @command_window = Window_Command.new(384, [s1, s2], 3)
    @command_window.y = 56
  end
  #-----------------------------------------------------------------------------
  # * Dispose Command Window
  #-----------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Update Command Selection
  #-----------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 # Synth
        Sound.play_decision
        @command_window.active = false
        @dummy_window.visible = false
        @synth_window.active = true
        @synth_window.visible = true
        @synth_window.refresh
        @status_window.visible = true
        @requirements_window.visible = true
        @synth_window.index = 0
      when 1
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Synthesize Selection
  #-----------------------------------------------------------------------------
  def update_synth_selection
    @status_window.item = @synth_window.item
    @item = @synth_window.item
    update_help
    @requirements_window.update_price(@item.price)
    if Input.trigger?(Input::DOWN) or Input::trigger?(Input::UP)
      @item_index = @synth_window.index
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @item = nil
      @command_window.active = true
      @dummy_window.visible = true
      @synth_window.active = false
      @synth_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text(SYNTH_WELCOME)
      @requirements_window.visible = false
      return
    end
    if Input.trigger?(Input::C)
      e = check_required_item(@synth_window.index)
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or number == 99 or !e
        Sound.play_buzzer
      else
        idx = @synth_window.index
        get_result_item(@synth_window.index)
        $game_party.lose_item(@checking[0], 1)
        $game_party.lose_item(@checking[1], 1)
        $game_party.gain_item(@sold_item, 1)
        $game_party.lose_gold(@item.price)
        Sound.play_shop
        @gold_window.refresh
        @status_window.refresh
        @synth_window.refresh
        @synth_window.index = idx
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Index of item selected
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
    else
      valid = true if $game_party.has_item?(@checking[0]) and $game_party.has_item?(@checking[1]) and @checking[0] != @checking[1]
    end
    return valid
  end
  #-----------------------------------------------------------------------------
  # * Get Resulting Item
  #     i : Item index
  #-----------------------------------------------------------------------------
  def get_result_item(i)
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @sold_item = p
    end
  #-----------------------------------------------------------------------------
  # * Update Help Window
  #-----------------------------------------------------------------------------
  def update_help
    @help_window.set_text(@item == nil ? SYNTH_WELCOME : @item.description)
  end
 
end
 
#===============================================================================
# ** Window_Synth
#-------------------------------------------------------------------------------
#  This window shows the synth-able items defined by $synth_items.
#===============================================================================
class Window_Synth < Window_Selectable
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 304, 152)
    @checking = []
    @synth_items = []
    refresh
    self.index = 0
  end
  #-----------------------------------------------------------------------------
  # * Get Item
  #-----------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    @data = []
    @synth_items.clear
    get_result_item
    for x in 0...@synth_items.size
      item = @synth_items[x]
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      e = check_required_item(i)
      draw_item(i, e)
    end
  end
  #-----------------------------------------------------------------------------
  # * Draw Item
  #     index : Item number
  #     valid : enabled or disabled?
  #-----------------------------------------------------------------------------
  def draw_item(index, valid)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < 99 and valid)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
  end
  #-----------------------------------------------------------------------------
  # * Get Result Item
  #-----------------------------------------------------------------------------
  def get_result_item
    for i in 0...$synth_items.size
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @synth_items.push(p)
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
      return valid
    else
      valid = true if $game_party.has_item?(@checking[0]) && $game_party.has_item?(@checking[1])
    end
    return valid
  end
end
 
#===============================================================================
# ** Window_SynthReq
#-------------------------------------------------------------------------------
#  This window shows the required items needed for synthesis.
#===============================================================================
class Window_SynthReq < Window_Base
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize (x, y, index)
    super(x, y, 304, 152)
    @req = []
    @lacking = false
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #     req_item_index : Required item number
  #-----------------------------------------------------------------------------
  def update(req_item_index)
    get_required_item(req_item_index)
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Price Update
  #     item_price : Item price
  #-----------------------------------------------------------------------------
  def update_price(item_price)
    @price = item_price
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, WLH, SYNTH_REQUIREMENTS)
    self.contents.font.color = normal_color
    self.contents.draw_text(120, WLH * 4, 120, WLH, @price.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(120, WLH * 4, 140, WLH, Vocab.gold, 2)
    if @req != nil
      self.contents.font.color = normal_color
      req_x = 0
      req_y = WLH
      for i in 0...2
        if @req[0] == @req[1]
          enabled = $game_party.item_number(@req[i]) >= i + 1
        else
          enabled = $game_party.has_item?(@req[i])
        end
        draw_item_name(@req[i], req_x, req_y, enabled)
        req_y += WLH
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Get Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def get_required_item(item_index)
    @req.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @req.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @req.push(p)
    @lacking = true
    if @req[0] == @req[1]
      @lacking = false if $game_party.item_number(@req[0]) >= 2
      return
    else
      @lacking = true if $game_party.has_item?(@req[0]) && $game_party.has_item?(@req[1])
    end
  end
end
zum Lesen den Text mit der Maus markieren

2

Freitag, 26. Juli 2013, 19:05

Keiner? :(

Motto: So lasset uns kein Trübsal sinnieren und gar königlich dinieren!

  • Nachricht senden

3

Freitag, 26. Juli 2013, 19:08

Eigtl. reicht es doch dann auch, wenn man das Gold in der Datenbank auf 0 setzt oder nicht? :D
  • :cake: So lasset uns beginnen! :new:

    • Ein Abenteuer, wie du es noch nie erlebt hast!
      Tauche ein in die wunderbare Welt des Königs und erlebe auf deiner Reise die verrücktesten Dinge!
      NICHT MEHR LANGE! :navigation-right: Hier gibt es weitere Informationen! :navigation-left:
    • Jetzt die Demo herunterladen!
      Bild
      Euch erwartet eine Welt, wie sie nur ein exzentrischer König veralbern könnte...
    • Titelbild
      Bild
  • :fires: XBOX 360 Bild

    Bild
  • :new: Avatar im Großformat

    Bild

4

Freitag, 26. Juli 2013, 19:29

Ja, aber es geht um das Erwirtschaften von Geld, ergo muss das, was man gecraftet hat, auch verkaufbar sein.
Es bringt aber nichts, wenn ich 400 Gold investiere um nur 200 Gold beim Händler zu bekommen =/

Motto: So lasset uns kein Trübsal sinnieren und gar königlich dinieren!

  • Nachricht senden

5

Freitag, 26. Juli 2013, 20:18

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
#-------------------------------------------------------------------------------
# Synthesis Shop v1.1
# by: Cylindrical
# May 24, 2010
#-------------------------------------------------------------------------------
# Aliases:
#   None
# Overwrites:
#   None
# Compatible with:
#   Most KGC scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
#   Most Yanfly scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
# Not Compatible with:
#   Probably no incompatibilities
#-------------------------------------------------------------------------------
# Version History
# v1.1 - The Requirements window now properly works.
#         * It grays out the item that you don't have.
#         * Many thanks to RPGI for this.
#      - Removed Game_Party#has_item? rewrite
#         * Replaced with a better one.
#         * Thanks again to RPGI.
# v1.0 - Initial release
#         * BUG: The Requirements window does not gray out an item if the
#                resulting item needs two of the same type of item and you have
#                only one. (Fixed on v1.1)
#-------------------------------------------------------------------------------
# What is it?
#   This script copies Final Fantasy IX's Synth Shops where the player is
# allowed to create new items using different materials.
#
# How to use
#   Place above Main. Before you open the synthesize shop, you need to define 
# the shop items. In the SETUP part, you can create arrays to add in your shop. 
# This is the format:
# 
#            Result Item       Requirement 1     Requirement 2
# NAME = [ ["<type>", <id>], ["<type>", <id>], ["<type>", <id>] ]
#
# where: NAME is what you call it. Should be relevant but unique. Must be ALLCAPS
#        <type> is either "WEAPON", "ARMOR", or "ITEM"
#        <id> is the item ID
#
#   Then, using $synth_items, put in the items you want to synth. It can be as
# many as you like.
#
#   $synth_items = [NAME1, NAME2, ... , NAMEn]
#
#   To open the shop window, use the 'Script' command in an event and put it
# this piece of code:
#
#    $scene = Scene_SynthShop.new
#
# Notes
#  * Make sure you fill in $synth_items first before opening the shop.
#  * You MUST GIVE ME CREDIT if you used this in your game.
#  * Free to use for commercial games, as long as you give credit to me.
#  * This is my first script so don't expect too much glamore. I still
#    consider myself a beginner.
#-------------------------------------------------------------------------------
# Special Thanks
#   Raukue for his KGCYanflyPLUS Base Demo
#   RPGI for his help with Window_SynthReq and check_required_item
#-------------------------------------------------------------------------------
# Bugs (v1.1)
#  * None. I hope it stays that way.
#-------------------------------------------------------------------------------
# FAQs
# Q: Can I make it require three ingredients?
# A: No, as of late. But I might do some updates.
#
# Q: How do I set up cost?
# A: The synthesis cost is equal to the item price of the resulting item.
#
# Q: Will this be compatible with <insert script here>?
# A: Most likely, yes since this script uses its own class/methods/functions.
#    With some tests, I find this one compatible with MOST commonly used scripts.
#    I tried this script with a script pack compiled by Raukue. It's called
#    'KGCYanflyPLUS Base'. It has many KGC and Yanfly scripts. I tested it there
#    and no errors were found. Phew! :)
#
# Q: What do you mean by 'relevant but unique' up there?
# A: It means you have to make a unique name for that item and make it so that
#    you can easily tell what it is. You can't use spaces and no repetition of
#    names. As much as possible, make it short.
#    Example:
#       GOOD                BAD
#    MAGIC_HAMMER     MAGIC HAMMER <- No spaces.
#    CYL_MAGHAMMER    SYNTH_ITEM1  <- No sense at all.
#    DEATHSCYTHE      A or X or D  <- AVOID this.
#    BIGBOMB_1        SUPER_ULTRA_HYPER_ETERNAL_MAGIC_BELL <- No comment.
#
#    So basically, make it 'unique' and 'relevant'.
#
# Q: I want more items to be synthesized but the Script Dialog in the Event
#    Editor can't hold too much letters. What should I do?
# A: You can make two arrays and combine them, like this:
#    Example:
#      $synth_items = [KATANA, MORNING_STAR] <- Assuming you can't type anymore.
#    Use the Script command again and do the same except that you need to add
#    a plus sign (+) before the equal sign (=). Like this:
#      $synth_items += [MANI_KATTI, TIGER_RACKET, EXCALIBUR_2]
#    
#    Another way is to place the whole array into another variable, like this.
#    This technique is good if you have several shops that offers the same items.
#      LINDBLUM_SYNTH_SHOP = [KATANA, MORNING_STAR, MANI_KATTI, TIGER_RACKET,
#                             EXCALIBUR_2]
#      $synth_items = LINDBLUM_SYNTH_SHOP
#
# Q: Can we trust you? You said you're a beginner.
# A: If you're a user that doesn't mind dirty codes, you can. This script works.
#    If you're a scripter who doesn't like dirty codes, I don't know. It's really
#    messy, if you know what I mean...
#-------------------------------------------------------------------------------
 
#-------------------------------------------------------------------------------
# SETUP START
#-------------------------------------------------------------------------------
 
  # Welcome Message
  SYNTH_WELCOME = "Welcome! What can I do for you?"
 
  # Replace 'Synthesize' with this.
  SYNTH_COMMAND = "Synthesize"
 
  # Replace 'Requirements' with this.
  SYNTH_REQUIREMENTS = "Requirements"
 
  # Synth-able Items Database - Follow the format. Spaces doesn't really matter.
  #                             The numbers here MUST exist in the database.
#                      Result         Material 1     Material 2
#      NAME           TYPE     ID     TYPE      ID    TYPE     ID
  BASTARD_SWORD = [ ["WEAPON", 10], ["WEAPON",  2], ["WEAPON", 6] ]
  FLAME_SHIELD  = [ ["ARMOR",   3], ["ARMOR",   1], ["ITEM",  15] ]
  FULL_POTION   = [ ["ITEM",    3], ["ITEM",    2], ["ITEM",   2] ]
  DRAGON_SWORD  = [ ["WEAPON", 29], ["WEAPON", 10], ["ARMOR", 29] ]
  LIFE_RING     = [ ["ARMOR",  29], ["ARMOR",  10], ["ITEM",   3] ]
  DRAGON_MAIL   = [ ["ARMOR",  22], ["ARMOR",   3], ["ARMOR",  3] ]
  FLAME_SCROLL  = [ ["ITEM",   16], ["ITEM",    2], ["ITEM",  15] ]
 
  # Common Shops - If you want to use a shop over and over again, you might
  #                want to use this. Define the synth-able items above and
  #                place them here. This is the format:
  #                       NAME = [ITEM1, ITEM2, ..., ITEMn]
  #                NAME must be ALLCAPS
  #                ITEMs must match with those above. If you put something that
  #                does not match with even one of those above, you'll get an error.
  #                Check the Whitesmith to see how to use this array.
  TEST_MAP_SYNTH_SHOP = [BASTARD_SWORD, FLAME_SHIELD, FLAME_SCROLL, FULL_POTION,
                         LIFE_RING, DRAGON_SWORD, DRAGON_MAIL]
 
  # If you use Common Shops, create a list by doing this:
  #             $synth_items = TEST_MAP_SYNTH_SHOP
  # If not, do this:
  #             $synth_items = [BASTARD_SWORD, FLAME_SHIELD, ETC]
  #                            ^(Notice the square brackets)
 
 
#-------------------------------------------------------------------------------
# SETUP END - Do not touch anything beyond this point unless you know what you
#             are doing.
#-------------------------------------------------------------------------------
 
#===============================================================================
# ** Scene_SynthShop
#-------------------------------------------------------------------------------
#  This class performs the synthesis shop processing.
#===============================================================================
class Scene_SynthShop < Scene_Base
  #-----------------------------------------------------------------------------
  # * Start Processing
  #-----------------------------------------------------------------------------
  def start
    super
    @synth_items = []
    @item_index = 0
    @sold_item = nil
    @checking = []
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @synth_window = Window_Synth.new(0, 112)
    @synth_window.active = false
    @synth_window.visible = false
    @status_window = Window_ShopStatus.new(304, 112)
    @status_window.visible = false
    @requirements_window = Window_SynthReq.new(0, 264, @item_index)
    @requirements_window.visible = false
    @synth_window.index = 0
    @help_window.set_text(SYNTH_WELCOME)
  end
  #-----------------------------------------------------------------------------
  # * Terminate Process
  #-----------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
    @help_window.dispose
    @dummy_window.dispose
    @synth_window.dispose
    @status_window.dispose
    @requirements_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #-----------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @dummy_window.update
    @synth_window.update
    @status_window.update
    @requirements_window.update(@item_index)
    if @command_window.active
      update_command_selection
    elsif @synth_window.active
      update_synth_selection
    end
    update_help
  end
  #-----------------------------------------------------------------------------
  # * Create Command Window
  #-----------------------------------------------------------------------------
  def create_command_window
    s1 = SYNTH_COMMAND
    s2 = Vocab::ShopCancel
    @command_window = Window_Command.new(384, [s1, s2], 3)
    @command_window.y = 56
  end
  #-----------------------------------------------------------------------------
  # * Dispose Command Window
  #-----------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Update Command Selection
  #-----------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 # Synth
        Sound.play_decision
        @command_window.active = false
        @dummy_window.visible = false
        @synth_window.active = true
        @synth_window.visible = true
        @synth_window.refresh
        @status_window.visible = true
        @requirements_window.visible = true
        @synth_window.index = 0
      when 1
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Synthesize Selection
  #-----------------------------------------------------------------------------
  def update_synth_selection
    @status_window.item = @synth_window.item
    @item = @synth_window.item
    update_help
    if Input.trigger?(Input::DOWN) or Input::trigger?(Input::UP)
      @item_index = @synth_window.index
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @item = nil
      @command_window.active = true
      @dummy_window.visible = true
      @synth_window.active = false
      @synth_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text(SYNTH_WELCOME)
      @requirements_window.visible = false
      return
    end
    if Input.trigger?(Input::C)
      e = check_required_item(@synth_window.index)
      number = $game_party.item_number(@item)
      if @item == nil or number == 99 or !e
        Sound.play_buzzer
      else
        idx = @synth_window.index
        get_result_item(@synth_window.index)
        $game_party.lose_item(@checking[0], 1)
        $game_party.lose_item(@checking[1], 1)
        $game_party.gain_item(@sold_item, 1)
        Sound.play_shop
        @status_window.refresh
        @synth_window.refresh
        @synth_window.index = idx
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Index of item selected
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
    else
      valid = true if $game_party.has_item?(@checking[0]) and $game_party.has_item?(@checking[1]) and @checking[0] != @checking[1]
    end
    return valid
  end
  #-----------------------------------------------------------------------------
  # * Get Resulting Item
  #     i : Item index
  #-----------------------------------------------------------------------------
  def get_result_item(i)
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @sold_item = p
    end
  #-----------------------------------------------------------------------------
  # * Update Help Window
  #-----------------------------------------------------------------------------
  def update_help
    @help_window.set_text(@item == nil ? SYNTH_WELCOME : @item.description)
  end
 
end
 
#===============================================================================
# ** Window_Synth
#-------------------------------------------------------------------------------
#  This window shows the synth-able items defined by $synth_items.
#===============================================================================
class Window_Synth < Window_Selectable
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 304, 152)
    @checking = []
    @synth_items = []
    refresh
    self.index = 0
  end
  #-----------------------------------------------------------------------------
  # * Get Item
  #-----------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    @data = []
    @synth_items.clear
    get_result_item
    for x in 0...@synth_items.size
      item = @synth_items[x]
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      e = check_required_item(i)
      draw_item(i, e)
    end
  end
  #-----------------------------------------------------------------------------
  # * Draw Item
  #     index : Item number
  #     valid : enabled or disabled?
  #-----------------------------------------------------------------------------
  def draw_item(index, valid)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (number < 99 and valid)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
  end
  #-----------------------------------------------------------------------------
  # * Get Result Item
  #-----------------------------------------------------------------------------
  def get_result_item
    for i in 0...$synth_items.size
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @synth_items.push(p)
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
      return valid
    else
      valid = true if $game_party.has_item?(@checking[0]) && $game_party.has_item?(@checking[1])
    end
    return valid
  end
end
 
#===============================================================================
# ** Window_SynthReq
#-------------------------------------------------------------------------------
#  This window shows the required items needed for synthesis.
#===============================================================================
class Window_SynthReq < Window_Base
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize (x, y, index)
    super(x, y, 304, 152)
    @req = []
    @lacking = false
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #     req_item_index : Required item number
  #-----------------------------------------------------------------------------
  def update(req_item_index)
    get_required_item(req_item_index)
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, WLH, SYNTH_REQUIREMENTS)
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    if @req != nil
      self.contents.font.color = normal_color
      req_x = 0
      req_y = WLH
      for i in 0...2
        if @req[0] == @req[1]
          enabled = $game_party.item_number(@req[i]) >= i + 1
        else
          enabled = $game_party.has_item?(@req[i])
        end
        draw_item_name(@req[i], req_x, req_y, enabled)
        req_y += WLH
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Get Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def get_required_item(item_index)
    @req.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @req.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @req.push(p)
    @lacking = true
    if @req[0] == @req[1]
      @lacking = false if $game_party.item_number(@req[0]) >= 2
      return
    else
      @lacking = true if $game_party.has_item?(@req[0]) && $game_party.has_item?(@req[1])
    end
  end
end
zum Lesen den Text mit der Maus markieren


Das hier sollte stimmen. :D
  • :cake: So lasset uns beginnen! :new:

    • Ein Abenteuer, wie du es noch nie erlebt hast!
      Tauche ein in die wunderbare Welt des Königs und erlebe auf deiner Reise die verrücktesten Dinge!
      NICHT MEHR LANGE! :navigation-right: Hier gibt es weitere Informationen! :navigation-left:
    • Jetzt die Demo herunterladen!
      Bild
      Euch erwartet eine Welt, wie sie nur ein exzentrischer König veralbern könnte...
    • Titelbild
      Bild
  • :fires: XBOX 360 Bild

    Bild
  • :new: Avatar im Großformat

    Bild

6

Samstag, 27. Juli 2013, 11:15

Funktioniert! Ich danke dir!
Wäre es auch möglich einen Festpreis pro Craft anzulegen? Zum Beispiel 10G pro Crafting?

Motto: So lasset uns kein Trübsal sinnieren und gar königlich dinieren!

  • Nachricht senden

7

Samstag, 27. Juli 2013, 13:17

Alle Craftings mit demselben Festpreis?
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
#-------------------------------------------------------------------------------
# Synthesis Shop v1.1
# by: Cylindrical
# May 24, 2010
#-------------------------------------------------------------------------------
# Aliases:
#   None
# Overwrites:
#   None
# Compatible with:
#   Most KGC scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
#   Most Yanfly scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
# Not Compatible with:
#   Probably no incompatibilities
#-------------------------------------------------------------------------------
# Version History
# v1.1 - The Requirements window now properly works.
#         * It grays out the item that you don't have.
#         * Many thanks to RPGI for this.
#      - Removed Game_Party#has_item? rewrite
#         * Replaced with a better one.
#         * Thanks again to RPGI.
# v1.0 - Initial release
#         * BUG: The Requirements window does not gray out an item if the
#                resulting item needs two of the same type of item and you have
#                only one. (Fixed on v1.1)
#-------------------------------------------------------------------------------
# What is it?
#   This script copies Final Fantasy IX's Synth Shops where the player is
# allowed to create new items using different materials.
#
# How to use
#   Place above Main. Before you open the synthesize shop, you need to define 
# the shop items. In the SETUP part, you can create arrays to add in your shop. 
# This is the format:
# 
#            Result Item       Requirement 1     Requirement 2
# NAME = [ ["<type>", <id>], ["<type>", <id>], ["<type>", <id>] ]
#
# where: NAME is what you call it. Should be relevant but unique. Must be ALLCAPS
#        <type> is either "WEAPON", "ARMOR", or "ITEM"
#        <id> is the item ID
#
#   Then, using $synth_items, put in the items you want to synth. It can be as
# many as you like.
#
#   $synth_items = [NAME1, NAME2, ... , NAMEn]
#
#   To open the shop window, use the 'Script' command in an event and put it
# this piece of code:
#
#    $scene = Scene_SynthShop.new
#
# Notes
#  * Make sure you fill in $synth_items first before opening the shop.
#  * You MUST GIVE ME CREDIT if you used this in your game.
#  * Free to use for commercial games, as long as you give credit to me.
#  * This is my first script so don't expect too much glamore. I still
#    consider myself a beginner.
#-------------------------------------------------------------------------------
# Special Thanks
#   Raukue for his KGCYanflyPLUS Base Demo
#   RPGI for his help with Window_SynthReq and check_required_item
#-------------------------------------------------------------------------------
# Bugs (v1.1)
#  * None. I hope it stays that way.
#-------------------------------------------------------------------------------
# FAQs
# Q: Can I make it require three ingredients?
# A: No, as of late. But I might do some updates.
#
# Q: How do I set up cost?
# A: The synthesis cost is equal to the item price of the resulting item.
#
# Q: Will this be compatible with <insert script here>?
# A: Most likely, yes since this script uses its own class/methods/functions.
#    With some tests, I find this one compatible with MOST commonly used scripts.
#    I tried this script with a script pack compiled by Raukue. It's called
#    'KGCYanflyPLUS Base'. It has many KGC and Yanfly scripts. I tested it there
#    and no errors were found. Phew! :)
#
# Q: What do you mean by 'relevant but unique' up there?
# A: It means you have to make a unique name for that item and make it so that
#    you can easily tell what it is. You can't use spaces and no repetition of
#    names. As much as possible, make it short.
#    Example:
#       GOOD                BAD
#    MAGIC_HAMMER     MAGIC HAMMER <- No spaces.
#    CYL_MAGHAMMER    SYNTH_ITEM1  <- No sense at all.
#    DEATHSCYTHE      A or X or D  <- AVOID this.
#    BIGBOMB_1        SUPER_ULTRA_HYPER_ETERNAL_MAGIC_BELL <- No comment.
#
#    So basically, make it 'unique' and 'relevant'.
#
# Q: I want more items to be synthesized but the Script Dialog in the Event
#    Editor can't hold too much letters. What should I do?
# A: You can make two arrays and combine them, like this:
#    Example:
#      $synth_items = [KATANA, MORNING_STAR] <- Assuming you can't type anymore.
#    Use the Script command again and do the same except that you need to add
#    a plus sign (+) before the equal sign (=). Like this:
#      $synth_items += [MANI_KATTI, TIGER_RACKET, EXCALIBUR_2]
#    
#    Another way is to place the whole array into another variable, like this.
#    This technique is good if you have several shops that offers the same items.
#      LINDBLUM_SYNTH_SHOP = [KATANA, MORNING_STAR, MANI_KATTI, TIGER_RACKET,
#                             EXCALIBUR_2]
#      $synth_items = LINDBLUM_SYNTH_SHOP
#
# Q: Can we trust you? You said you're a beginner.
# A: If you're a user that doesn't mind dirty codes, you can. This script works.
#    If you're a scripter who doesn't like dirty codes, I don't know. It's really
#    messy, if you know what I mean...
#-------------------------------------------------------------------------------
 
#-------------------------------------------------------------------------------
# SETUP START
#-------------------------------------------------------------------------------
 
  # Welcome Message
  SYNTH_WELCOME = "Welcome! What can I do for you?"
 
  # Replace 'Synthesize' with this.
  SYNTH_COMMAND = "Synthesize"
 
  # Replace 'Requirements' with this.
  SYNTH_REQUIREMENTS = "Requirements"
 
  # Synth-able Items Database - Follow the format. Spaces doesn't really matter.
  #                             The numbers here MUST exist in the database.
#                      Result         Material 1     Material 2
#      NAME           TYPE     ID     TYPE      ID    TYPE     ID
  BASTARD_SWORD = [ ["WEAPON", 10], ["WEAPON",  2], ["WEAPON", 6] ]
  FLAME_SHIELD  = [ ["ARMOR",   3], ["ARMOR",   1], ["ITEM",  15] ]
  FULL_POTION   = [ ["ITEM",    3], ["ITEM",    2], ["ITEM",   2] ]
  DRAGON_SWORD  = [ ["WEAPON", 29], ["WEAPON", 10], ["ARMOR", 29] ]
  LIFE_RING     = [ ["ARMOR",  29], ["ARMOR",  10], ["ITEM",   3] ]
  DRAGON_MAIL   = [ ["ARMOR",  22], ["ARMOR",   3], ["ARMOR",  3] ]
  FLAME_SCROLL  = [ ["ITEM",   16], ["ITEM",    2], ["ITEM",  15] ]
 
  # Common Shops - If you want to use a shop over and over again, you might
  #                want to use this. Define the synth-able items above and
  #                place them here. This is the format:
  #                       NAME = [ITEM1, ITEM2, ..., ITEMn]
  #                NAME must be ALLCAPS
  #                ITEMs must match with those above. If you put something that
  #                does not match with even one of those above, you'll get an error.
  #                Check the Whitesmith to see how to use this array.
  TEST_MAP_SYNTH_SHOP = [BASTARD_SWORD, FLAME_SHIELD, FLAME_SCROLL, FULL_POTION,
                         LIFE_RING, DRAGON_SWORD, DRAGON_MAIL]
 
  PRICE = 10
 
  # If you use Common Shops, create a list by doing this:
  #             $synth_items = TEST_MAP_SYNTH_SHOP
  # If not, do this:
  #             $synth_items = [BASTARD_SWORD, FLAME_SHIELD, ETC]
  #                            ^(Notice the square brackets)
 
 
#-------------------------------------------------------------------------------
# SETUP END - Do not touch anything beyond this point unless you know what you
#             are doing.
#-------------------------------------------------------------------------------
 
#===============================================================================
# ** Scene_SynthShop
#-------------------------------------------------------------------------------
#  This class performs the synthesis shop processing.
#===============================================================================
class Scene_SynthShop < Scene_Base
  #-----------------------------------------------------------------------------
  # * Start Processing
  #-----------------------------------------------------------------------------
  def start
    super
    @synth_items = []
    @item_index = 0
    @sold_item = nil
    @checking = []
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @synth_window = Window_Synth.new(0, 112)
    @synth_window.active = false
    @synth_window.visible = false
    @status_window = Window_ShopStatus.new(304, 112)
    @status_window.visible = false
    @requirements_window = Window_SynthReq.new(0, 264, @item_index)
    @requirements_window.visible = false
    @synth_window.index = 0
    @help_window.set_text(SYNTH_WELCOME)
  end
  #-----------------------------------------------------------------------------
  # * Terminate Process
  #-----------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
    @help_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @synth_window.dispose
    @status_window.dispose
    @requirements_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #-----------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @synth_window.update
    @status_window.update
    @requirements_window.update(@item_index)
    @gold_window.update
    if @command_window.active
      update_command_selection
    elsif @synth_window.active
      update_synth_selection
    end
    update_help
  end
  #-----------------------------------------------------------------------------
  # * Create Command Window
  #-----------------------------------------------------------------------------
  def create_command_window
    s1 = SYNTH_COMMAND
    s2 = Vocab::ShopCancel
    @command_window = Window_Command.new(384, [s1, s2], 3)
    @command_window.y = 56
  end
  #-----------------------------------------------------------------------------
  # * Dispose Command Window
  #-----------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #-----------------------------------------------------------------------------
  # * Update Command Selection
  #-----------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 # Synth
        Sound.play_decision
        @command_window.active = false
        @dummy_window.visible = false
        @synth_window.active = true
        @synth_window.visible = true
        @synth_window.refresh
        @status_window.visible = true
        @requirements_window.visible = true
        @synth_window.index = 0
      when 1
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Synthesize Selection
  #-----------------------------------------------------------------------------
  def update_synth_selection
    @status_window.item = @synth_window.item
    @item = @synth_window.item
    update_help
    @requirements_window.update_price(PRICE)
    if Input.trigger?(Input::DOWN) or Input::trigger?(Input::UP)
      @item_index = @synth_window.index
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @item = nil
      @command_window.active = true
      @dummy_window.visible = true
      @synth_window.active = false
      @synth_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text(SYNTH_WELCOME)
      @requirements_window.visible = false
      return
    end
    if Input.trigger?(Input::C)
      e = check_required_item(@synth_window.index)
      number = $game_party.item_number(@item)
      if @item == nil or PRICE > $game_party.gold or number == 99 or !e
        Sound.play_buzzer
      else
        idx = @synth_window.index
        get_result_item(@synth_window.index)
        $game_party.lose_item(@checking[0], 1)
        $game_party.lose_item(@checking[1], 1)
        $game_party.gain_item(@sold_item, 1)
        $game_party.lose_gold(PRICE)
        Sound.play_shop
        @gold_window.refresh
        @status_window.refresh
        @synth_window.refresh
        @synth_window.index = idx
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Index of item selected
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
    else
      valid = true if $game_party.has_item?(@checking[0]) and $game_party.has_item?(@checking[1]) and @checking[0] != @checking[1]
    end
    return valid
  end
  #-----------------------------------------------------------------------------
  # * Get Resulting Item
  #     i : Item index
  #-----------------------------------------------------------------------------
  def get_result_item(i)
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @sold_item = p
    end
  #-----------------------------------------------------------------------------
  # * Update Help Window
  #-----------------------------------------------------------------------------
  def update_help
    @help_window.set_text(@item == nil ? SYNTH_WELCOME : @item.description)
  end
 
end
 
#===============================================================================
# ** Window_Synth
#-------------------------------------------------------------------------------
#  This window shows the synth-able items defined by $synth_items.
#===============================================================================
class Window_Synth < Window_Selectable
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 304, 152)
    @checking = []
    @synth_items = []
    refresh
    self.index = 0
  end
  #-----------------------------------------------------------------------------
  # * Get Item
  #-----------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    @data = []
    @synth_items.clear
    get_result_item
    for x in 0...@synth_items.size
      item = @synth_items[x]
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      e = check_required_item(i)
      draw_item(i, e)
    end
  end
  #-----------------------------------------------------------------------------
  # * Draw Item
  #     index : Item number
  #     valid : enabled or disabled?
  #-----------------------------------------------------------------------------
  def draw_item(index, valid)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (PRICE <= $game_party.gold and number < 99 and valid)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
  end
  #-----------------------------------------------------------------------------
  # * Get Result Item
  #-----------------------------------------------------------------------------
  def get_result_item
    for i in 0...$synth_items.size
      base = $synth_items[i]
      sub = base[0]
      case sub[0]
      when "ITEM"
        p = $data_items[sub[1]]
      when "WEAPON"
        p = $data_weapons[sub[1]]
      when "ARMOR"
        p = $data_armors[sub[1]]
      end
      @synth_items.push(p)
    end
  end
  #-----------------------------------------------------------------------------
  # * Check Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def check_required_item(item_index)
    @checking.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @checking.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @checking.push(p)
    valid = false
    if @checking[0] == @checking[1]
      valid = true if $game_party.item_number(@checking[0]) >= 2
      return valid
    else
      valid = true if $game_party.has_item?(@checking[0]) && $game_party.has_item?(@checking[1])
    end
    return valid
  end
end
 
#===============================================================================
# ** Window_SynthReq
#-------------------------------------------------------------------------------
#  This window shows the required items needed for synthesis.
#===============================================================================
class Window_SynthReq < Window_Base
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize (x, y, index)
    super(x, y, 304, 152)
    @req = []
    @lacking = false
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Frame Update
  #     req_item_index : Required item number
  #-----------------------------------------------------------------------------
  def update(req_item_index)
    get_required_item(req_item_index)
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Price Update
  #     item_price : Item price
  #-----------------------------------------------------------------------------
  def update_price(item_price)
    @price = PRICE
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, WLH, SYNTH_REQUIREMENTS)
    self.contents.font.color = normal_color
    self.contents.draw_text(120, WLH * 4, 120, WLH, @price.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(120, WLH * 4, 140, WLH, Vocab.gold, 2)
    if @req != nil
      self.contents.font.color = normal_color
      req_x = 0
      req_y = WLH
      for i in 0...2
        if @req[0] == @req[1]
          enabled = $game_party.item_number(@req[i]) >= i + 1
        else
          enabled = $game_party.has_item?(@req[i])
        end
        draw_item_name(@req[i], req_x, req_y, enabled)
        req_y += WLH
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Get Required Item
  #     item_index : Item number
  #-----------------------------------------------------------------------------
  def get_required_item(item_index)
    @req.clear
    @index = item_index
    base = $synth_items[@index]
    sub1 = base[1]
    sub2 = base[2]
    case sub1[0]
    when "ITEM"
      p = $data_items[sub1[1]]
    when "WEAPON"
      p = $data_weapons[sub1[1]]
    when "ARMOR"
      p = $data_armors[sub1[1]]
    end
    @req.push(p)
    case sub2[0]
    when "ITEM"
      p = $data_items[sub2[1]]
    when "WEAPON"
      p = $data_weapons[sub2[1]]
    when "ARMOR"
      p = $data_armors[sub2[1]]
    end
    @req.push(p)
    @lacking = true
    if @req[0] == @req[1]
      @lacking = false if $game_party.item_number(@req[0]) >= 2
      return
    else
      @lacking = true if $game_party.has_item?(@req[0]) && $game_party.has_item?(@req[1])
    end
  end
end
zum Lesen den Text mit der Maus markieren


Du kannst den Festpreis oben unter PRICE ändern. :D
  • :cake: So lasset uns beginnen! :new:

    • Ein Abenteuer, wie du es noch nie erlebt hast!
      Tauche ein in die wunderbare Welt des Königs und erlebe auf deiner Reise die verrücktesten Dinge!
      NICHT MEHR LANGE! :navigation-right: Hier gibt es weitere Informationen! :navigation-left:
    • Jetzt die Demo herunterladen!
      Bild
      Euch erwartet eine Welt, wie sie nur ein exzentrischer König veralbern könnte...
    • Titelbild
      Bild
  • :fires: XBOX 360 Bild

    Bild
  • :new: Avatar im Großformat

    Bild

8

Samstag, 27. Juli 2013, 22:35

Du bist ein Gott! :D Vielen, vielen Dank!

9

Mittwoch, 27. November 2013, 13:27

Aber es geht um das Erwirtschaften von Geld, ergo muss das, was man gecraftet hat, auch verkaufbar sein.
Es bringt aber nichts, wenn ich 400 Gold investiere um nur 200 Gold beim Händler zu bekommen =/
GuL

Bex

Seher

Motto: Lets have some Fun.

  • Nachricht senden

10

Mittwoch, 27. November 2013, 17:19

Deine Frage ist die des Themenerstellers, jene wurde im Thread gelöst.
:cookie:

Edit: Willkommen im Forum. Wenn du noch Fragen zu diesem Thema haben solltest, nur raus damit.
Aber nach Möglichkeit ausführlich erklärt.

Social Bookmarks