Ho do I dynamically lvl comparison

Karegador

Villager
Member
Joined
Jun 1, 2016
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
First, if there is a thread that covers this already, I am apologize.

I'm trying to institute a level restriction on an item that can be used by different actors. So I need to write a line of code that dynamically compares the actor's level with a number, without hard coding the actor id.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
What plugins are you using / at what point, and how, are you doing the check?
 

Karegador

Villager
Member
Joined
Jun 1, 2016
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
I'm using Yanfly's item restriction plugin. I was trying to put an Eval line in the item note box following the format for the plugin.

<Enable Restrictions>
Eval: $gameActors.actor.level >= 3
</Enable Restrictions>

I know programming, still new to javascript though. But I'm finding the available documentation for RMMV's javascript to be somewhat unclear. I am not against using another method to apply the restriction code.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,117
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
This plugin? http://yanfly.moe/2017/05/12/yep-136-item-requirements-rpg-maker-mv/

If so, there's an example near the bottom of that page that should be able to be modified without much difficulty; try this:
Code:
<Custom Enable Requirement>
condition = battler.level >= 3;
</Custom Enable Requirement>
I think the individual Eval conditions are executed in the same context as the "custom" tags, so this alternative may also work:
Code:
<Enable Requirements>
Eval: battler.level >= 3
</Enable Requirements>
 

Karegador

Villager
Member
Joined
Jun 1, 2016
Messages
17
Reaction score
0
First Language
english
Primarily Uses
RMMV
Ahhhhh....

Thanks so much!

So "battler" is not limited to combat.

Also I tried both and in this case it won't work with Eval. You have to do custom.

Again thanks for the help.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,117
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
That's good to know. =)

Happy RPG Making! ^_^
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top