MZ Random Loot stats on Items

Thank you very much for that clarification ! 🙂
@jimmyshmo
I see that I am not the only one looking for the exact same thing : random stats on independant items...

I read all the post and I am glad to see that the community is great here trying to find a solution altogether :LZYgrin:, love this.
Unfortunatly, my level in JS and advanced RPGMZ is so bad, I cannot help... Its clearly above my reach...

This only thing I can say is that I tried to ask directly Visustella if their roadmap has a pluging like this incoming but unfortunatly I had no answer.
I think I read somewhere that it is not on the roadmap...

Trying to have a diablolike system seems complicated this way for the moment...

I ended up doing just like you : create manually a bunch of items to simulate this...
I am just at the very beginning of my new game with this system so I cannot give you feedback on the faisability of this but ... it should work.

Did you already make your "Loot pool" ? I am using "Extra Enemy Drops VisuStella MZ" and I don't know if it is an easy thing to do yet.
Its easy to do if the weapon only has 1 stat so for me (because I can't randomize the stats within a parameter) I have Sword 1-30. Made 30 unique swords and have they attacks range from 1-30 then make a "Loot Pool" that has a 1% chance to drop any sword from said "Loot Pool". 2 issues I'm working around is 1 Visustella Enemy drops seems to not give me an option to drop 1 item from the Loot Pool it has a x% chance to drop EVERY ITEM in the Loot Pool so be careful with percentages on the drops. If anyone finds a work around I'd love to know it.
You can just add items dynamically to the database. Here's a quick code for common items:


JavaScript:
function generateRandomItem() {
  const item = {
    id: $dataItems.length,
    animationId: 41,
    consumable: true,
    damage: {
      critical: false,
      elementId: 0,
      formula: "0",
      type: 0,
      variance: 20
    },
    description: "",
    effects: [
      {
        code: 11,
        dataId: 0,
        value1: 0,
        value2: 500
      }
    ],
    hitType: 0,
    iconIndex: 176,
    itypeId: 1,
    name: "Potion",
    note: "",
    occasion: 0,
    price: 50,
    repeats: 1,
    scope: 7,
    speed: 0,
    successRate: 100,
    tpGain: 0,
    meta: {}
  };
 
  return $dataItems.push(item) - 1;
}

Then you can script call this code to add the item `$gameParty.gainItem($dataItems[generateRandomItem()], 1)`

Add Math.random() wherever you like and create similar functions for $dataWeapons and $dataArmors. You can also look up existing items in dev tools (F12) to get effect codes etc.

You'd also need to override DataManager.makeSaveContents and DataManager.extractSaveContents to persist your item database in the save file.

(tested in MV, but it should work in MZ as well.)
You can just add items dynamically to the database. Here's a quick code for common items:


JavaScript:
function generateRandomItem() {
  const item = {
    id: $dataItems.length,
    animationId: 41,
    consumable: true,
    damage: {
      critical: false,
      elementId: 0,
      formula: "0",
      type: 0,
      variance: 20
    },
    description: "",
    effects: [
      {
        code: 11,
        dataId: 0,
        value1: 0,
        value2: 500
      }
    ],
    hitType: 0,
    iconIndex: 176,
    itypeId: 1,
    name: "Potion",
    note: "",
    occasion: 0,
    price: 50,
    repeats: 1,
    scope: 7,
    speed: 0,
    successRate: 100,
    tpGain: 0,
    meta: {}
  };
 
  return $dataItems.push(item) - 1;
}

Then you can script call this code to add the item `$gameParty.gainItem($dataItems[generateRandomItem()], 1)`

Add Math.random() wherever you like and create similar functions for $dataWeapons and $dataArmors. You can also look up existing items in dev tools (F12) to get effect codes etc.

You'd also need to override DataManager.makeSaveContents and DataManager.extractSaveContents to persist your item database in the save file.
I wish I could use that , but a lot of that seems over my head. I depend on a lot of Visustella plug ins and I'm not sure that would work or interfere with them. Overriding code seems intense. I don't want it to seem like I am unwilling to use that but I don't know how to "add that code to then be able to call it later with a script" do you mean make a plug in out of that?
All Done!

DL the below Plugin extension and place it directly under the DM_IndependentItem plugin.
LINK

To use, simply add the tag

JavaScript:
<maliiRandomParams: x, y>
with x the param number and y the max randomness amount.
(Basically, the highest the stat can be moved in either direction.)

Let me know if you have any questions.
!!!!! Can’t wait to try thank you @Maliki79
Happy to help.

One of the things that kept me from diving into MZ was the lack of Independent Items.
So yeah, I'll try to help here for sure.

Let me know if you find any issues with the plugin.
Man, this is one of the times where I wish I could share my ported version of YEP Item Core to help others, but due to terms of use I cannot share edited code...

I have working versions of YEP Item Core, YEP Equip Core, and YEP Item Upgrade Slots... between these 3 plugins all of this is covered and works perfectly fine without some of the bugs from the MV versions of the plugins.
(granted nothing I have ported has been tested with VisuStella for obvious hidden code reasons)



Why would I even bring this up, you may wonder?
Because what everyone in this thread is looking for can and does work... I just don't have the skill to write a new plugin 100% from scratch in this case without potentially risking it looking like I was code stealing due to so much time editing YEP plugins for these features to work in MZ. :/
Happy to help.

One of the things that kept me from diving into MZ was the lack of Independent Items.
So yeah, I'll try to help here for sure.

Let me know if you find any issues with the plugin.
I cannot express my gratitude enough it worked perfectly first try. I could shed a tear this just saved me soo much work. If I can buy you a coffee or something please let me know!
Man, this is one of the times where I wish I could share my ported version of YEP Item Core to help others, but due to terms of use I cannot share edited code...

I have working versions of YEP Item Core, YEP Equip Core, and YEP Item Upgrade Slots... between these 3 plugins all of this is covered and works perfectly fine without some of the bugs from the MV versions of the plugins.
(granted nothing I have ported has been tested with VisuStella for obvious hidden code reasons)



Why would I even bring this up, you may wonder?
Because what everyone in this thread is looking for can and does work... I just don't have the skill to write a new plugin 100% from scratch in this case without potentially risking it looking like I was code stealing due to so much time editing YEP plugins for these features to work in MZ. :/
I hear you.

I was working on a few YF ports for when I was going to port my game over.
(I still miss Effekseer...)
Some stuck, some didn't, but I am HORRIBLE with menu/visuals manipulation, so I kinda gave up to stick with active development of the current MV version of my project.
(Need to get that demo finished...)

I WILL move to MZ if/when I start a new game provided we don't see a new maker by then.
I cannot express my gratitude enough it worked perfectly first try. I could shed a tear this just saved me soo much work. If I can buy you a coffee or something please let me know!
If a had a coffee for every...

Happy to help!
All Done!

DL the below Plugin extension and place it directly under the DM_IndependentItem plugin.
LINK

To use, simply add the tag

JavaScript:
<maliiRandomParams: x, y>
with x the param number and y the max randomness amount.
(Basically, the highest the stat can be moved in either direction.)

Let me know if you have any questions.
WOAH! You absolute legend. So many of us have been looking for something like this in MZ for such a long time. Thank you so much.

Is there a way to configure this to only add positive values to parameters, and not subtract?
The easiest way would be to fiddle with the stats you have.

For example, if the base atk for a weapon was 20 and you only wanted it to go positive and max at 30, change the base stat to 25 and set the randomness to 5.
That way it'll still do between 20 and 30.
The easiest way would be to fiddle with the stats you have.

For example, if the base atk for a weapon was 20 and you only wanted it to go positive and max at 30, change the base stat to 25 and set the randomness to 5.
That way it'll still do between 20 and 30.
Yeah, thanks, I might try setting up something around that and see what I can figure out.

What I'd like to do is, using Independent Items and VisuStella (for item colour rarity), have something like:

Longsword
Attack 20 (+0-10)
All other stats 0

Longsword
Attack 20 (+0-10)
One other stat +1-10
All other stats 0

Longsword
Attack 20 (+0-10)
Two other stats +1-10
All other stats 0

Longsword
Attack 20 (+0-10)
Three other stats +1-10
All other stats 0

So for the attack stat, yep, starting at 25 and +/-5 would work perfectly. But for the other stats I don't think that would work? Because I'd need to set all base stats to a mid-range of what's possible rather than 0, and then there's a chance that coloured rare items are worse than the base items.

Or could I also add a fixed +number to the y modifier? Ie: <maliiRandomParams: x, y(+6)> Where if y is 5 the random stat now comes out as +1-11. Would that be possible?
I think you are making it more of an issue than it has to be.

For any of the other stats, you'd make a separate tag for that stat.
Then do like I suggested for that specific stat.
so if you want a stat to min at 0 and max at 10, make it have the stat 5 in the DB (Original stat + (max / 2)) and the random number in the tag also 5 (max / 2).

And if you want to have specific ranges for the weapons based on a rank, then simply make different versions of the weapons in your database with appropriate tags.
(The players won't know while playing.)

Now, if you insist on making the notetag itself more complicated, feel free to edit my plugin, but I provided clear and clean ways to accomplish this without the need to do make said edits.
I think you are making it more of an issue than it has to be.
...
And if you want to have specific ranges for the weapons based on a rank, then simply make different versions of the weapons in your database with appropriate tags.
(The players won't know while playing.)
Ha! Yes, you're completely right of course. That would work perfectly and I just had a brain fail 😛

Thanks for clearing that up 😀
All Done!

DL the below Plugin extension and place it directly under the DM_IndependentItem plugin.
LINK

To use, simply add the tag

JavaScript:
<maliiRandomParams: x, y>
with x the param number and y the max randomness amount.
(Basically, the highest the stat can be moved in either direction.)

Let me know if you have any questions.

OMG Thank you so much, I will try it as soon as I can !
Indeed, please find a "Virtual Coffee" by this message ! 😉

Thanks a lot again !
I think you are making it more of an issue than it has to be.

For any of the other stats, you'd make a separate tag for that stat.
Then do like I suggested for that specific stat.
so if you want a stat to min at 0 and max at 10, make it have the stat 5 in the DB (Original stat + (max / 2)) and the random number in the tag also 5 (max / 2).

And if you want to have specific ranges for the weapons based on a rank, then simply make different versions of the weapons in your database with appropriate tags.
(The players won't know while playing.)

Now, if you insist on making the notetag itself more complicated, feel free to edit my plugin, but I provided clear and clean ways to accomplish this without the need to do make said edits.
Hey Malik just doing some testing and the items seem to reroll the stats again on equip/unequip.
Thatsa no good!

I'll look into a fix.

EDIT: ANNNNND Done!
Please DL and use the updated plugin HERE. (PASTEBIN)

EDIT2: I noticed a bug. The equips roll fine except when they are set as starting equipment. The roll then happens AFTER the item is unequipped. If you make it so the PCs have to equip starting equipment, it will be fine, but otherwise, a workaround will need to be found.
I'll check as time allows.

EDIT3: NVM. I fixed it. Make sure you are using ver 1.2 of my plugin.
Thatsa no good!

I'll look into a fix.

EDIT: ANNNNND Done!
Please DL and use the updated plugin HERE. (PASTEBIN)
A god, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/random-loot-stats-on-items.174751/