Creare Videogiochi - Game Developer
[SCRIPT] Swapped Items - Versione stampabile

+- Creare Videogiochi - Game Developer (https://www.making-videogames.net/giochi)
+-- Forum: Rpg Maker Italia (https://www.making-videogames.net/giochi/Forum-Rpg-Maker-Italia)
+--- Forum: Rpg Maker Vx (https://www.making-videogames.net/giochi/Forum-Rpg-Maker-Vx)
+---- Forum: Script Rpg Maker Vx (https://www.making-videogames.net/giochi/Forum-Script-Rpg-Maker-Vx)
+---- Discussione: [SCRIPT] Swapped Items (/thread-SCRIPT-Swapped-Items)



[SCRIPT] Swapped Items - Johnny 97 - 04-01-2012

DESCRIZIONE:
Grazie a questo script, si potrĂ  ottenere un nuovo oggetto quando se ne usa uno. (Ad esempio come in Zelda: quando bevi una pozione, ottieni una bottiglia vuota.)

AUTORE/I:
ASCIIgod

ISTRUZIONI:
Istruzioni nello script (sono in inglese, quando ho tempo le traduco)

SCRIPT:
[SPOILER]
Codice:
################################################################
#
###############
#                                                                              #
#                                                                              #
#           ASCIIgod's consumed item swapping script(let)                      #
#                           Ver.0.1                                            #
################################################################################
#                                                                              #
# this script(let) allows you to have an item that swaps or pherhaps i should  #
# say, changes upon consming. This script(let) has a little equallity to the   #
# system the zelda games uses. like for example, link got a bottle that has    #
# nothing in it. so we buy a potion or pherhaps caught a fairy. instead of     #
# using the tradfitional and tedios 'common event' i cam up a solution.        #
# so instead of the item disappearing it will rather evolve to a new one. like #
# drinking a bottle of potion, instead of throwing away the bottle the heroes  #
# can recycle it to reduce waste but thats out of the scripts capabilities ^V^ #
################################################################################
#                                                                              #
# note that i did it under a default clean project so it might not compatible  #
# with scripts that changes the scene_item itself like the grid inventory from #
# modern algebra or the tem weight script(which i dont know the name of the    #
# author).... so im going to make the compatible soon.... also note that the   #
# substitution process take place AFTER the item is consumed(in and out)       #
# of battle. so you must check your inventory again to see what item changes   #
################################################################################
#                                                                              #
# instruction: just jam all the item ids in the has under the module of the one#
# you want to have a substitutional item. then next to the => command is the   #
# item that will substitute after the item is consumed.... thats just easy.... #
################################################################################
#                                                                              #
# final note: i tested it nad it works but. the second time you're gonna get   #
# subtitution item you may notice it does count well the fix for that is simply#
# get out of the item screen and return. the addition will now be applied. i'll#
# fix it sometime. sorry.                                                      #
################################################################################
module ASCII
  module ITEM_SWAP
    
    #put the item id you want to have a subtitute upon consuming
    
    ITEM_SWAPPING =
    {
      # item_id => swap_id
      1 => 2,
      3 => 2,
    }
    
  end
end

# be warned that editing below here needs a lv20+ scripter to survive or else,
# you may suffer from under level sickness and easily be pawned by the lvl50 programming
# porings and lose all your HP in one try ^v^..... you've been warned.

class Game_Party < Game_Unit
  
  def consume_item(item)
    if item.is_a?(RPG::Item) and item.consumable
      lose_item(item, 1)
      swap = ASCII::ITEM_SWAP::ITEM_SWAPPING[item.id]
      gain_item($data_items[swap], 1)
    end
  end
  
end
[/SPOILER]



BUG E CONFLITTI NOTI:
Nessuno