RMMV Help with Yanfly Plugins

Knife77

Warper
Member
Joined
Dec 2, 2020
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello,
I am using both http://www.yanfly.moe/wiki/Attachable_Augments_(YEP) and http://www.yanfly.moe/wiki/Item_Core_(YEP) Plugins.

My goal is pretty simple, I want to make attachable augment items have a random value, not all the same value.

Item core will allow items to have different values, but I am struggling to get the augments to have their own values.

This is what I have tried currently, I know it is wrong.


<On Creation Eval>

<Augment: Wood>

AGI: Math.floor(Math.Random() * 10);

</Augment: Wood>

</On Creation Eval>

My goal is to make it so when ever the player gets this item, the augment will give a random value. In this example its between 0 and 9. Please help. Thank you
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
835
Reaction score
526
First Language
English
Primarily Uses
RMMV
The problem here is that note tags like these cannot be nested, as they're all read on database load when the project first opens up.

An on creation Eval is a good way to add variance to equipment or usable independent items, but it will not work with a note tag inside of it, because that note tag itself is not javascript to be run.

What you'd actually want to do is find the value this note tag is parsed to on the item, and modify it directly on the item on creation eval. Fortunately, you don't even need to go that far, as the lunatic note tags for the augment plugin include an eval one that can be used to do exactly what you're looking for.

JavaScript:
<Augment Attach Eval: Wood>
 item.params[6] += Math.round(Math.random(9)+1)
</Augment Attach Eval: Wood>

The above tag makes it so that this augment adds between 1 and 10 agi to the item it is put on.

If you also have the ability to remove augments, you'd also need to keep track of what was added by this in order to remove it correctly after:

JavaScript:
<Augment Attach Eval: Wood>
item._woodAgiAdd = Math.round(Math.random(9)+1)
item.params[6] += item._woodAgiAdd
</Augment Attach Eval: Wood>
<Augment Remove Eval: Wood>
item.params[6] -= item._woodAgiAdd
delete item._woodAgiAdd
</Augment Remove Eval: Wood>
Keep in mind this gets a bit messier if you can attach multiple copies of this item. And if you have multiple augments that can add random stats, they should all store their values in different variables on the item, so they don't overwrite each other.
 

Latest Threads

Latest Posts

Latest Profile Posts

Making Houses and Outside on the same map with RPG Maker MV!
Do people actually use buff/debuff function?
Ami


Imagine you (as Miner) Sleep in the Cave,the other side is a Bunch of Golds,how d'you feel?
finally got footage of my main character running around his corrupted street...
I finally got the ships and water to flow like I wanted to~ the canals are a success. Now to loop the animation for the kites. So many kites.

Forum statistics

Threads
107,702
Messages
1,031,532
Members
139,835
Latest member
dangkykubetim
Top