Izy's Eval Condition

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
245
Reaction score
66
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,445
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
245
Reaction score
66
First Language
english
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,445
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
245
Reaction score
66
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

On the plus side, if all this rioting sparks another Covid outbreak... I will have a whole lot of time to work on my game. Not exactly how I wanted to get that time, but hey I'm a glass is half full... of RM kind of guy. :LZSwink:
A video once in a while won't hurt.
Have a craving for a Nesquik milkshake. No idea why. Haven't had one since I was a kid. lol. I remember them kinda tasting nice, but also leaving a lot of nasty powder at the bottom of the cup.
The more I think about it, the weirdest part of going to work post-virus will probably be getting used to seeing my coworkers' mouths again. :LZYshock:

Forum statistics

Threads
98,068
Messages
949,006
Members
129,340
Latest member
guangdi
Top