Izy's Eval Condition


Izy's Eval Condition
​


This script allow javascript as a condition.
​


As the title said, this script will make a condition with a javascript. Meant, it can break the condition limit such as gold value, actor's HP/TP/MP, Actor's equipment, Map ID, Actor's state and more.


For more code, please refer to this https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0


This is some example code:

Spoiler
Checking Party Gold



if ($gameParty.gold() < 200) condition = false;
//Check if party gold is bigger than 200


Checking Actor's HP/TP/MP



if ($gameActors.actor(1)._hp < 100) condition = false;
//Change hp to mp or tp as what you want. Don't forgot the '_' sign.
//Check if actor's 1 hp/tp/mp is lower than 100


Checking Actor's Equipment



if ($gameActors.actor(1)._equips[x].itemId() != 1) condition = false;
//Check if actor equipment of type x is item of 1. If not, false.


Checking Current Map ID



if ($gameMap._mapId != 1) condition = false;
//Check if the current map id is 1. If not, false.


Checking Actor's State



for (state = 0; state < $gameActors.actor(1)._states.length; state++) {
if ($gameActors.actor(1)._states[state] == 1) condition = false;
};
//Check if actor 1 is dead or have state 1 (state 1 is dead), then it'll false.

Grab the plugin now and see the magic! Direct Link
This is a condtion for what? Event pages? Conditional Branchs? Something else?
This is a condtion for what? Event pages? Conditional Branchs? Something else?

event, already state in the help
Then there is a issue with it. By default the maker refresh the events only when the refresh is called.


Only a limited number of things do refresh the map: changing variable, switches, items or party members. (and maybe a few others but only those come to mind)


So if none of those events don't happen, it will not refresh the event pages.


For example, you mention the code for gold on your example. When you gain gold the event page do not refresh, so even if the condition is met the event will not display the proper page.


I have a smiliar plugin and had this issue, the only way i found to solve it was to check on the event update from time to time.


Also you can improve it's compatibility by aliasing the function rather than overwritting it, with something like:

Code:
_Aliased_Game_Event_meetsConditions = Game_Event.prototype.meetsConditions
Game_Event.prototype.meetsConditions = function (page) {
  var result = _Aliased_Game_Event_meetsConditions.call(this, page);
  // your code here
  return result;
}
Then there is a issue with it. By default the maker refresh the events only when the refresh is called.


Only a limited number of things do refresh the map: changing variable, switches, items or party members. (and maybe a few others but only those come to mind)


So if none of those events don't happen, it will not refresh the event pages.


For example, you mention the code for gold on your example. When you gain gold the event page do not refresh, so even if the condition is met the event will not display the proper page.


I have a smiliar plugin and had this issue, the only way i found to solve it was to check on the event update from time to time.


Also you can improve it's compatibility by aliasing the function rather than overwritting it, with something like:



_Aliased_Game_Event_meetsConditions = Game_Event.prototype.meetsConditions
Game_Event.prototype.meetsConditions = function (page) {
  var result = _Aliased_Game_Event_meetsConditions.call(this, page);
  // your code here
  return result;
}

thanks for that. Updated!

Original thread: https://forums.rpgmakerweb.com/threads/izys-eval-condition.57501/