Weapon/Armor Randomization

Hello! I'm quite interested in a way to separate affixes by level, etc etc.

Now what I mean by this is when you actually note-tags for example:

Item: Cloths (you will have your base stats or whatever)

Note Tag:

<levels 1-10>

<affix>

<affix>

<levels 1-10>

<levels 2-20>

<affix>

<affix>

<levels 2-20>

I don't knoiw if you already have that as a thing, if you do I must have missed it, or it's a newer update. But I think this could be useful for having a very small database.
I was looking into this, could someone post an example of a notetag of a random weapon or armor?

I do understand the script but I tend to be able to progress my knowledge a lot quicker by just seeing an example 🙂
There is a demo for this script with examples, or not?

Anyway, here is an example:

<PREFIX82 30><PREFIX81 30><PREFIX84 30><PREFIX5 5><SUFFIX91 30><SUFFIX92 30><SUFFIX93 30><SUFFIX5 5>This means that the affix with an ID of 82, 81 and 84 has 30% chance to appear on the item and the affix with ID of 5 has 5% chance to appear as a prefix, while the affix with an ID of 91, 92 and 93 has 30%chance of appearing and the affix with ID of 5 has 5% chance of appearing on the item as suffix.And one for random stats only:

<HP 200><ATK% 10>This means that the item will randomly get a value added to it's base HP value between 0 and 199 and it will also get a percentage boost on the ATK stat from 0% to 9%.Hope this helps. 🙂
There is a demo for this script with examples, or not?

Anyway, here is an example:

<PREFIX82 30><PREFIX81 30><PREFIX84 30><PREFIX5 5><SUFFIX91 30><SUFFIX92 30><SUFFIX93 30><SUFFIX5 5>This means that the affix with an ID of 82, 81 and 84 has 30% chance to appear on the item and the affix with ID of 5 has 5% chance to appear as a prefix, while the affix with an ID of 91, 92 and 93 has 30%chance of appearing and the affix with ID of 5 has 5% chance of appearing on the item as suffix.And one for random stats only:

<HP 200><ATK% 10>This means that the item will randomly get a value added to it's base HP value between 0 and 199 and it will also get a percentage boost on the ATK stat from 0% to 9%.Hope this helps. 🙂
Helps a ton!

Just 1 more question, how do you allocate rarity and the stats that a rarer item brings?
Rarity only affects the color of the item.


If there are multiple affixes with a color setup, the affix with the highest rarity setup on the item will give the color of the item.


Aside from that, the rarity setting won't affect anything.


A simple rarity setup looks like this:

:rarity => 1,You can make "rarer" items by simply adding affixes for your items.
There is a name setup option for each affixes.


You can use that as an indicator of the item's rarity.


For example, you can make a weapon named "Sword" in your database.


Make some affixes with name setups like: "Rusted ", "Iron ", "Silver ", "Damascus ", and so on.


Note-tag the "Sword" with the affixes made as prefix.


Now, depending on what affix gets applied on the weapon, you will either get a:


"Rusted Sword", "Iron Sword", "Silver Sword", "Damascus Sword", and so on.


You can do the same with some suffixes on the item too if you want to make some cool names like:


"Silver Sword of the Hunter", "Iron Sword of Fire", "Damascus Sword of Mana", and so on.


And the stats for each affix, regardless if it is a prefix or a suffix, can be set up in the affix settings in the script, so the named affixes can add any stats you want.


You can also control the "rarity" (NOT the setting named ":rarity"!) of them with the affix chance, so put lower chance on rarer affixes and higher chance on more common affixes.


"Rusty Sword" can drop often, but "Silver Sword" should not be that common, right? 😛
OK it all makes sense now, but how do I get it so it displays the normal name?
Is there anyway to make this script compatible with the below?;

Putting it before the WA Rand script, the exp aftermath screen appears and the items you gain at the bottom

If you put it afterwards, the whole aftermath screen works, but it doesn't give you and randomized items
The "normal name" is the one from the database, right?

Just don't make any ' :name => "name goes here" ' setting for the affix, and it won't change the name of your item.

And yes, there is way, I made a compatibility patch for it, using YEA's Aftermath script too myself. 🙂

Few minutes and I will post it.

Ok, here is the patch for YEA Victory Aftermath:

Spoiler
#===============================================================================## 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 $imported[:Vlue_WARandom] && RANDOM_ENEMY_DROPS 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 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 $imported[:Vlue_WARandom] && RANDOM_ENEMY_DROPS 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 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
🙂
Sixth and Vlue, you are like Script Angels!

I had 2 sets of daggers and using different ones I think 

(attached is the event)

Also

with that patch, does the aftermath go above the WA Random script or below? (as with the patch)

Annnd

is it meant to display as text along the bottom rather than the item menu?

rerolling.png
The position of the Aftermath and Vlue's script does not matter relative to each other, but my patch should be below both of them.


I don't think that the check for "is XX is in inventory" works on randomized items.


It checks for the item's ID by default, but the randomized item will not have the same ID like the one from the database. Same with the "remove XX item" command.


Whenever you use Vlue's script call to add an item, the item will get the current database's size + 1 as it's ID. This means that you can not determine the ID of the desired item with the default checks.


But Vlue made a new variable for the items called "original_id", so it should be possible to remake that check to calculate the random items as well in it.


I will see if I can make it, as I will most probably need it myself too in my project.
OK, couple questions from me now, heh.

1: Is it possible to change the text color of an affix description? Basically what I'm thinking is adding description tags for every affix that lists what they do, and the affix text being a different color would help a lot with getting it to stand out. Even just matching the affix's color for the item name would be perfect.

2: For the "pool" method of selecting an affix, does adding a number after an affix increase the number of chances of that affix being selected, or is it just each entry has a single chance? With the sheer number of affixes I have, I'm finding the odds of "enchanted" gear dropping is a little higher than I intended, even with every affix's odds set to 1%.

EDIT: Actually, come to think of it, I suppose I could just make a dummy affix that does nothing and has no text or anything with higher odds.
For changing description text colors, you can use the default message code (\C[x] - replace 'x' with the color ID on your windowskin you want).


Just remember to set it back to normal color (\C[0]) at the end of each description setting you make, because if you don't, than any text in the description after the added description will use the color you changed to in the beginning of the description text setting.


I have no idea how that pool method works, sorry.


And yeah, I used one dummy affix setup for adding a boost of "normal item" chance on the items where I have a lot of affix set up too. The method works. 🙂


I managed to make a custom check for items which counts randomized items too when checking for availability. I will try to make a functional "remove item" command now.


Will post it when I'm done. 🙂
Oh yeah, I forgot about the text tag. Hoo boy, that's going to take a fair bit of work. I current have 712 affixes, heh. Guess I better get started. 😛

Got a dummy affix working, that should take care of things. Thankfully, it blends right in with the stock items, too. So it should be transparent to the user.
Hrmm, that doesn't seem to work. When I load the color command into the script lines, I get an "invalid escape character syntax" error. It's supposed to go inside the quotation marks for the description, right?

EDIT: Ahh, seems to be an issue with Ace Message System. If I make it \c instead, that error disappears, but then I get an error with the Ace script about line 440, regarding "case code.upcase". Weird. I'm not sure what direction to go in now.
Here is a correct description setup:

:sdesc => "\n\ec[3]This is a color test!\ec[0],"I just tested it and it works for me, the color is changed to green for the added line.
I don't know if this works in the default help window, I use a modified one.


Although, there should be no reason for it to not work. Try it, might work for you too.
Hey, there we go! Awesome.

Unfortunately the info window doesn't expand, so if I've got a prefix and suffix, the third line gets cut off. I guess I can set the prefixes or suffixes to the second line, but not both. Or just keep it all on one line. Otherwise working great. Now to update these descriptions...
I had 2 sets of daggers and using different ones I think 


(attached is the event)
Well, instead of making checks and such script calls, I decided to make an enchanting scene using Vlue's not so obvious methods from his randomizer script.


And to my surprise, it works, lol.


I just finished with the functions on the scene, and it is working flawlessly.


The player can select the category (item, weapon, armor), than select the item from a category, than the prefix and lastly, the suffix.


When the player confirms the action, enchanting takes place with the selected affixes.


The player can select a "Random" command too, which will randomize the item again, which was your base intention with the event you posted, right?


Enchanting needs gold, of course. Prefixes and suffixes got separate gold requirements, and the player must have the gold to select them. 😛


I could possibly add some item requirements for it too, but that is not on the top of my list for now.


Also the player can gradually add prefixes and suffixes with simple script calls during the game.


Nobody wants a "Deadly" prefix to be available from the beginning of the game, right? 😛


I am thinking about dynamically adding prefixes and suffixes to the list, so that you can have enchanter NPCs with different affixes available too.


There are many things left to code on the scene, mostly visuals and some extra checks, so it will take a few days (khm... weeks... 😀 ) until I release this addon. And now with all the Christmas hassle, I won't have much free time to code, then new year... So, I guess I won't make it before new year. 🙁


But I will try my best! 🙂


And I must thank you for giving me this idea!


This scene will allow me to make a lot of things I wanted to do in my game much, much easier! *-*
That sounds amazing Sixth 🙂

No rush on it, and have a good Christmas! I can't wait to see the finished product 🙂

I like the whole idea of being able to learn different enchantments, would make a game so much more fun, and just the amount of items it unlocks is crazy!

EDIT: I also can't thank you enough for that patch! it's made my week! 😀
i have a compatibility problem with yanfly equip engine

simply extra slot equipment doesn't get any bonus from any suffix/prefix

any suggestions? thanks
It gets the bonus, it just won't display it on the stat change when you are changing equipment.


But once you really equip the armor, the proper stats are applied with the stats from the random affixes too.


You can check it with a simple test case.


Get a randomized armor which goes into one custom slot. Check your stats before equipping it, write it down, screenshot it, etc. After equipping it, do the same. Now compare the results.


I just tested it. The only thing not working is the display of the stat gained/lost on the equip screen.


Thou, it is quite annoying for sure.


I will try to find out why it won't display the correct stats.

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