Adding a new property by cubing "randomly"?

Post here about all aspects of D2 mod making whether it's information, problems or whatever. Please specify whether your post is relating to Classic D2 or the Expansion.

Moderator: Nizari

Post Reply
sebles
Posts: 6
Joined: Tue Aug 11, 2020 1:14 am
Korea South

Adding a new property by cubing "randomly"?

Post by sebles » Thu Aug 13, 2020 12:50 pm

I made a similar system to Orb of Corruption of Path of Diablo that make you cube an item to have it a new property at a time and not be recubed later.
The system works just fine but i don't know how to get a random property at a time(not 2 or 3 more properties)from the list of properties that i made in advance.
I know that there's like Mod1, Mod1 chance, Mod1 Param, Mod1 max, Mod1 min and Mod2, Mod3...
how to do like this? e.x) 25% chance of hp +10 or 25% chance of mp +10 or 25% chance of 1-4 sockets or 25% chance of being ethereal.
(just one property from them by chance, at a time)
Thank you in advance!

User avatar
Cypress
Moderator
Champion of the Light
Posts: 446
Joined: Fri Dec 01, 2017 2:08 am

Re: Adding a new property by cubing "randomly"?

Post by Cypress » Thu Aug 13, 2020 1:33 pm

You need to use a stat (which I will call corruptstat) that corresponds to each recipe. So for example:
corruptstat=1 allows you to roll for life
corruptstat=2 allows you to roll for mana
corruptstat=3 allows you to roll for stamina
Since you probably want to prevent further rolls, you'd set it so that the corruptstat increases beyond the range of useful corruptstat values after the roll. So if all of your corruptions take place within the corruptstat range of 1-255, then you would set the op restriction such that it does not function if corruptstat>255 and add 255 (or a greater number*) to each recipe.

*Be sure not to add TOO big of a number. If I remember correctly, adding anything larger than 2^15 via a cube recipe (even if the given stat can normally have a value higher than 2^15) instead causes it to overroll.

sebles
Posts: 6
Joined: Tue Aug 11, 2020 1:14 am
Korea South

Re: Adding a new property by cubing "randomly"?

Post by sebles » Thu Aug 13, 2020 2:06 pm

Cypress wrote:
Thu Aug 13, 2020 1:33 pm
You need to use a stat (which I will call corruptstat) that corresponds to each recipe. So for example:
corruptstat=1 allows you to roll for life
corruptstat=2 allows you to roll for mana
corruptstat=3 allows you to roll for stamina
Since you probably want to prevent further rolls, you'd set it so that the corruptstat increases beyond the range of useful corruptstat values after the roll. So if all of your corruptions take place within the corruptstat range of 1-255, then you would set the op restriction such that it does not function if corruptstat>255 and add 255 (or a greater number*) to each recipe.

*Be sure not to add TOO big of a number. If I remember correctly, adding anything larger than 2^15 via a cube recipe (even if the given stat can normally have a value higher than 2^15) instead causes it to overroll.
i don't really understand to be honest, so do i have to make just more recipes to solve the problem? or gotta define new stats? if so, where do you define them? Thank you, really appreciate it :)

User avatar
Cypress
Moderator
Champion of the Light
Posts: 446
Joined: Fri Dec 01, 2017 2:08 am

Re: Adding a new property by cubing "randomly"?

Post by Cypress » Thu Aug 13, 2020 2:49 pm

Yes, you need more recipes, one per possible corruption outcome, but you only need to make one stat for this to work. Corruption requires a two-step process. The first-step recipe just adds a corruptstat value to the item, which is then used by the second-step recipes to determine which specific recipe is applied.

How this works:
(1) The first-step recipe is easy, you just set the op such that it only works with corruptstat=0 and make it append a corruptstat value. So if you want 100 different possible corruption rolls, then make it so this recipe adds min=1 max=100 to corruptstat. You probably also want to make it so that the level requirement goes up so much that the player cannot use the item until the second-step recipe is used; this way the player cannot use the item until the corruption is finished.
(2) The second-step recipes have a different op for each recipe, so the first recipe can be set to require corruptstat=1, the second requires corruptstat=2... all the way up to the 100th recipe requires corruptstat=100. Since (1) gave the item a random value of corruptstat between 1 and 100, these second-step recipes will specifically choose one of these 100 recipes. And since you are only using one stat, you want to add a large number, like corruptstat +1000, to each recipe, this way you cannot roll it again (e.g. if you have a Hand Axe that rolls corruptstat=1, then roll it for its corruption recipe, it will then get corruptstat=1001; since the highest possible second-step recipe requires corruptstat=100, you will never be able to roll for corruption again on that item). If you increase the level requirement on (1), then you need this to decrease the level requirement so that it becomes usable again.

And how it works from an in-game perspective:
(1) You have a Hand Axe that you want to corrupt.
(2) You corrupt it by cubing it with a corruption orb, adding +3 to corruptstat and +100 to level requirement to the Hand Axe, and also consuming the corruption orb.
(3) You cube the item again by itself, and since it has +3 to corruptstat, it will select the recipe that corresponds to corruptstat=3 and give the respective bonus/malus, and also reduce level requirement by 100, returning it to its normal level requirement.
(4) You now have the same Hand Axe as you started with, except it now has +1003 to corruptstat and whatever the specific second-step corruption gave it.

If you haven't already, you'll probably want to set it so that the description of your corruptstat doesn't describe the exact value, since it would be kind of ugly (e.g. so instead of items saying Corrupted +1003 or Corrupted +3 or whatever, it will always just say Corrupted).

sebles
Posts: 6
Joined: Tue Aug 11, 2020 1:14 am
Korea South

Re: Adding a new property by cubing "randomly"?

Post by sebles » Thu Aug 13, 2020 3:02 pm

Cypress wrote:
Thu Aug 13, 2020 2:49 pm
...
Ah I see.. thanks for helping! have a good one!
i shoulda asked it here earlier lol

Post Reply

Return to “General Mod Making”