Weapon/Armor Randomization

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
@Allerka

Hey Vlue, this script is frigging amazing, and you will absolutely get a copy of my game for free when it's complete if I keep using it. Everything seems to be working great thus far, and I'm trying to get a vastly more extensive affix database setup.

In the meantime, though, a couple things.

1: This is more just a question of how the script the works, as far as assigning an affix. In the notes for a given weapon/armor, we throw in the tags for each affix we want to add, along with the "odds" of it. Obviously, we could add a whole bunch of affixes that add up to way higher than 100%, so how does it decide? Even if an affix has a rarity of 100 (i.e. 100% chance), it might not get picked if there's other affixes listed. Would it be best to think of it like a lottery system, and the rarity is the number of "tickets" placed in the pool the system draws from (not counting all the "nothing" tickets that might get put in, too)? I just wanna make sure I have a comprehensive grasp of how this works so I can fine-tune the rarity on prefixes properly.

2: Is there any way to make it so that weapons/armor purchased from a shop be randomized as well? I see that currently this system doesn't apply and anything purchased is stock (unless I just happened to buy 60 hand axes and NONE of them got an affix :p ). Although, this does give me an idea for a psuedo-crafting system, i.e. you talk to a blacksmith or something, give him a stock item (plus crafting materials?), and he gives you back a randomized item. Think that might be something doable?

Thanks!

EDIT: Actually, further testing has shown that the percentage-based stats boosts don't seem to be working, other than attack power. For example:

            14 => { :name => "Sturdy ",

                   :SdefP => 5,

                   :SpriceP => 10,},

Is one of my entries. The item should boost the character's DEF by 5%, correct? But if I go to the equipment screen, there's no visible change to the stats (It looks like, say, "20 -> 20" on the equipment screen). The price change takes effect, but not the stat change. Not sure if I'm doing something wrong, but since I want all my affixes to basically be percentage-based (as opposed to flat buffs/debuffs), this is fairly important, heh. Any thoughts?
Adiktuzmiko explained it pretty well, it checks each affix in order and applies the first one that passes the check. In that sort of system, if you had three prefixes in a row all with 50 for their chance, the first is 50% to apply, second is 25% to apply, third is 12.5% to apply. The reason I did that is because it was the first thing that came to mind. The pool/rating method is nice, but each would have to have a blank affix as well.

No, there isn't a way to make weapons/armors bought from the shop randomized. Or there wasn't anyways, I updated the script and it's on the pastebin right now. You should notice a new constant at the top marked WA_SHOP_RANDOM which when set to true will randomize weapons and armors bought from the shop, hopefully with 100% accuracy!

Yes and no! You're not doing anything wrong but you aren't looking at it right. All those bonuses only affect the weapon, so it boosts the item's DEF by 5% and is reflected in the final total after creation. My guess is that item you randomized has 0 def to begin with, which in that case provide a bonus of 0 def. But that doesn't mean having an affix make the players def go up by 5% is impossible! It requires using the features though (confusing things).

For example... adding

:features => [[21,3,1.05]]

to you affix would have it increase player defense by 5%.

@Adiktuzmiko

At first look, it seems like it checks for all affixes and try to apply them one by one... but it seems like once it gets 1 affix done, it stops checking the others... 

For example:

<affix1 50>

<affix2 50>

<affix3 100>

it checks for affix1 first, if it doesn't get picked it proceeds to affix2, if it doesn't get picked too it proceeds to affix3... 

so It's not the same as a lottery ticket chance...

for your problem with the bonus, since it's quite small (5% of 20 is supposedly 1), but the game might be rounding it down to 0 for some reason... try it on higher values of base defense...

@Vlue: I think it's better to let it have multiple affixes... that way you stay true to the rarity being the actual percent of having the affix... 

Else you might wanna just change it into an affix pool, where the user adds the possible affixes and their "weight"... 

ex:

<affix1 1>

<affix2 2>

So this means to add affix1 once to the pool, and affix2 twice... then you just pick a random affix from that pool... this way we know when we set-up that affix1 has a real 1/3 chance to be picked while affix2 has 2/3 chance...

but doing so, we should also be able to add a "blank" affix so that if we can have the chance of not having an affix

But as you see, working with a pool is more complicated than just allowing multiple affixes to be applied which is just removing the break command from the methods like this one:

break if add_affix(item, $~[1].to_i, false) if rand(100) < $2.to_iso it will be
Code:
add_affix(item, $~[1].to_i, false) if rand(100) < $2.to_i
Yah, that would make the rarity make more sense, but I don't like the idea of that blank affix thing. I don't like multiple affixes either! I don't need a Bronze Iron Steel Dagger of Might Magic Strength! (I know what you meant, I just wanted to say that... and I lied, I do need that). It's a bit different, but I like the current method I have set up for rarity. It might take some getting used to but when you do it's pretty easy to use.
 
Last edited by a moderator:

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
@Allerka

Adiktuzmiko explained it pretty well, it checks each affix in order and applies the first one that passes the check. In that sort of system, if you had three prefixes in a row all with 50 for their chance, the first is 50% to apply, second is 25% to apply, third is 12.5% to apply. The reason I did that is because it was the first thing that came to mind. The pool/rating method is nice, but each would have to have a blank affix as well.
I see! That makes total sense! Thanks for clarifying, I think I have a good sense of how it works now, and what I'd need to do to set "priority" on affixes (i.e. lesser enhancements being more likely to show up, etc.).  :D  

No, there isn't a way to make weapons/armors bought from the shop randomized. Or there wasn't anyways, I updated the script and it's on the pastebin right now. You should notice a new constant at the top marked WA_SHOP_RANDOM which when set to true will randomize weapons and armors bought from the shop, hopefully with 100% accuracy!
Ha ha, awesome! I'm assuming this'll apply to all shops when active? Now I'm wondering about the possibility of having "normal" shops and a "gamble" vendor like in Diablo 2. Although, ehh, I'm going to have several hundred affixes overall, so having randomly generated items anyway will probably have enough variety to stay interesting.

EDIT: Was the Pastebin updated? The link in your OP still has 1.4, from June 29th.

Yes and no! You're not doing anything wrong but you aren't looking at it right. All those bonuses only affect the weapon, so it boosts the item's DEF by 5% and is reflected in the final total after creation. My guess is that item you randomized has 0 def to begin with, which in that case provide a bonus of 0 def. But that doesn't mean having an affix make the players def go up by 5% is impossible! It requires using the features though (confusing things).For example... adding

:features => [[21,3,1.05]]

to you affix would have it increase player defense by 5%.
Ahh hah! That makes sense. I mean, I understand how it works, but the fact that it only applies to the item's stats seems a little more odd.

In any case, the features array seems to be working (although it seems to require a certain level of increase to actually kick in, so I wonder if maybe I should include a flat bonus, heh.

Alright, well, now that I know what was going wrong, back to setting up the hundreds of affixes...  BD

EDIT: So one interesting thing I've discovered is if you have an affix that alters a percentage-based stat (i.e. the EX-parameters), such as evasion, hit rate, HP/MP regen, etc., the :features array works differently. Whereas if you take an interger-based stat and give it, say, a modifier of 1.05 (i.e. +5% to that stat), the same modifier will add 105% in a percentage-based stat.

So, long story short, if you want to add/subtract to a percentage-based stat, then set your modifier to the exact amount, rather than run it as a float percentage. So, for example, adding 5% evasion, set it for 0.05. Don't forget the 0 in front of the decimal point, otherwise it'll crash!
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@Vlue - well yeah, the current system is good too and it's your preference so I can't really force the idea... but any chance you're gonna make the other one? you know, as another script, just so we have different versions of it... :)
 
Last edited by a moderator:

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
Ok, after some further work, I'm wondering about the feature which lets you set text color. Is there any way to implement any kind of priority to which affix's color gets applied (for example, a lesser enchantment's color of green being overridden by a stronger enchantment's color of blue)? Currently it seems to just go with whatever color the prefix is, so if it's an item with both a prefix and a suffix, even if the suffix is stronger, the prefix's color is what applies automatically.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
At the moment, there is no rarity or priority system. I'll look into it though.
 

ClawsofSlash

Warper
Member
Joined
Oct 29, 2013
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Hello there!  First off; Awesome script, gonna be using it.

Quick Questions:

1: Will I be able to make the additional attributes a flat bonus, as opposed to a percentage bonus?

2: Is there a way to call a specific bonus from the list for an item, allowing for specific in-game enchantments to occur?
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
Yup, as well as percentage bonuses, there's also static bonuses.

There is a way you could manually add affixes, yes.

add_affix(item,id,prefix), where item is the item from the database, id is the id of the affix, and prefix is whether or not it's a prefix or a suffix, examples:

add_affix($data_armors[2],1,true) would add the first affix as a prefix to the armor with the id of 2

add_affix($data_weapons[1],5,false) would add the fifth affix as a suffix to the weapon with the id of 5
 

ClawsofSlash

Warper
Member
Joined
Oct 29, 2013
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Sweet! Thanks.

Question!  Again...

Is there a way to change the animation for suffixes that are chosen by certain weapons?  (After all, having a sword of fire strike the same manner as a regular sword seems weird.)
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
No, but good idea. I'll look into it.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
This looks like a beautiful script.  I only wish I had stumbled across it before I spent months eventing my own weapon/armor system ;_;   Because now I have far too much time invested in it to not use it.

But you have my admiration for taking the time to design a system like this for others to use.  Few elements bring as much to an RPG as a randomized loot system.  I believe it's what made the classics like Diablo what they were.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
Thine script has been updated!!

@Vlue - well yeah, the current system is good too and it's your preference so I can't really force the idea... but any chance you're gonna make the other one? you know, as another script, just so we have different versions of it... :)
Added an option to use a Pool based rarity instead of my first-come-first-serve system.

Ok, after some further work, I'm wondering about the feature which lets you set text color. Is there any way to implement any kind of priority to which affix's color gets applied (for example, a lesser enchantment's color of green being overridden by a stronger enchantment's color of blue)? Currently it seems to just go with whatever color the prefix is, so if it's an item with both a prefix and a suffix, even if the suffix is stronger, the prefix's color is what applies automatically.
Added a rarity value, arbitrary aside from having the color from the rarest prefix/suffix being the applied color. This can be used in affixes via :rarity => value

Sweet! Thanks.

Question!  Again...

Is there a way to change the animation for suffixes that are chosen by certain weapons?  (After all, having a sword of fire strike the same manner as a regular sword seems weird.)
Added the ability to set affixes to change the animation id! Woot! This can be used in affixes via :animation => value
 

ClawsofSlash

Warper
Member
Joined
Oct 29, 2013
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Sweet!  As an artist, I appreciate you! :)
 

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
AWESOME!

So, just make sure I've got this right, for the affix rarity/priority, if I set a prefix to rarity of, say, 3, and then a suffix to a rarity of, say, 5, and an item gets both that prefix and suffix, it'll take the suffix's color?

EDIT: Nevermind, that seems to be exactly what it does. Sweet! Everything seems to be working fine, though I still don't see anything in the script relating to shop purchases.

Also, drops from enemies don't seem to be getting any affixes. I have the switch set to true in the script, but is there something special I should be doing for drops elsewhere?
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
Ah, didn't even know about that. With me, unless it causes you to double post, you should post again instead of editing your post (unless it makes it better) because I tend to not reread old posts and the board doesn't notify me of edits. Also.. that's embarassing! And hilarious. Especially since I had to play the what project did I edit that script in game. 

Well, now I've added the shop portion and actual updated the pastebin this time!

Also, there's nothing you need to do about enemy drops aside from turning that variable on. Perhaps there is another script interfering. Try placing this script below everything to see.
 

desukarhu

Veteran
Veteran
Joined
Nov 1, 2013
Messages
49
Reaction score
6
Primarily Uses
Hey Vlue,

Is there a way to stick prefixes and suffixes on item items (instead of weapons and armor)? I have a trading card mini-game and I'd love my cards to have prefixes like "Shiny" or "Flawed". If this is not possible, no biggie, I could just probably make the cards into "armor" and use a script to categorize them as items. Awesome script! <3
 
Last edited by a moderator:

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
Ah, didn't even know about that. With me, unless it causes you to double post, you should post again instead of editing your post (unless it makes it better) because I tend to not reread old posts and the board doesn't notify me of edits. Also.. that's embarassing! And hilarious. Especially since I had to play the what project did I edit that script in game. 

Well, now I've added the shop portion and actual updated the pastebin this time!

Also, there's nothing you need to do about enemy drops aside from turning that variable on. Perhaps there is another script interfering. Try placing this script below everything to see.
Ok, will do! Sorry about the confusion.
 

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
Alright, I tested it, and the issue with enemy drops appears to be from Yanfly's Victory Aftermath. If I have WA Randomization above it, it displayed the YF aftermath screen, but with no random items. If I put WA Randomization below it, I get the random items, but with the default display for it instead of the Aftermath window. I added the hotfix you posted on one of the earlier pages, but that didn't seem to change anything. Any thoughts?

Shops are working good!
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
378
First Language
English
Primarily Uses
Hey Vlue,

Is there a way to stick prefixes and suffixes on item items (instead of weapons and armor)? I have a trading card mini-game and I'd love my cards to have prefixes like "Shiny" or "Flawed". If this is not possible, no biggie, I could just probably make the cards into "armor" and use a script to categorize them as items. Awesome script! <3
Added the function $game_party.add_item(id, amount) which can randomize item's with note tags. Available tags that work with items are: :name, :color, rarity, :price, :animation

Alright, I tested it, and the issue with enemy drops appears to be from Yanfly's Victory Aftermath. If I have WA Randomization above it, it displayed the YF aftermath screen, but with no random items. If I put WA Randomization below it, I get the random items, but with the default display for it instead of the Aftermath window. I added the hotfix you posted on one of the earlier pages, but that didn't seem to change anything. Any thoughts?

Shops are working good!
Make sure the order of the scripts go: Yanfly, WA, Fix
 

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
Oh! Didn't realize I needed to put the hotfix in a separate script, I had just inserted it into the bottom of the original script. Works now! :D
 

Allerka

Veteran
Veteran
Joined
Dec 31, 2012
Messages
289
Reaction score
71
First Language
English
Primarily Uses
Ok, one last feature request from me, and this'll be a total piece of dream-cake (or dream-pie if that's your preference) for my game. Would it be possible to set it up so a script call to generate a weapon/armor picks one randomly from a list? For example, chest A is set to randomly give a weapon from the list of [1, 2, 3], and chest B is set to randomly give an armor from a list of [2, 3, 4, 5]? That, or figuring out a way to get it to work with an existing randomizer such as this one? Although I'm wondering if a random loot generator might be better served as a separate script from an affix system... You're the expert, though! Thanks!
 

Users Who Are Viewing This Thread (Users: 1, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top