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
836
Reaction score
528
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

I find great satisfaction in smiting spambots. I'm not really sure why.
I finally added my newly updated demo back to the website! It only took like 4 weeks of work...
Where is the "world-weary sigh" comment response when you need it? I need that one more than anything, but the closest we have is "wow" or "angry".
My apologies if it's out-of-place for my goyim-lookin' ass to be the one to say it, but the mythology of "Golems" is that they were created by Rabbis to protect Jewish villages from Anti-semetic attacks.

Forum statistics

Threads
107,775
Messages
1,032,064
Members
139,918
Latest member
Sianar
Top