- Joined
- Mar 13, 2012
- Messages
- 589
- Reaction score
- 378
- 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.
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
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.
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). 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?
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
Last edited by a moderator:


Because now I have far too much time invested in it to not use it.