Okay. So I do believe I just do not know how to get the currencies to be dropped without battle.
Like the exact code to give currency.
I was able to set up a currency shop, I was able to add a currency section into the menu screen but cannot figure out how to gain any currency.
So m new question is:
Where in these scripts does it tell me how to give a character currency? Just currency, without a battle taking place.
#==============================================================================# Currency Generator!# ----------------------------------------------------------------------------# Version: 1.0.2# Author: Kalacious (AKA: VindictivePersonality)# License: GPL 3.0# # Changes 1.0.1# ----------------------------------------------------------------------------# ---> Fixed issue with windows.# ---> Now a default part of the menu as the last option. # (see bottom of header for more info.)## Changes 1.0.2# ----------------------------------------------------------------------------# ---> Aligned text in the description window.# ---> You can now have a bit more of a discription.## Compatibillity Issues# ----------------------------------------------------------------------------# # There should be NO compatibillity issues what so ever. How ever if there are,# Please let me know.## TOS# ----------------------------------------------------------------------------# If you know the GPL version 3, you know the answer, but this still applies:## Script for RGSS 3 ONLY adds abillity to generate currencies.# Copyright (C) 2013 Kalacious (AKA VindictivePersonality)## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see <
http://www.gnu.org/licenses/>###==============================================================================## How to Use?# -----------## You have one main object for messing with currencies: $kc_currency, We will# get into what this object does and how to efectivly use it.# Lets talk about the module CURR and what thats all about:## CURR::CURR_HASH# ---------------## This hash will contain a key=>value{key=>value} type of hash (associative).# The top level key is the vocab, this is also called the currency symbol,# much like Gold's symbol is G, any key here should be the currency symbol.# # The value, contains specific keys with custom values. # That is each key inside the core value tells you more about the currency.## Lets look at this as a high level over view:## 'Currency Symbol' => {# :full_name => 'Whats the Full name?',# :icon => 0, #Icon index is?# :max => 9999, #Max value is what?# :description => 'Describe your currency in few words.',# #Example: Used for Legendary Mats.#
😮btained => 'How is this obtained, few words.',# #Example: Guild Battles.# }, #Don't forget the comma ### The next set of options you have are color options, these should be# pretty obvious as to what they do.## So lets learn what we have to use, in terms of manipulating the currencies.# This is where the $kc_currency object is going to come in handy. When this object# is created we take the hash you created below and compact it into an array# of class objects that can then be picked apart. Lets do that now:## $kc_currency Object# ---------------## $kc_currency.create ---> Dont call me, or try not to, # why create the array of class # objects again and again?## $kc_currency.currencies ---> Returns that array of currency # objects.## $kc_currency.exists?(curr_vocab) ---> Does this currency exist?### $kc_currency.currency(curr_vocab) ---> Get ONE currency object out of # the array of curencies. # # $kc_currency.increase(curr_vocab, value) ---> Increase the value of ONE currency.## $kc_currency.decrease(curr_vocab, value) ---> Decrease the value of ONE currency.## $kc_currency.set(curr_vocab, value) ---> Be careful! This will OVERIDE any# value already set and set it with# this new one.## $kc_currency.value(curr_vocab) ---> Get the value of this particular# currency.## $kc_currency.delete(curr_vocab) ---> Delete this currency from the # array of currencies based on the# name.### So we have managed to create some currencies and manipulate individaul# currencies based on the the methods we have. But what about the actuall# object? The class object that contains the values of that array? what if I# want to print the name of a specific currency?## Create_CurrencyObject# --------------------- # # There isn't anything in this class you would touch, accpet the abillity# to get information on a particular object:## curr_sym ---> The currency symbol.## full_name ---> The actual full name.## icon ---> The icon index.## max ---> The maximum value this currency can be.## description --> The SHORT description of the currency.## obtained ---> The SHORT description of how it's obtained.## So now that we have this, what if we want GC's (from the example below)# full name? Well that's easy:## $kc_currency.currency('GC').full_name #puts: Guild Currency## Now that we have created the currencies, manipulate them and pulled # individual pieces of information from the objects, based on the name# lets call the window, lets open it. How do we do that?## Opening!# --------## There are a couple of ways to do this, one is to call: call_currencies. # How ever by default what we did was enable this in the menu. This will # Display as the very LAST option in the menu.## If you are using scripts that alter or change the menu you have the added# bonus of the new method call: add_currency_command which will allow you# to place the command in the menu list.## In order for the second part to work you need to set: CURR::SHOW_IN_MENU# to false, this wills top the currency option from showing in the menu.##==============================================================================# ** CURR#------------------------------------------------------------------------------# This is your customization module where you give your new currency a name# and set it's max value.# ----------------------------------------------------------------------------#==============================================================================module CURR #-------------------------------------------------------------------------- # * Currency hash object created. The vocab here is the key, where # as the value is a hash of key=>value that defines the currency. #-------------------------------------------------------------------------- CURR_HASH = { 'AT' => { :full_name => 'Arena Tokens', :icon => 330, :max => 9999, :description => 'Arena Currency.',
😮btained => 'Arena Battles'#~ },#~ 'RT' => {#~ :full_name => 'Resource Token',#~ :icon => 278,#~ :max => 9999,#~ :description => 'Used for crafting.',#~
😮btained => 'Jobs'#~ }, #~ 'CC' => {#~ :full_name => 'Celestial Coin',#~ :icon => 526,#~ :max => 9999,#~ :description => 'Used for Celestial gear.',#~
😮btained => 'Celestial Rips' }, } COLOR_CURRENCY_NAME = 5 COLOR_CURRENCY_SYM = 5 COLOR_CURRENCY_OBTAINED = 2 COLOR_CURRENCY_DESCRIPT = 2 SHOW_IN_MENU = falseend#==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------# An interpreter for executing event commands. This class is used within the# Game_Map, Game_Troop, and Game_Event classes.#==============================================================================class Game_Interpreter #-------------------------------------------------------------------------- # * Call the currencies window. #-------------------------------------------------------------------------- def call_currencies SceneManager.call(Scene_Currencies) endend#==============================================================================# ** DataManager#------------------------------------------------------------------------------# This module manages the database and game objects. Almost all of the # global variables used by the game are initialized by this module.#==============================================================================class << DataManager #-------------------------------------------------------------------------- # * Create Game Objects. #-------------------------------------------------------------------------- alias kalacious_currency_game_objects create_game_objects def create_game_objects kalacious_currency_game_objects $kc_currency = Game_Currency.new endend#==============================================================================# ** Crate_CurrencyObject#------------------------------------------------------------------------------# Creates a new currency object based on the information passed in.#==============================================================================class Create_CurrencyObject attr_reader :curr_sym attr_reader :full_name attr_reader :icon attr_reader :max attr_reader :description attr_reader
😮btained attr_accessor :value #-------------------------------------------------------------------------- # * Create the object. #-------------------------------------------------------------------------- def initialize(curr_sym, full_name, icon, max, description, obtained, value = 0) @curr_sym = curr_sym @full_name = full_name @icon = icon @max = max @description = description @obtained = obtained @value = value endend#==============================================================================# ** Game_Currency#------------------------------------------------------------------------------# This class is designed to manipulate the currency object based on the # current currency that your looking to manipulate.#==============================================================================class Game_Currency attr_reader :currency #-------------------------------------------------------------------------- # * Create the currency object for manipulation. #-------------------------------------------------------------------------- def initialize @currencies = [] create end #-------------------------------------------------------------------------- # * Create the actuall currency object. #-------------------------------------------------------------------------- def create CURR::CURR_HASH.each do |key, value| currency = Create_CurrencyObject.new(key, value[:full_name], value[:icon], value[:max], value[:description], value[
😮btained], 0) @currencies.push(currency) end end #-------------------------------------------------------------------------- # * Return the array of currencies. #-------------------------------------------------------------------------- def currencies @currencies end #-------------------------------------------------------------------------- # * Grab one currency object based on the vocab passed in. #-------------------------------------------------------------------------- def currency(curr_vocab) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab return currency end end end end #-------------------------------------------------------------------------- # * Does said currency exist? #-------------------------------------------------------------------------- def exists?(curr_vocab) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab return true end end end end #-------------------------------------------------------------------------- # * Increase one particular currency in the list of currencies by a # value. #-------------------------------------------------------------------------- def increase(curr_vocab, value) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab currency.value = [[currency.value + value, 0].max, currency.max].min end end end end #-------------------------------------------------------------------------- # * Decrease one particular currency in the list of currencies by a # value. #-------------------------------------------------------------------------- def decrease(curr_vocab, value) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab increase(curr_vocab, -value) end end end end #-------------------------------------------------------------------------- # * Set on particular currency to a specific value. #-------------------------------------------------------------------------- def set(curr_vocab, value) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab currency.value = [[value, 0].max, currency.max].min end end end end #-------------------------------------------------------------------------- # * Get the value of curreny passed in. #-------------------------------------------------------------------------- def value(curr_vocab) if @currencies.any? @currencies.each do |currency| if currency.curr_sym == curr_vocab return currency.value end end end end #-------------------------------------------------------------------------- # * Delete a currency based on the name. #-------------------------------------------------------------------------- def delete(curr_vocab) @currencies.delete_if {|x, *_| x == curr_vocab } end end#==============================================================================# ** List_Currencies_Window#------------------------------------------------------------------------------# Creates the currencies list window.#==============================================================================class List_Currencies_Window < Window_Selectable #-------------------------------------------------------------------------- # * Create the currencies window and associated data. #-------------------------------------------------------------------------- def initialize(x, y, width, height) super @data = [] activate refresh end #-------------------------------------------------------------------------- # * Max columns. #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # * Item max. #-------------------------------------------------------------------------- def item_max @data ? @data.size : 1 end #-------------------------------------------------------------------------- # * Set the enabled state to true. #-------------------------------------------------------------------------- def enable?(item) true end #-------------------------------------------------------------------------- # * Return the item. #-------------------------------------------------------------------------- def item @data && index >= 0 ? @data[index] : nil end #-------------------------------------------------------------------------- # * Draw the item based on the index passed in. #-------------------------------------------------------------------------- def draw_item(index) currency = @data[index] if currency rect = item_rect_for_text(index) draw_icon(currency.icon, rect.x + 40, rect.y, enable?(currency)) rect.x += 24 rect.width -= 24 draw_text(rect, currency.value.to_s) end end #-------------------------------------------------------------------------- # * Grab all currencies to populate the data object. #-------------------------------------------------------------------------- def make_item_list @data = $kc_currency.currencies end #-------------------------------------------------------------------------- # * Baseic Refresh. #-------------------------------------------------------------------------- def refresh make_item_list create_contents draw_all_items end end#==============================================================================# ** Currency_Description_Window#------------------------------------------------------------------------------# Creates the currencies list window.#==============================================================================class Currency_Description_Window < Window_Base def initialize(x, y, width, height) super end #-------------------------------------------------------------------------- # * Create the window. #-------------------------------------------------------------------------- def data=(index) return if @content == index @content = index refresh end #-------------------------------------------------------------------------- # * Create new draw_text method. #-------------------------------------------------------------------------- def draw_text(x, y, text_width, text_height, text, alignment = 0) contents.draw_text(x, y, text_width, text_height, text, alignment = 0) end #-------------------------------------------------------------------------- # * Allow text to be both sized and colored. #-------------------------------------------------------------------------- def size(x, y, text_width, text_height, text, size, color = 0, alignment = 0) currentsize = self.contents.font.dup contents.font.size = size contents.font.color.set(text_color(color)) draw_text(x, y, text_width, text_height, text, alignment = 0) self.contents.font = currentsize end #-------------------------------------------------------------------------- # * Allow text to have its color changed. #-------------------------------------------------------------------------- def color(x, y, tw, th, text, color, alignement = 0) currentcolor = self.contents.font.dup contents.font.color.set(text_color(color)) draw_text(x, y, tw, th, text, alignment = 0) self.contents.font = currentcolor end #-------------------------------------------------------------------------- # * Call this method directorly when creating the window. Will draw # all the contents in the widnow based on the @content object. #-------------------------------------------------------------------------- def draw_contents refresh draw_main_title draw_currency_title draw_currency_name draw_currency_sym_title draw_currency_sym draw_obtained_title draw_obtained draw_icon_title draw_currency_icon draw_currency_description_title draw_currency_description end #-------------------------------------------------------------------------- # * Draw the main title. #-------------------------------------------------------------------------- def draw_main_title size(width/2 - 110, 0, 220, 50, "Currency Description", 40, ) size(width/2 - 130, 30, 275, 50, "Pick a currency to view information.", 18, 3) end #-------------------------------------------------------------------------- # * Draw the currency title. #-------------------------------------------------------------------------- def draw_currency_title text = "Currency: " draw_text(10, 60, text.length + 275, 50, text) end #-------------------------------------------------------------------------- # * Draw the currency name. #-------------------------------------------------------------------------- def draw_currency_name text = @content.full_name color(175, 60, text.length + 200, 50, text, CURR::COLOR_CURRENCY_NAME) end #-------------------------------------------------------------------------- # * Draw currency symbol title. #-------------------------------------------------------------------------- def draw_currency_sym_title text = "Currency Symbol: " draw_text(10, 90, text.length + 275, 50, text) end #-------------------------------------------------------------------------- # * Draw the currency symbol. #-------------------------------------------------------------------------- def draw_currency_sym text = @content.curr_sym color(190, 90, text.length + 200, 50, text, CURR::COLOR_CURRENCY_SYM) end #-------------------------------------------------------------------------- # * Draw the icon title. #-------------------------------------------------------------------------- def draw_icon_title text = "Universial Symbol: " draw_text(10, 120, text.length + 250, 50, text) end #-------------------------------------------------------------------------- # * Draw the actual icon. #-------------------------------------------------------------------------- def draw_currency_icon draw_icon(@content.icon, 175, 134) end #-------------------------------------------------------------------------- # * Draw the obtained title. #-------------------------------------------------------------------------- def draw_obtained_title text = "How To Obtain: " draw_text(20, 150, text.length + 275, 50, text) end #-------------------------------------------------------------------------- # * Draw the obtained. #-------------------------------------------------------------------------- def draw_obtained text = @content.obtained color(175, 150, text.length + 200, 50, text, CURR::COLOR_CURRENCY_OBTAINED) end #-------------------------------------------------------------------------- # * Draw the currency description title. #-------------------------------------------------------------------------- def draw_currency_description_title text = "Currency Description: " draw_text(20, 180, text.length + 375, 50, text) end #-------------------------------------------------------------------------- # * Draw the currency description. #-------------------------------------------------------------------------- def draw_currency_description text = @content.description color(40, 220, text.length + 400, 50, text, CURR::COLOR_CURRENCY_DESCRIPT) end #-------------------------------------------------------------------------- # * Typical refresh. #-------------------------------------------------------------------------- def refresh contents.clear create_contents return if @content endend#==============================================================================# ** Window_Command#------------------------------------------------------------------------------# This window deals with general command choices.#==============================================================================class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # ● Add the command #-------------------------------------------------------------------------- alias make_kc_command_window_list make_command_list def make_command_list make_kc_command_window_list if CURR::SHOW_IN_MENU add_currency_command end end #-------------------------------------------------------------------------- # ○ Add said command #-------------------------------------------------------------------------- def add_currency_command add_command("Currency", :currency_command, true) endend#==============================================================================# ** Scene_Menu#------------------------------------------------------------------------------# This class performs the menu screen processing.#==============================================================================class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● Suppose to create the currency command. #-------------------------------------------------------------------------- alias kc_create_currency_command create_command_window def create_command_window kc_create_currency_command @command_window.set_handler
🙂currency_command, method
🙂command_personal)) end #-------------------------------------------------------------------------- # ○ Suppoose to call the currency scene. #-------------------------------------------------------------------------- def command_call_currency_window SceneManager.call(Scene_Currencies) end #-------------------------------------------------------------------------- # ● Suppose to do something when you select and hit enter. #-------------------------------------------------------------------------- alias kc_on_personal_ok_currencies on_personal_ok def on_personal_ok kc_on_personal_ok_currencies if @command_window.current_symbol == :currency_command command_call_currency_window end endend#==============================================================================# ** Scene_Currencies#------------------------------------------------------------------------------# Creates a new scene that is then called via the script call. #==============================================================================class Scene_Currencies < Scene_MenuBase #-------------------------------------------------------------------------- # * Start the scene. #-------------------------------------------------------------------------- def start super create_currencies_window create_description_window end #-------------------------------------------------------------------------- # * Create the currencies window. #-------------------------------------------------------------------------- def create_currencies_window width = 100 height = Graphics.height - 100 @currency_list = List_Currencies_Window.new(60, 50, width, height) @currency_list.select(0) @currency_list.viewport = @viewport @currency_list.set_handler
🙂ok, method
🙂on_item_ok)) end #-------------------------------------------------------------------------- # * Create the desciption window. #-------------------------------------------------------------------------- def create_description_window @currency_description = Currency_Description_Window.new(@currency_list.width + 60, 50, Graphics.width - @currency_list.width - 100, Graphics.height - 100) @currency_description.draw_main_title end #-------------------------------------------------------------------------- # * When you select a currencie we will pass the object from the currency # list over to the currency window. #-------------------------------------------------------------------------- def on_item_ok @currency_description.data = @currency_list.item @currency_description.draw_contents @currency_list.activate end #-------------------------------------------------------------------------- # * Do something when we hit esc. #-------------------------------------------------------------------------- def update super if Input.trigger?
🙂 RPG::SE.new("cancel2", 100, 100).play SceneManager.goto(Scene_Menu) end endend
#==============================================================================# Drops# ----------------------------------------------------------------------------# Version: 1.0.1# Author: Kalacious (AKA: VindictivePersonality)# License: GPL 3.0## Changes 1.0.1# ----------------------------------------------------------------------------# ---> Can now enter whole numbers as percentages for item and # currency drops.## Compatibillity Issues# ----------------------------------------------------------------------------# # There should be NO compatibillity issues what so ever. How ever if there are,# Please let me know.## Requirements?# ----------------------------------------------------------------------------## ---> Any things with REQUIRED is well, required and, if missing, may cause# things to look weird or not work at all.## -- Kalacious Currency Script - to use currencies, any thing but gold. # (see below)# -- REQUIRED ->
http://himeworks.wordpress.com/2013/05/12/post-battle-events/# --> The above script belongs to Hime Works and is required to have this# work AFTER battles, which is what it's intended to do.# -- REQUIRED ->
http://rmrk.net/index.php/topic,44964.0.html# --> The above script belongs to Modern Algebra and is used to format# paragraphs, this stops me from having to do it.## ---> Note: Want to create random drops that have nothing to do with# enemies? see Tutorial 3 below! - You wont need the FIRST# REQUIRED script to do it!## TOS# ----------------------------------------------------------------------------# If you know the GPL version 3, you know the answer, but this still applies:## Script for RGSS 3 ONLY adds abillity to generate troop drops.# Copyright (C) 2013 Kalacious (AKA VindictivePersonality)## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see <
http://www.gnu.org/licenses/>###==============================================================================## How to Use?# -----------## You have one main way to customize and thats the hash, the Drops Hash.# this is where you ceate your drops either in a regular hash or a nested# hash. These Drops are then used ## DROPS:
😀ROP_HASH# ----------------# # This is the most important part of the script. This is where you set up# what are called "static" drops, drops that never change and can easily# be given to any troop. (for drops created on the fly please see below).## The goal here is to create any kind of drop, at any time, and distribute# it to the player after they have finished a battle.## The following hash example is a single drop with a single ite, lets look # at it:## DROP_HASH = {# "Drop One" => { ---> Drop Object Name - Must be unique.# :item_type => 0, ---> 0 - item, 1 - weapons, 2 - armors# :item_id => 1, ---> id of item to award# :item_drop_per => 4, ---> This item has a 4% chance to drop.# :amount => 6, ---> How many of this item?# :currency_type => "GC", ---> Curency to award. "gold" is acceptable.# :currency_gain => 25, ---> how much of this currency do you gain? # :currency_gain_per => 10 --> 10% chance to gain this currency.# },# }## Note: If you are not using my currency script - yet want to give MORE gold,# then you MUST enter "gold".## Note: All items and currencies that drop can have a percentage of# chance to drop.## Note: NODROPMESSAGE is for when their are no currenies and no items# that drop, if left as '', no message will be shown.## The above hash, will create one drop object for the player to recieve on# victory of the battle with that troop. The beauty here is that you can set# up multiple "drops" for multiple troops, each troop can have their own drop.## "Kalacious!" You exclaim - "I want MORE drops for this troop!" ok,# lets create that hash together!## "Drop Two" => [# {# :item_type => 0,# :item_id => 20,# :item_drop_per => 1,# :amount => 6,# :currency_type => "RT",# :currency_gain => 20,# :currency_gain_per => 20# },# {# :item_type => 1,# :item_id => 1,# :item_drop_per => 100,# :amount => 6,# :currency_type => "GC",# :currency_gain => 20,# :currency_gain_per => 75# }, # {# :item_type => 2,# :item_id => 1,# :item_drop_per => 10,# :amount => 6,# :currency_type => "",# :currency_gain => 0# :currency_gain_per => 45# },# ]## OMG!!! - What is that?!!! - Its a drop with three items. Notices that# You can have NO currencies in the third entry. (Also note the commas).# # This is where my currency script comes in handy, as you can see, the type# is set to that of a currency already created - YOU CANNOT - give currencies# that do not exist, and NO we wont create them for you. They must exist.## Also note, using Gold instead of my custom curencies? WE ONLY ACCEPT: "gold"# as the currency type.## With that aside we have created one drop object with three different drops# in it.one item, one weapon and one armor. YOU CANNOT have the same item and # item type for two drops. that is you cannot have, item_type => 1 with # a item_id => 1 for more then one drop in a drop object. You can have multiple# items of the same type provided they are all different. If you want to# have multiple items of the same type and id, enter in how many should be# awarded via the :amount key.## Now that we have that all sored out, we can create one drop object with# one drop or one drop object with MULTIPLE drops in it.## Ok, but what methods do we have to use to access this data?## Lets get into that!## $kc_drop Call - Calls: Troop_Drop Class# ---------------------------------------## $kc_drop.drop_object ---> Gives back an array of drops.## $kc_drop.create_new_drop(item_type, item_id, item_drop_per, amount, # currency_type, currency_gain, currency_gain_per) # ---> Ceates ONE drop (see below).# where the item and the# currency have a drop # percentage.## $kc_drop.create_new_static_drop(name) ---> Creates a drop object based# on the hashes key string name.### $kc_drop.give_items(gain_currencies = false)# ---> Give out items, displaying a# message. Do we also give out# currencies?### Ok, Kalacious - walk me through how to take the hash above, Drop Two and# at the end of a battle - give out the items and currencies.## TUTORIAL 1 - Hash Drops# ------------------------ # # So lets say you have this hash:## "Drop Two" => [# {# :item_type => 0,# :item_id => 20,# :item_drop_per => 56,# :amount => 6,# :currency_type => "RT",# :currency_gain => 20,# :currency_gain_per => 56# },# {# :item_type => 1,# :item_id => 1,# :item_drop_per => 56,# :amount => 6,# :currency_type => "GC",# :currency_gain => 20,# :currency_gain_per => 56# }, # {# :item_type => 2,# :item_id => 1,# :item_drop_per => 56,# :amount => 6,# :currency_type => "",# :currency_gain => 0,# :currency_gain_per => 56# },# ]## And you want to distribute these beauties at the end of the battle. No# problem. Using "Post-Battle Events" (posted above) we need to go into the# troop event page and create the following event:## Comment: <post battle victory># Script: $kc_drop.create_new_static_drop("Drop Two")# $kc_drop.give_items(true)## Then go run the battle, after words you get the regular rewards, then you# get the troop rewards.## TUTORIAL 2 - On the Fly Drops# ------------------------------ ## Ok...Ok....I see - crete me one on the fly!## Ok, lets say you one to give one drop. You can do this two different way,# you can create an event on the map that creates the item or you can do# it post battle, either way the script calls are the same.## Lets assume your doing it after the battle is done and over with. you # would do this:## Comment: <post battle victory># Script: $kc_drop.create_new_drop(0, 1, 20, 76, "gold", 40, 78)# $kc_drop.give_items(true)## The above will give you 20 items with the id of 1 and 40 gold.## TUTORIAL 3 - With out Battles!# -------------------------------## KALCIOUS!!!!! - I want to do this WITH OUT BATTLES. ok, so create your# drops like normal and then just call $kc_drop.give_items(true/false) in# an event....Simple.###==============================================================================# ** DROPS#------------------------------------------------------------------------------# Lets you set up a drop objects with either ONE drop or multiple. The first# one is a drop object with ONE drop, while the second object has THREE drops# in it.# ----------------------------------------------------------------------------#==============================================================================module DROPS DROP_HASH = { "Drop One" => { :item_type => 0, :item_id => 1, :amount => 6, :item_drop_per => 100, :currency_type => "GC", :currency_gain => 25, :currency_gain_per => 3 }, "Drop Two" => [ { :item_type => 0, :item_id => 20, :amount => 6, :currency_type => "AT", :currency_gain => 100 }, { :item_type => 1, :item_id => 1, :amount => 6, :currency_type => "GC", :currency_gain => 20 }, { :item_type => 2, :item_id => 1, :amount => 6, :currency_type => "", :currency_gain => 0 }, ] } NODROPMESSAGE = ''end#==============================================================================# ** DataManager#------------------------------------------------------------------------------# This module manages the database and game objects. Almost all of the # global variables used by the game are initialized by this module.#==============================================================================class << DataManager alias kalacious_troop_drop_object create_game_objects def create_game_objects kalacious_troop_drop_object $kc_drop = Troop_Drop.new endend#==============================================================================# ** Troop_Drop#------------------------------------------------------------------------------# Responsible for creating drops and distibuting the drops.#==============================================================================class Troop_Drop #-------------------------------------------------------------------------- # * Create an empty @troop_drop_object array to hold the drops for a single # drop object. #-------------------------------------------------------------------------- def initialize @troop_drop_object = [] end #-------------------------------------------------------------------------- # * Returns the drop object for inspection #-------------------------------------------------------------------------- def drop_object @troop_drop_object end #-------------------------------------------------------------------------- # * Allows you to create a drop on the fly. #-------------------------------------------------------------------------- def create_new_drop(item_type, item_id, item_drop_per, amount, currency_type, currency_gain, currency_gain_per) if @troop_drop_object.any? @troop_drop_object.each do |drop| if drop.item_type == item_type and drop.item_id == item_id return false end end end drop_object = Troop_Drop_Object.new(item_type, item_id, item_drop_per, amount, currency_type, currency_gain, currency_gain_per) @troop_drop_object.push(drop_object) end #-------------------------------------------------------------------------- # * Creates a new drop object based off the hash and the name of the # coresponding drop object. #-------------------------------------------------------------------------- def create_new_static_drop(name) drops = DROPS:
😀ROP_HASH[name] || [] drops = [drops] if !drops.is_a? Array drops.each do |drop| create_new_drop(drop[:item_type], drop[:item_id], drop[:item_drop_per], drop[:amount], drop[:currency_type], drop[:currency_gain], drop[:currency_gain_per]) end end #-------------------------------------------------------------------------- # * Gives all items and currencies (only gives currencies if set to true) # Displays a message stating that we gave you bla. #-------------------------------------------------------------------------- def give_items(gain_currencies = false) random_number = rand(100) if @troop_drop_object.any? @troop_drop_object.each do |troop| if random_number <= troop.item_drop_per case troop.item_type when 0; $game_party.gain_item($data_items[troop.item_id], troop.amount, true) when 1; $game_party.gain_item($data_weapons[troop.item_id], troop.amount, true) when 2; $game_party.gain_item($data_armors[troop.item_id], troop.amount, true) end end if gain_currencies gain_currency(troop) end end display_gain_message(gain_currencies, random_number) end end private #-------------------------------------------------------------------------- # * PRIVATE - Displays a message for the items and currencies gained. #-------------------------------------------------------------------------- def display_gain_message(gain_currencies = false, random_number) if create_item_array(random_number).empty? and create_currency_array(random_number).empty? if DROPS::NODROPMESSAGE != '' $game_message.texts.push(DROPS::NODROPMESSAGE) else return end end if create_item_array(random_number).any? $game_message.texts.push("Gained Items: ") $game_message.texts.push(create_item_array(random_number).each_slice(2).map { |top| "#{top.first} (x#{top.last})" }.join(', ') + '.') end if create_currency_array(random_number).any? if gain_currencies $game_message.texts.push("\\n\\nGained Currencies: ") $game_message.texts.push(create_currency_array(random_number).each_slice(2).map { |top| "#{top.first}: #{top.last}" }.join(', ') + '.') end end end #-------------------------------------------------------------------------- # * PRIVATE - Gains currencies, uses Currency script if we don't # enter "gold" #-------------------------------------------------------------------------- def gain_currency(single_troop_object) puts rand(100) puts single_troop_object.currency_gain_per if rand(100) <= single_troop_object.currency_gain_per if single_troop_object.currency_type != "gold" if $kc_currency.exists?(single_troop_object.currency_type) $kc_currency.increase(single_troop_object.currency_type, single_troop_object.currency_gain) end else $game_party.gain_gold(single_troop_object.currency_gain) end end end #-------------------------------------------------------------------------- # * PRIVATE - Creates an item array of all items and their amount. #-------------------------------------------------------------------------- def create_item_array(random_number) items = [] @troop_drop_object.each do |troop| if random_number <= troop.item_drop_per items.push(troop.item.name) items.push(troop.amount) end end items end #-------------------------------------------------------------------------- # * PRIVATE - Creates an array of all currencies and the amount gained. #-------------------------------------------------------------------------- def create_currency_array(random_number) currency = [] @troop_drop_object.each do |troop| if troop.currency_gain != 0 and troop.currency_type != "" if random_number <= troop.currency_gain_per currency.push(troop.currency_type) currency.push(troop.currency_gain) end end end currency endend#==============================================================================# ** Troop_Drop_Object#------------------------------------------------------------------------------# responsible for creating drop objects for troops.#==============================================================================class Troop_Drop_Object attr_reader :item_type attr_reader :item_id attr_reader :item_drop_per attr_reader :amount attr_reader :currency_type attr_reader :currency_gain attr_reader :currency_gain_per #-------------------------------------------------------------------------- # * Create te actual object based on whats passed in. #-------------------------------------------------------------------------- def initialize(item_type, item_id, item_drop_per, amount, currency_type, currency_gain, currency_gain_per) @item_type = item_type @item_id = item_id @item_drop_per = item_drop_per @amount = amount @currency_type = currency_type @currency_gain = currency_gain @currency_gain_per = currency_gain_per end #-------------------------------------------------------------------------- # * Store the actual item, access it with drop_object.item.RPG:
😮BJ_NAME # Example: drop_object.item.name #=> name of item/weapon or armor #-------------------------------------------------------------------------- def item case item_type when 0 item = $data_items[item_id] when 1 item = $data_weapons[item_id] when 2 item = $data_armors[item_id] end end end
I am sorry in advance, it is a lot to read through for anyone who will bother to help me.
Edit: Okay, all I had to do was write
$kc_drop.create_new_drop(0, 1, 20, 76, "AT, 40, 78)
$Kc_drop.give_items(true)
Just needed to not be so sleep deprived.