Izy's Eval Condition

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
243
Reaction score
65
First Language
english

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:

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
 
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,441
First Language
Portuguese
Primarily Uses
This is a condtion for what? Event pages? Conditional Branchs? Something else?
 

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
243
Reaction score
65
First Language
english
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,441
First Language
Portuguese
Primarily Uses
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;
}
 

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
243
Reaction score
65
First Language
english
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!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

"What do you think the best place to visit on this cold days?" "Hell..."
Been so busy lately that I wonder if I should slowly start preparing the advent calendar resources so I have enough in december.
Man, I wish it was harder for mean d-holes to make me feel like crying.
Made 8 games. Was aiming for 20. Gonna go for 40. Because 20 + 20. /Bed.
Got myself card game plugin, its bit laggy but worth it

Forum statistics

Threads
94,537
Messages
921,714
Members
124,400
Latest member
Standanddeliver
Top