I hope someone with Java knowledge can help me out with this. I am not a programmer, but I am programmer-friendly--meaning I can look at syntax and basically understand what it's doing. I would like to use Yanfly's Equip Requirements Plugin with *variables*, which is the one thing it doesn't natively support. (I think this is odd, in light of Yanfly's Actor Variables.) I'm having two problems. First, I've tried a number of syntax variations for the <Custom Equip Requirement Condition>, to no avail. Second, and more puzzlingly, I can't get <Custom Equip Requirement Text> to simply display text as per Yanfly's instructions. However, "Requirements" does show up, and normal equip reqs (e.g., atk > 1) seem to work fine.
Here's what I'm working with. Please help! (Note: I couldn't determine if "$gameVariables.name(77)" was a proper call, but this doesn't even work as a pure text string.)
<Custom Equip Requirement Text>
text = ‘Minimum ' + $gameVariables.name(77) + ' = 1’;
</Custom Equip Requirement Text>
<Custom Equip Requirement Condition>
if (user.actorId() == 1) && $gameVariables.value(77) >= 1 {
condition = true;
} else {
if (user.actorId() == 1)
condition = false;
} else {
condition = true;
}
</Custom Equip Requirement Condition>
Yanfly Equip Reqs Lunatic Syntax HelP!
● ARCHIVED · READ-ONLY
-
-
Typo.
<Custom Equip Requirement Condition>
if (user.actorId() == 1 && $gameVariables.value(77) >= 1) {
condition = true;
} else {
if (user.actorId() == 1) {
condition = false;
} else {
condition = true;
}
}
</Custom Equip Requirement Condition> -
Thank you for your quick reply! But are you sure? I double checked the curly brackets, and it seems there are 3 sets, all closed in the original syntax. Also, neither version is working still. Everything works except lunatic mode. :(
-
There's one more typo I forgot to fix. In particular I forgot to add one more bracket. I edited it and added the missing bracket there.
-
If you're writing Javascript in the notetag box, there's a larger chance of syntax errors (as opposed to a proper code editor that can catch your mistakes). I would recommend using a tool to check for mistakes, a very easy one is https://www.jslint.com
Additionally, syntax errors should show in the console (press F8 during playtest), but it depends on how the plugin author does error handling. -
Yes! That worked. Thank you so much! I was also running this through my brother (a programmer), who pointed out this was simpler:
var condition = true
if ($gameVariables.value(77) < 1 && user.actorId() === 1) {
condition = false
}
Any idea why the simple text doesn't work, though? That seems much more straightforward.
Edit: (Also, thank you Aloe, I'm just learning to run this stuff through jsfiddle, which I think is similar.) -
Not sure why it doesn't work even as plaintext. I cannot even test it right now, since I'm not at home. Nevertheless, just so you know, $gameVariables.name doesm't exist.
-
Ha, I figured. Thanks. I'm trying to access the variable name instead of the value and hadn't figured out how. Not absolutely necessary, though. I'll keep experimenting to see if I can get it to work.
Edit: Got it. Of course it was stupid. I copy-pasted Yanfly's example and it input slightly different versions of the single quote, which messed up the string. Live and learn. Thank you guys so much. Now solved. -
The engine will ignore variable names.
-
Variable names are stored in a different place:
Code:Where i is the ID# of the variable.$dataSystem.variables[i] -
Fantastic! Many thanks.