Drop Luck for Advance Equipment
Authors: Twb6543
Version: 1.3
Type: Drop Item Modification
Key Term: Battle Add-On
IntroductionQuoteCreative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
You are free:
to Share - to copy, distribute and transmit the work
to Remix - to adapt the work
Under the following conditions:
Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial. You may not use this work for commercial purposes.
Share alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
- For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
- Any of the above conditions can be waived if you get permission from the copyright holder.
- Nothing in this license impairs or restricts the authors moral rights.
This script was requested by JanraeMendoza...
This is a modified version allowing for easier use and also checks for all part members ... Version 1.2 should include an option to choose which members of the party the drop luck is searched for...
For an
XP AND XAS VERSION VISIT HERE
Features
- Generates A Drop luck variable that changes the probability of dropping any advance equipment
- Uses hashes and arrays for easy editing
ScreenshotsNot Needed
DemoNot Needed / Plugin, Set-up and Play
Script
#===============================================================================
# Drop Luck for Advance Equipment
# Version 1.3
# By Twb6543
# Requested by JanraeMendoza
# See http://forum.chaos-project.com/index.php/topic,9945.0.html
# for More Details
#===============================================================================
class Game_Troop < Game_Unit
attr_reader :dropluck # Not really needed as a label is used
attr_reader :DROPLUCKTYPE
attr_reader :DROPLUCKFIND
#===============================================================================
# Editable Lines
# - Line 25 to 45 -
#===============================================================================
alias :initialize_old_Drop_Luck :initialize
def initialize
initialize_old_Drop_Luck # Don't Change
dropluck = 0 # Don't Change
@@advance_equipment_item = [1, 2, 3] # array of item
@@advance_equipment_weapon = [1, 2, 3] # array of weapon
@@advance_equipment_armor = [6] # array of armour
@@armorid = { 1 => 7, 2 => 10, 3 => 10, 4 => 10 } # id => dropluckincrease
# Hash of armour ids that will improve drop luck and also their corresponding increases.
@@weaponid = { 1 => 7, 2 => 10, 3 => 10, 4 => 10 } # id => dropluckincrease
# Hash of weapon ids that will improve drop luck and also their corresponding
# increases.
@@DROPLUCKTYPE = "AE"
# o "ALWAYS" - always add drop luck ...
# o "NEVER" - never add drop luck ...
# o "AE" or Anything other that is not the top two
# - only with advance equipment ...
@@DROPLUCKFIND = "LEADER"
# o "ACTOR" => from only the actors in the array below
# (if they are in the party) ...
# o "LEADER" => from the first actor / Leader ...
# o "ALL" => from all actors...
@@Actorstocheckforequip = [1]
# Just an array of the actor ids you want the dropluck to be taken from...
# For when @@DROPLUCKFIND == "ACTOR"
end
#===============================================================================
# Do not change below this line unless you know what you are doing...
#===============================================================================
# New method for calculating drop luck
def dropluckcalc
result = 0
@@armorid.each_key do |i| # For each key (armour)
if @@DROPLUCKFIND == "ALL"
$game_party.members.each do |x|
if $game_actors[$game_party.members[x].id].armors.include?($data_armors[i]) == true
result += @@armorid[i]
end
end
elsif @@DROPLUCKFIND == "ACTOR"
@@Actorstocheckforequip.each do |x|
if $game_party.members.include?(x) == true
if $game_actors[$game_party.members[$game_party.members.index(x)].id].armors.include?($data_armors[i]) == true
result += @@armorid[i]
end
end
end
elsif @@DROPLUCKFIND == "LEADER"
if $game_actors[$game_party.members[0].id].armors.include?($data_armors[i]) == true
result += @@armorid[i]
end
else
raise "UNKNOWN STRING FOR DROPLUCKFIND, " + @@DROPLUCKFIND.to_s
end
end
@@weaponid.each_key do |i| # For each key (weapon)
if @@DROPLUCKFIND == "ALL"
$game_party.members.each do |x|
if $game_actors[$game_party.members[x].id].armors.include?($data_weapons[i]) == true
result += @@weaponid[i]
end
end
elsif @@DROPLUCKFIND == "ACTOR"
@@Actorstocheckforequip.each do |x|
if $game_party.members.include?(x) == true
if $game_actors[$game_party.members[$game_party.members.index(x)].id].armors.include?($data_weapons[i]) == true
result += @@weaponid[i]
end
end
end
elsif @@DROPLUCKFIND == "LEADER"
if $game_actors[$game_party.members[0].id].armors.include?($data_weapons[i]) == true
result += @@weaponid[i]
end
else
raise "UNKNOWN STRING FOR DROPLUCKFIND, " + DROPLUCKFIND.to_s
end
end
return result # return the result
end
alias :make_drop_items_old_Drop_Luck :make_drop_items
def make_drop_items
drop_items = [] # Make array of drops
dropluck = 0
dropluck = dropluckcalc # Calculate DropLuck
for enemy in dead_members
for di in [enemy.drop_item1, enemy.drop_item2]
include_drop_luck = false # don't include drop luck // This is so if the
# drop is not an advance equipment it uses the normal procedure of calc
# drops
if @@DROPLUCKTYPE == "ALWAYS"
include_drop_luck = true
end
if di.kind == 1 # If item
@@advance_equipment_item.each_index do |i|
if di.item_id == @@advance_equipment_item[i]
include_drop_luck = true # and item is an advance equipment then
# include drop luck
end
end
end
if di.kind == 2 # If weapon
@@advance_equipment_weapon.each_index do |i|
if di.weapon_id == @@advance_equipment_weapon[i]
include_drop_luck = true # and weapon is an advance equipment then
# include drop luck
end
end
end
if di.kind == 3 # If armour
@@advance_equipment_armor.each_index do |i|
if di.armor_id == @@advance_equipment_armor[i]
include_drop_luck = true # and armour is an advance equipment then
# include drop luck
end
end
end
if @@DROPLUCKTYPE == "NEVER"
include_drop_luck = false
end
if include_drop_luck == true
next if di.kind == 0 # Unless drop is non_existant then
denom = di.denominator-dropluck # Probability is now 1/(n-dropluck)
if denom < 1 # Sets denom to 1 if below 1
# (1 being the minimum of the maximum for rand)
denom = 1
end
next if rand(denom.to_i) != 0 # exits if rand is not 0 (this is the probability workings)
if di.kind == 1 # When drop is item
drop_items.push($data_items[di.item_id]) # adds item(item_id)
elsif di.kind == 2 # When drop is weapon
drop_items.push($data_weapons[di.weapon_id]) # adds weapon(weapon_id)
elsif di.kind == 3 # When drop is armour
drop_items.push($data_armors[di.armor_id]) # adds armour(armor_id)
end
else # Else carry out the normal procedure
next if rand(di.denominator) != 0
if di.kind == 1
drop_items.push($data_items[di.item_id])
elsif di.kind == 2
drop_items.push($data_weapons[di.weapon_id])
elsif di.kind == 3
drop_items.push($data_armors[di.armor_id])
end
end
end
end
return drop_items # Return drops
end
def addae(type,id)
if type == "ITEM" or type == 1
if @@advance_equipment_item.include?(id) == false
@@advance_equipment_item.push(id)
end
elsif type == "WEAPON" or type == 2
if @@advance_equipment_weapon.include?(id) == false
@@advance_equipment_weapon.push(id)
end
elsif type == "ARMOR" or type == 3
if @@advance_equipment_armor.include?(id) == false
@@advance_equipment_armor.push(id)
end
end
end
def removeae(type,id)
if type == "ITEM" or type == 1
if @@advance_equipment_item.include?(id) == true
@@advance_equipment_item.delete(id)
end
elsif type == "WEAPON" or type == 2
if @@advance_equipment_weapon.include?(id) == true
@@advance_equipment_weapon.delete(id)
end
elsif type == "ARMOR" or type == 3
if @@advance_equipment_armor.include?(id) == trye
@@advance_equipment_armor.delete(id)
end
end
end
def isae?(type,id)
if type == "ITEM" or type == 1
if @@advance_equipment_item.include?(id) == true
return true
else
return false
end
elsif type == "WEAPON" or type == 2
if @@advance_equipment_weapon.include?(id) == true
return true
else
return false
end
elsif type == "ARMOR" or type == 3
if @@advance_equipment_armor.include?(id) == trye
return true
else
return false
end
end
end
def adddli(type,id,val)
if type == "WEAPON" or type == 2
if @@weaponid.include?(id) == false
@@weaponid[id] = val
end
elsif type == "ARMOR" or type == 3
if @@armorid.include?(id) == false
@@armorid[id] = val
end
end
end
def removedli(type,id)
if type == "WEAPON" or type == 2
if @@weaponid.has_key?(id) == true
@@weaponid.delete(id)
end
elsif type == "ARMOR" or type == 3
if @@armorid.has_key?(id) == true
@@armorid.delete(id)
end
end
end
def isdli?(type,id,returnval)
if type == "WEAPON" or type == 2
if @@weaponid.has_key?(id) == true
return (returnval == nil ? true : @@weaponid[id])
else
return false
end
elsif type == "ARMOR" or type == 3
if @@armorid.has_key?(id) == true
return (returnval == nil ? true : @@armorid[id])
else
return false
end
end
end
end
InstructionsPlace in the materials section...
The Script runs at the end of the battle, If an enemy has the possibility to drop any Advance equipment the drop luck is subtracted from the Advance equipment denominator before the mostly normal procedure carries out.
To set Advance Equipment(AE) just add the id to the array of the correct type, e.g. AE Weapon ids in the array @@advance_equipment_weapon...
To set the drop luck increasing weapons and armours just add to the correct hash the information using this as a key "id => dropluckincrease".
Read the comments in the script, post here if any bugs or the comments don't make sense.
Compatibility This script will probably not be compatible with any script that modifies Game_Troop.make_drop_items
Credits and Thanks
- JanraeMendoza for the request and original testing
Author's NotesVersion History: // Note DL is Drop Luck and AE is Advanced Equipment...
1.3 - Added the definitions so users can add, remove and check AE and DL increasing items.
1.2 - Added more options such as choosing how you would like the DL to be calculated (Leader, certain actors all of the party).
1.1 - Release as proper script (edited for easier use)
1.0 - Original version for JanraeMendoza
0.* - Any version that was posted in the request thread before 1.0
To Add:
- Choose who's equipment is checked...- Add more options and make easier for user...
Please report any bugs here...