Hello everyone !
I found a plugin called "Random Equipment Prefixes & Affixes" by DreamX (found here: https://forums.rpgmakerweb.com/index.php?threads/random-item-prefixes-suffixes.57646/). The plugin is really awesome but I wonder how to make suffix or preffix giving a random amount of "x" elemental resistance. I assume you can make it with some knowledge in JS using this,
<Prefix Suffix Effect>
var atkBonus = Math.floor((Math.random() * 100) + 50);
newItem.params[2] += atkBonus;
newItem.name += " +" + atkBonus;
newItem.price += atkBonus;
</Prefix Suffix Effect>
(a example frome DreamX to add a random amount of ATK between 50 & 150 here)
kind of stuff.. but I'm really bad at it so..
Could you help me please ?
Thanks a lot in advance !
P.S: I'm French so if my English is not that good just throw me some tomato or some FROMAGE I'm fine with it !
MV - DreamX Suffix/Affix Plugin - Adding Random Elemental Resistance
● ARCHIVED · READ-ONLY
-
-
havent tried it, but give this a shot.
Code:<Prefix Suffix Effect> var randomElement = Math.randomInt($dataSystem.elements.length) //picks a random element var elementRes = 1-Math.random()/2 //creates a random element rate from 50% - 100% to apply newItem.traits.push({code: 11, dataId: randomElement, value: elementRes}) newItem.name = $dataSystem.elements[randomElement]+ " Resistant " +newItem.name; </Prefix Suffix Effect> -
Yeah I't work like a charm ! Thank you a lot !
A last question, I'm a bit idiot beceause I forgot to ask but if I wan't a precise elemental resistance to be added what I need to change?
Edit : and how can I set a Min and Max ? -
if you wanted a precise element to be resisted then you can use this
Code:and replace the x for the id number for the element. since you already know the element this will be beforehand, you can use the automatic prefix/suffix naming system to change the name<Prefix Suffix Effect> newItem.traits.push({code: 11, dataId: x, value: 1-Math.random()/2}) </Prefix Suffix Effect>
Edit:
but if you meant you wanted a precise element resistance as in, the amount of the resistance:
Code:then change the x to the value of the element rate. 1 = 100%, 0.7 = 70%, etc<Prefix Suffix Effect> var randomElement = Math.randomInt($dataSystem.elements.length) newItem.traits.push({code: 11, dataId: randomElement, value: x}) newItem.name = $dataSystem.elements[randomElement]+ " Resistant " +newItem.name; </Prefix Suffix Effect> -
Give this man some baguettes !
Thank you a lot for the help, thats work really well !
I definitly put your online name into my credits !