Weapon/Armor Randomization

doesn't work for me.

before (mdf, "difesa magica"):

http://imgur.com/Qa3fLTO

after:

http://imgur.com/zlh8Ylj

http://imgur.com/giyxVST
What are the base stats of that equip?


And what config did you use for the affixes?


If you are using :SmdfP or :mdfP on an equip which got very low amount of base mdf, like 1, 2, 5, etc, you won't see any difference.


Those settings use the item's base value to determine the amount of bonus gotten.


So, a setup like ':mdfP => 20' will not increase anything on items with 1, 2, etc base mdf value, because 1*20% = 0.2, or 2*20% = 0.4, and that gets rounded to the nearest integer value at the end of stat calculation, which is 0.


If this is the case, than it is normal that you can't see any increase.


Try it with other affixes with higher values set for them. If those won't show changes, than it is indeed a script conflict, but not with Yanfly's Equip Engine. It works for me, so it should work for you too, right? 😛


Also if you want the equip to give bonus related to the actor's stats and not weapon stats, you will need to use the ':features => [[21,param_id,value]]' setup for your affixes, not the '😛aramP' or :SparamP' settings.
yeah, with features will work.

I'll make my genius  works and see what can i take out from this,

Thank you.
Is there anyway to use the critical hit damage bonus and element damage bonus of Victor Engine Critical Hit Effects and Element Strengthen, as affixes?
There is a way, but it requires the addition of the code for them in this script.


If you give me a link to those scripts (direct links if possible 😛 ), I can make it for you.
Critical Hit Effects
https://docs.google.com/file/d/0B5uvwXLAev89UkxNTl9KVVE3dlk/edit
 
Element Strengthen
https://docs.google.com/file/d/0B5uvwXLAev89T1QtM2VTSUxBYVU/edit
Ok, here is the stuff for the critical effects:

Spoiler
class Game_Party alias sixth_enchant_affix1333 add_affix def add_affix(item, id, prefix) affix = AFFIXES[id.to_i] @extra_note = "" if !affix[:cri_dmg].nil? @extra_note += "<critical damage: #{affix[:cri_dmg]}%>" end if !affix[:cri_def].nil? @extra_note += "<critical defense: #{affix[:cri_def]}%>" end if !affix[:cri_state_add].nil? #id #chance @extra_note += "<critical state add: #{affix[:cri_state_add][0]}, #{affix[:cri_state_add][1]}%>" end if !affix[:cri_state_rem].nil? @extra_note += "<critical state remove: #{affix[:cri_state_rem][0]}, #{affix[:cri_state_rem][1]}%>" end sixth_enchant_affix1333(item, id, prefix) endend
Put this below the randomizer script in it's own slot.

You will also need to edit the randomizer script for this to work.

Search for the lines starting with this:

item.note = $data_There should be 3 lines like this!Put this little piece of code at the end of each line:

+ @extra_noteThis should do the trick for the critical effects.From now on, you can use 4 more options for your affixes:

:cri_dmg => +/-value,#Example: :cri_dmg => +50,This will add/remove critical damage.Replace 'value' with the value you want to be added/removed.

The value represents percentages! So, 10 means 10%, 50 is 50%, 80 is 80%, etc.

Use + or - before the value! + will increase, - will decrease the critical damage.

:cri_def => +/-value,#Example: :cri_def => -100,Same things apply with this option.This will raise/decrease critical defense, obviously.

:cri_state_add => [state_id,chance],#Example: :cri_state_add => [2,20],This adds the critical state add effect.Honestly, I have no idea what this does, lol.

Anyway, replace the 'state_id' with the ID of the state to be added, and 'chance' with the percentage of this happening.

I could not test this, because I got no idea what this does.

But in theory, it should work fine.

:cri_state_rem => [state_id,chance],#Example: :cri_state_rem => [3,20],Same as above, except this adds the critical state remove effect.Every new option should work, because basically I injected the very same note-tags you would use normally on an item into the new item's note-tags. I had to do it this way, because Victor did not define these new stats directly on the items, instead it reads the note-tags directly when it is needed.

If something is not working, just let me know and I will try to fix this.

The last 2 thing with the state add/remove effect is not final. For now, only one state can be added/removed. No idea if it is possible to add multiple of these note-tags by default, but if it can be done, than I will modify it accordingly.

I have to go now, but when I get back, I will make you the element stuff too.
Thanks for the script. The prefixes work just fine the only thing is that as a suffix, the crit damage doesn't work if there is also a prefix on the item.
I could have sworn I asked about this previously, but I guess not. So earlier in the discussion (Jeez, almost a year ago!), I was talking about integrating this with Galv's Random Items script, though there's been a few compatibility issues. It seemed to be ironed out, though I can't remember how, until a Dropbox glitch caused most of my project files to revert to an older version, and undid whatever it was had been done to fix it.

Now, if I try to crack open a check with a randomly generated item, I get an error on line 1411 of Game_Interpreter saying "Undefined method 'equips' for nil:NilClass" which makes no sense, as it's defined numerous times in other core scripts (Unless I'm missing something).

I had it working so perfectly, a chest event that had a variable chance of giving you gold and/or 1-3 items, that would be randomly selected from items or weapons or armor, and then possibly given an affix... It was awesomely random.
If you mean Galv's Random Loot script, you can try to do this:

Find this line in Galv's script:

Code:
$game_party.gain_item(@loot[i], 1)
And replace it with this:
Code:
          if @loot[i].is_a?(RPG::Item)            item = $game_party.add_item(@loot[i].id,1)          elsif @loot[i].is_a?(RPG::Weapon)            item = $game_party.add_weapon(@loot[i].id,1)          elsif @loot[i].is_a?(RPG::Armor)            item = $game_party.add_armor(@loot[i].id,1)          end
Now, a bit further down, find this line:
Code:
$game_message.add(Random_Loot::GET_MESSAGE + @loot[i].name.to_s + Random_Loot::GET_MESSAGE_AFTER)
And replace it with this one:
Code:
$game_message.add(Random_Loot::GET_MESSAGE + item.name.to_s + Random_Loot::GET_MESSAGE_AFTER)
This should randomize the items you get and display their correct names in the message box too.
Amazingly fast response as always, Sixth. 🙂

Unfortunately, there's no change in the error with those modifications. It's gotta be with this script though, it's the script call for a random item that triggers the error.
'equips' is not referenced in Vlue's script at all, so the error comes from somewhere else.


Where and how do you call the script call? In an event? Or in a different script?


Edit:


'equips' is used in Galv's script. You meant that script call for random items? Sorry, too much randomness in this topic. 😀


Have you tried to delete and install that script again? Maybe something got deleted accidentally. It's either that or maybe you have some other scripts changing how party members or equips are handled. These are the only things which could possibly cause that error.
Sorry, I meant the error is coming from Galv's script, when I do a script call in an event to it. I guess the problem is more with that one than Vlue's work here, come to think of it.
Yeah, looking at Galv's script, it will only work with the default equip system. If you got some custom equip system, like Yanfly's, for example, and added more slots or removed some, you will most probably get the error you mentioned.

Try to replace these lines in Galv's script:

Code:
    no_equips.times { |i|        if $game_party.members[mem].equips[eqs] != nil          luck_bonus += $game_party.members[mem].equips[eqs].loot_lucky        end        if eqs < 5          eqs += 1        else          eqs = 1          mem += 1        end    }
With these:
Code:
    $game_party.members.each do |mem|      mem.equips.each do |eq|        next if eq.nil?        luck_bonus += eq.loot_lucky      end    end
This will also make it possible to use this script with custom equip systems.
See, that's the weird part. It DID work before, but the file reverting undid that, and I can't remember what we had done before to get it to work.

And yeah, using Yanfly's equip system with a few custom slots (sorry for not mentioning it), but I don't see how that would affect generating an item when it's just picked up and not equipped.

Anyway, made that change. Now it's giving me an error like this:

random item crash.png

The memory address in the error line depends on whether it's an item, weapon, or armor, but it's the same line error for Game_Interpreter. I tried disabling Ace Equip Engine with no change in the results. I moved Galv's script below Vlue's to see if that would do anything, also no change.

For reference, I've got this script, Galv's random script, Yanfly's Equip script, and the "Aftermath Fix" for Vlue's script.

Nevermind! I had WA Randomizer disabled to see if it had any effect during testing, and now Galv's is working again! Now to just figure out again how to get it to do a Sleek Item Popup instead of a message box...
The way Galv scripted the luck bonus from the equipment made his script incompatible with any custom slot scripts.


See the first code I pasted in my last post? It counts 5 equip slots for each member, no more, no less.


So, after the 5th, it jumps to the next party member.


What happens if you get more than 5 equip slots? Since it counts to 5 only and gets to the next member after, when it reaches the 6th equip, it will jump to the next member instead of checking the next equip slot. This will lead to the crash you mentioned, because sooner or later, the script will jump to a non-existent party member, who, obviously, got no equips "defined".


This is what I changed with the code in my last post. 🙂


For the Sleek Popup, you can try to add one extra line before the first $game_message.add line.

Popup_Manager.add(item,1,PU_DEFAULT_DURATION,false,0,0)Or simply replace that line with the code above.
PS: I did not test this! 😀


I did test this. 😛
Ahhhh, that makes sense. I can see how that might cause issues. All for one little extra feature, heh.

Well, everything seems to be in working order again! Woo-hoo! Thanks! Now to restore my affix drop tables for my items...

Until the next random error!
Question time again! I poked through the thread here, but didn't see anything. Would it be possible to format a call for an item to give a certain range of affixes? Essentially I'm looking to reward a boss fight with a specific quality item reward, but want the item and affixes to still be randomly selected.
So I discovered the Yanfly Battle Aftermath patch wasn't actually allowing for random items. After a brief conference with Vlue, we figured out what was causing that, and fixed the patch so that both the Aftermath script will work fully, and you'll get randomly generated weapons and armor if you desire. Here's the revised patch:

Spoiler
Code:
#===============================================================================## YEA Victory Aftermath + Vlue's W/A Randomizer Compatibility Patch##===============================================================================## This compatibility patch will let you drop and display random items on/with # Yanfly's aftermath scene.## ------------------------------------------------------------------------------## Put it below YEA Victory Aftermath and Vlue's W/A Randomizer scripts # but above Main!##===============================================================================module AM_Random   # You can enable/disable the random drops for each item types here.  Random_Items = false  # Enable/disable random item drops.  Random_Weapons = true # Enable/disable random weapon drops.  Random_Armors = true  # Enable/disable random armor drops.  end #==============================================================================# ¡ BattleManager#==============================================================================module BattleManager#--------------------------------------------------------------------------# overwrite method: self.skip_aftermath - !!UPDATED!!#--------------------------------------------------------------------------  def self.skip_aftermath    $game_party.all_members.each do |actor|      actor.gain_exp($game_troop.exp_total)    end    $game_party.gain_gold($game_troop.gold_total)    $game_troop.make_drop_items.each do |item|        if item.is_a?(RPG::Weapon) && AM_Random::Random_Weapons == true          item = $game_party.add_weapon(item.id, 1)        elsif item.is_a?(RPG::Armor) && AM_Random::Random_Armors == true          item = $game_party.add_armor(item.id, 1)        elsif item.is_a?(RPG::Item) && AM_Random::Random_Items == true          item = $game_party.add_item(item.id, 1)        else          $game_party.gain_item(item, 1)        end    end    close_windows    SceneManager.return    replay_bgm_and_bgs    battle_end(0)  end  #--------------------------------------------------------------------------  # overwrite method: self.gain_drop_items - !!UPDATED!!  #--------------------------------------------------------------------------  def self.gain_drop_items    drops = []    $game_troop.make_drop_items.each do |item|        if item.is_a?(RPG::Weapon) && AM_Random::Random_Weapons == true          item = $game_party.add_weapon(item.id, 1)        elsif item.is_a?(RPG::Armor) && AM_Random::Random_Armors == true          item = $game_party.add_armor(item.id, 1)        elsif item.is_a?(RPG::Item) && AM_Random::Random_Items == true          item = $game_party.add_item(item.id, 1)        else          $game_party.gain_item(item, 1)        end      drops.push(item)    end    SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)    set_victory_text(@victory_actor, :drops)    wait_for_message  endend
That is my snippet actually, and I got no problem with it.

If you couldn't get it to work, you did one or both of these things:

1. You did not put this patch below both related scripts.

2. You did not set 'RANDOM_ENEMY_DROPS' to true in Vlue's script.

Or Vlue updated his script, and I missed the update, but seeing that you actually removed 2 checks from my snippet and added nothing new to it, this is highly unlikely, unless Vlue changed his import tag and/or the name of the setting mentioned in the second possibility.

I added those checks because I often disable/enable scripts for debugging purposes, and the first check enabled me to quickly disable Vlue's script only without caring for any addons I made for it. Most of my patches/addons got that check. The second check is to check for the default configuration from Vlue's script for randomizing the drops or not. I forgot to mention this one in the header.

Ohh, well, the important thing is that it is working, right? 😛

Regarding the last topic about Galv's random item script, I noticed that it is possible to get randomized items of randomized items of... and so on to infinity, which result in ultra-long item names at the end and OP stats for the items. To fix this, you will need another edit in Galv's script. Because of the heavy edit we already made in that script, it is much easier to simply put up a patch for it, so here it is:

Spoiler
module GalvRandItemPatch # Enter the number of items/weapons/armors in your database here. # This is necessary if you don't want randomized items to be randomized again # with the 'random_item' script call. # Vlue's script adds new entries to the item/weapon/armor databases, and # because of that, it is possible to get a # "Sharp Fire Venomous Bow of Precision of Thunder of Silence", for example. # This does not look so good, right? MaxItems = 170 MaxArmrs = 60 MaxWeaps = 60 endclass Game_Interpreter def random_item(type, rarity_min, rarity_max, monster_id) if type >= 4 type = rand(3) + 1 end if type == 1 @loot = $data_items @lootno = GalvRandItemPatch::MaxItems elsif type == 2 @loot = $data_armors @lootno = GalvRandItemPatch::MaxArmrs else @loot = $data_weapons @lootno = GalvRandItemPatch::MaxWeaps end luck_bonus = 0 $game_party.members.each do |mem| mem.equips.each do |eq| next if eq.nil? luck_bonus += eq.loot_lucky end end no_items = @lootno rare_chance = rand(rarity_max - rarity_min) + rarity_min + luck_bonus + 1 checked = 0 random_item = rand(no_items) + 1 restart = false begin_count = 1 no_items.times { |i| i = i + random_item begin_count += 1 if restart if i > no_items i = i - i + begin_count restart = true end if @loot.loot_level_max >= $game_party.leader.level && @loot.loot_level_min <= $game_party.leader.level if @loot.loot_rarity <= rare_chance if @loot.is_a?(RPG::Item) item = $game_party.add_item(@loot.id,1) elsif @loot.is_a?(RPG::Weapon) item = $game_party.add_weapon(@loot.id,1) elsif @loot.is_a?(RPG::Armor) item = $game_party.add_armor(@loot.id,1) end RPG::SE.new(Random_Loot::SOUND_EFFECT[0], Random_Loot::SOUND_EFFECT[1], Random_Loot::SOUND_EFFECT[2]).play if $imported[:Vlue_SleekPopup] Popup_Manager.add(item,1,PU_DEFAULT_DURATION,false,0,0) else $game_message.add(Random_Loot::GET_MESSAGE + item.name.to_s + Random_Loot::GET_MESSAGE_AFTER) wait_for_message end return end end checked += 1 if checked == no_items monster_chance = rand(100) + 1 if monster_chance <= Random_Loot::MONSTER_CHANCE if Random_Loot::MONSTER_MESSAGE != "" $game_message.add("\\>" + Random_Loot::MONSTER_MESSAGE + "\\.\\.\\.\\^") wait_for_message end BattleManager.setup(monster_id, Random_Loot::ESCAPE_MONSTER, false) SceneManager.call(Scene_Battle) else $game_message.add(Random_Loot::FAIL_MESSAGE) wait_for_message end end } end end
Put this below Galv's script.

Just edit the settings in the module to match your database, and the problem will be fixed.

And the last question with the random boss drops I don't understand. It should be possible already. Just make the item in the database, add the desired affix note-tags, add the item to the enemy drop table and it's done. Right? o.o

Or am I missing something here?

Original thread: https://forums.rpgmakerweb.com/threads/weapon-armor-randomization.14771/