any way to increase number of event pages

Hey all,


Is there any way at all to increase the number of event pages easily beyond 20? I am trying to event a farming system and with 20 pages, I can only have the farmer plant 2 crops (each crop requires 9 event pages for the different stages and dry/watered graphics)... ;_; I was spoiled with VX Ace's 99 pages.


I am assuming the answer is "no", but I had to ask.


Thanks for your help.
I don't mean to jump to conclusion but... I would suggest increasing the efficiency of your eventing instead. That many pages seems unnecessary. You may be able to save a lot of pages by approaching things differently.
I don't mean to jump to conclusion but... I would suggest increasing the efficiency of your eventing instead. That many pages seems unnecessary. You may be able to save a lot of pages by approaching things differently.



I wish I could increase the efficiency, but I honestly don't think it's feasible. Each crop has 9 event pages which include: the planted seed dry/watered, stage 1 dry/watered, stage 2 dry/watered, harvestable stage 3 dry, and weeds for when you forget to water the crop for 2 days in a row or when the season changes. The way I have it now, it's pretty easy to copy and paste to other plots (I would just have to change like 2 variables and 2 switches for each new event and in the Common Event that runs when you go to sleep to check if you watered the crops). The only way I think I could do it is using the "Change Graphic" command instead of having the new graphics on different pages, but then I would have to probably add even more switches and possibly variables for each crop and for each event plot.  🙁
Won't you need variables for each crop (each event) anyway, with 20 to choose from?  You only have 4 self switches.


Honestly, I'd be looking for a plugin.
Won't you need variables for each crop (each event) anyway, with 20 to choose from?  You only have 4 self switches.


Honestly, I'd be looking for a plugin.



I basically made self-switch B the "watered" switch, which I could turn off every night with a script call. And, yeah, every single crop type for every single plot requires a unique variable and unique switches, so it's pretty time-consuming. But it DOES work so far haha I have one plot in which I can grow a turnip and a potato. I haven't finished with testing it, but knowing there are only 20 event pages to work with kinda put a damper on my spirit haha


I would LOVE a plug-in, but not that many people seem to be interested in scripting (for free) for non-RPG games. I mean, my brother knows Javascript, but he's never used RPG Maker before and he is busy with work and whatnot.
You might be surprised.  Farming systems are VERY popular, and some might find it more interesting/challenging/appealing than the majority of other requests.
Just in case you were interested, here is a screenshot of one of my event pages and a screenshot of one of the common events that runs when you sleep. There is another common event that waters the plants if it's raining and an other that negates the "It's Raining" common event if the weather is sunny. The crops also die when the season changes. So far, everything works as planned.

Spoiler
commonevent page.pngevent page.png
You only need five pages, one for every grow stage and one for the empty lot. The rest you can achieve with a "conditional branch" and a "set move route..." - "turn" command. Like the default door event...


turn up = dry


turn left = watered


turn right = infested


turn down = withered
wouldn't that require it to be a parallel process event?  That could make the game a bit laggy, if you have a lot of them.
Not necessarily. A single init event on each map to reset the dry/watered state on each map. And a 'turn' in the watering action. Alternatively if MV behaves in the same way as Ace, then local events can be targeted by common events with a little trick (write the event as a local event and copy it to a common event). Which means the common event could make the necessary turns to change the dry/watered state.
In the case of a common event, it WOULD have to be a parallel process, as a common event needs to be called from the event it's going to affect.
A parallel process to initialize/reset the state with a control switch to turn/keep it off until the next day.


But the parallel process can also be used to call the common event which would have access to all map events because of the call (Just checked back, works on MV even better than in Ace).


But of course a script could use a matrix and would be more flexible and less confusing.
If I were to make an evented crop system, I would set it up so a single event at map entrance traverses an array that holds the ID of each event that is a crop, and sets its state there. It would continue on as a parallel process to make changes to all the crops (to grow or wilt, etc).


each crop event would simply be a common event call (same common event that processes all crops) which checks the array to see what type of crop it is and what stage of growth/death its on, and change it depending on how you interact with it (water it, cut it, etc)


so how I would set up the arrays would be something like this:


variable 1: array of crop types.


variable 2: array of state of the crop


variable 3: array to see if something needs to be changed on the crop


The location in the above three arrays corresponds to the event ID that is a crop


The value in the location corresponds to the type of crop.


example:


values for var 1:


0 - no crop, barren land


1 - potato


2 - carrot


3 - strawberry


... etc


values for var 2:


0 - no crop, barren land


1 - just planted, unwatered


2 - just planted, watered


3 - sapling, unwatered


4 - sapling, watered


......


9 - ready to harvest, unwatered


10 - ready to harvest, unwatered


11 - ruined, unwatered


etc


values for var 3:


0 - no changes needed


1 - needs to be changed


At the start of the game, every valid crop for that map would be set to 0 to show no crop, or if you want a pre-made farm, then you can always set it to such with the values of the array.


This is assuming there's only one map to farm. If you want you can use another two variables for each map you can farm in, or you can always make each variable a 2D array so you can use only two variables for the whole game. For the sake of simplicity let's pretend it's only on one map.


Note: I haven't used MV enough and don't quite remember how to write Javascript, so all script calls I'm doing will be in Ruby and are for VX Ace.


For example, if the crop events on the map are events 10 through 20, and there are currently no planted crops, you would initialize it like such.


(assuming var 1 and var 2 for the above)


$game_variables[1] = [,,,,,,,,,,0,0,0,0,0,0,0,0,0,0]


$game_variables[2] = [ ]


$game_variables[3] = [,,,,,,,,,,1,1,1,1,1,1,1,1,1,1]


the commas are to skip the first 10. (the first entry starts at 0, and since no event uses the ID of 0, we skip it) You can always do a for loop instead like:


for i = 10..20


$game_variables[1][ i ] = 0


$game_variables[3][ i ] = 1


end


$game_variables[2] = [ ]


we simply initialize variable 2 to an array since there's no need to check the state of the crop if it's not even planted.


Once it's initialized, we call Common Event 1, which changes the crops depending what is there and what's been done.


We call it within a loop, and use a fourth variable $game_variables[4] to loop through the valid events to check like so:


$game_variables[4] == 10 (first event that is a crop)


loop


call common event 1


if $game_variables[4] >= 20 (last event that is a crop)


     break loop


else


     $game_variables[4] += 1


end (end if)


end loop


After the first time it's initialized, this single event only calls the above loop when the player enters, to change all of the crops instantly.


Common Event 1 (changes the event based on var 4)


if $game_variables[3][$game_variables[4]] == 1


use your conditionals to check what $game_variables[1][$game_variables[4]] and $game_variables[2][$game_variables[4]] have so you can change the graphic, etc.


$game_variables[1][$game_variables[4]]     this holds the type of plant is there


$game_variables[1][$game_variables[4]]     this holds the status of that plant.


Once all of that's done, make sure to set $game_variables[3][$game_variables[4]] to 0 so it knows not to change the crop later.


a more advanced way of doing this would be to utilize script call equivalents of changing a graphic, etc and using the above numbers for the type of graphic.


else


do nothing


end


Anyway, when you interact with the crop it would call common event 2. First it would check what is there.


Common Event 2 (triggered when you interact with a plot of land)


if $game_variables[1][self.id] < 0


plant a crop?


--------------------------


if you plant a crop, and you choose strawberry, then it does this:


$game_variables[1][self.id] = 3


$game_variables[2][self.id] = 1


$game_variables[3] = 1 (so that common event 1 knows something needs to be changed)


$game_variables[4] = self.id (to make sure common event 2 changes only this event)


trigger common event 1


--------------------------


else (there's already crop here)


water crop? or harvest crop? or destroy crop?


--------------------------


Do something similar to the above, changing variables then triggering common event 1.


--------------------------


end


Now if you ever need to change any of the crops for any reason, (maybe a bunch of rabbits raided your camp and ate all the carrots) all you would do is change the values inside the arrays of var 1 and 2, and then set the corresponding value in var 3 to (1) to tell the single parallel process (that calls common event 1) that something needs to be changed for each of those crops.


Granted I did all this while procrastinating on my project and I haven't put any of it into use, so it's just a basic blueprint of how I would have done it.
If I were to make an evented crop system, I would set it up so a single event at map entrance traverses an array that holds the ID of each event that is a crop, and sets its state there. It would continue on as a parallel process to make changes to all the crops (to grow or wilt, etc).


each crop event would simply be a common event call (same common event that processes all crops) which checks the array to see what type of crop it is and what stage of growth/death its on, and change it depending on how you interact with it (water it, cut it, etc)


so how I would set up the arrays would be something like this:


variable 1: array of crop types.


variable 2: array of state of the crop


variable 3: array to see if something needs to be changed on the crop


The location in the above three arrays corresponds to the event ID that is a crop


The value in the location corresponds to the type of crop.


example:


values for var 1:


0 - no crop, barren land


1 - potato


2 - carrot


3 - strawberry


... etc


values for var 2:


0 - no crop, barren land


1 - just planted, unwatered


2 - just planted, watered


3 - sapling, unwatered


4 - sapling, watered


......


9 - ready to harvest, unwatered


10 - ready to harvest, unwatered


11 - ruined, unwatered


etc


values for var 3:


0 - no changes needed


1 - needs to be changed


At the start of the game, every valid crop for that map would be set to 0 to show no crop, or if you want a pre-made farm, then you can always set it to such with the values of the array.


This is assuming there's only one map to farm. If you want you can use another two variables for each map you can farm in, or you can always make each variable a 2D array so you can use only two variables for the whole game. For the sake of simplicity let's pretend it's only on one map.


Note: I haven't used MV enough and don't quite remember how to write Javascript, so all script calls I'm doing will be in Ruby and are for VX Ace.


For example, if the crop events on the map are events 10 through 20, and there are currently no planted crops, you would initialize it like such.


(assuming var 1 and var 2 for the above)


$game_variables[1] = [,,,,,,,,,,0,0,0,0,0,0,0,0,0,0]


$game_variables[2] = [ ]


$game_variables[3] = [,,,,,,,,,,1,1,1,1,1,1,1,1,1,1]


the commas are to skip the first 10. (the first entry starts at 0, and since no event uses the ID of 0, we skip it) You can always do a for loop instead like:


for i = 10..20


$game_variables[1][ i ] = 0


$game_variables[3][ i ] = 1


end


$game_variables[2] = [ ]


we simply initialize variable 2 to an array since there's no need to check the state of the crop if it's not even planted.


Once it's initialized, we call Common Event 1, which changes the crops depending what is there and what's been done.


We call it within a loop, and use a fourth variable $game_variables[4] to loop through the valid events to check like so:


$game_variables[4] == 10 (first event that is a crop)


loop


call common event 1


if $game_variables[4] >= 20 (last event that is a crop)


     break loop


else


     $game_variables[4] += 1


end (end if)


end loop


After the first time it's initialized, this single event only calls the above loop when the player enters, to change all of the crops instantly.


Common Event 1 (changes the event based on var 4)


if $game_variables[3][$game_variables[4]] == 1


use your conditionals to check what $game_variables[1][$game_variables[4]] and $game_variables[2][$game_variables[4]] have so you can change the graphic, etc.


$game_variables[1][$game_variables[4]]     this holds the type of plant is there


$game_variables[1][$game_variables[4]]     this holds the status of that plant.


Once all of that's done, make sure to set $game_variables[3][$game_variables[4]] to 0 so it knows not to change the crop later.


a more advanced way of doing this would be to utilize script call equivalents of changing a graphic, etc and using the above numbers for the type of graphic.


else


do nothing


end


Anyway, when you interact with the crop it would call common event 2. First it would check what is there.


Common Event 2 (triggered when you interact with a plot of land)


if $game_variables[1][self.id] < 0


plant a crop?


--------------------------


if you plant a crop, and you choose strawberry, then it does this:


$game_variables[1][self.id] = 3


$game_variables[2][self.id] = 1


$game_variables[3] = 1 (so that common event 1 knows something needs to be changed)


$game_variables[4] = self.id (to make sure common event 2 changes only this event)


trigger common event 1


--------------------------


else (there's already crop here)


water crop? or harvest crop? or destroy crop?


--------------------------


Do something similar to the above, changing variables then triggering common event 2.


--------------------------


end


Now if you ever need to change any of the crops for any reason, (maybe a bunch of rabbits raided your camp and ate all the carrots) all you would do is change the values inside the arrays of var 1 and 2, and then set the corresponding value in var 3 to (1) to tell the single parallel process (that calls common event 1) that something needs to be changed for each of those crops.


Granted I did all this while procrastinating on my project and I haven't put any of it into use, so it's just a basic blueprint of how I would have done it.



Wow, I didn't think to do it this way. It's a little beyond my abilities, but I'll fool around with it to see if I can get it to work. Thanks for taking the time to write all of that 🙂
Using





You can have as many self switches as you need. Probably easier for most to understand. Then you would only need 1 page and conditional branches.
There also exist plugins for self variables. I know of Hime's and mine (in my signature), but there might be more. You'll need another plugin (like Hime's Custom Page Conditions), if you want to use them to trigger pages.
Without getting into the "should I write a plugin or not" aspect. I think you're way overcomplicating this.


Every time you load a map, the game engine has to re-parse the map, thus resetting everything that isn't a global variable. Since no version of RPG Maker really has native arrays (The switches are all one array), an efficient solution would be to just create a nested array like this:


var plants = [
{ PlantName: 0,
State: 0,
Flag: 0
},
{ PlantName: 1,
State: 1,
Flag: 1
},
{ PlantName: 2,
State: 2,
Flag: 2
}
];


Then do something like


function getState (type) {
var states = {
0: function () {
return 'Dead';
},
1: function () {
return 'Growing';
},
2: function () {
return 'Ready to Harvest';
}
};
return states[type]();
}

for (i in plants)
{
getState(plants.State)

}


This is a very naive thing still, but the point I want to make is that if something you are trying is taking up too much space, you are almost certainly doing something wrong in regards to efficiency.


The immediate above can also be achieved with a switch statement instead, but is the more preferred OOP mechanism.


Personally I'm more fond of the bitmask solution as it saves memory


var IS_DEAD = 1; // 0001
var IS_GROWING = 2; // 0010
var IS_READY = 4; // 0100
var IS_WEED = 8; // 1000

var flags =0;
if (flags & IS_GROWING) {
console.log("Plant is Growing");
}

if (flags & IS_DEAD | IS_WEED) {
console.log("Plant is Gone");
}


But this is a more C-like approach where you store multiple states in one variable. So a 32-bit integer may store 32 boolean flags taking up 4 bytes, rather than creating 32 separate integers taking up 256 byes. The Javascript object itself might actually take up hundreds of kilobytes depending on how you setup an array, so sometimes trying to be clever actually is counter-intuitive if the underlying system is just storing things in large objects anyway. For example immediately above I put 4 variables with values 1 to 8, but because Javascript is going to process these as 32-bit integers, if I actually had 32 flags, they would have taken up 256 bytes AND the flags variable taking up 4 bytes. The cost savings is only realized when you aren't constantly passing boolean values as full integers, which in Javascript might not matter.


So you could really do something like IS_WATERED & IS_WAITING all as flags, and thus you only need one variable to store both.
Without getting into the "should I write a plugin or not" aspect. I think you're way overcomplicating this.


Every time you load a map, the game engine has to re-parse the map, thus resetting everything that isn't a global variable. Since no version of RPG Maker really has native arrays (The switches are all one array), an efficient solution would be to just create a nested array like this:



var plants = [
{ PlantName: 0,
State: 0,
Flag: 0
},
{ PlantName: 1,
State: 1,
Flag: 1
},
{ PlantName: 2,
State: 2,
Flag: 2
}
];


Then do something like



function getState (type) {
var states = {
0: function () {
return 'Dead';
},
1: function () {
return 'Growing';
},
2: function () {
return 'Ready to Harvest';
}
};
return states[type]();
}

for (i in plants)
{
getState(plants.State)

}


This is a very naive thing still, but the point I want to make is that if something you are trying is taking up too much space, you are almost certainly doing something wrong in regards to efficiency.


The immediate above can also be achieved with a switch statement instead, but is the more preferred OOP mechanism.


Personally I'm more fond of the bitmask solution as it saves memory



var IS_DEAD = 1; // 0001
var IS_GROWING = 2; // 0010
var IS_READY = 4; // 0100
var IS_WEED = 8; // 1000

var flags =0;
if (flags & IS_GROWING) {
console.log("Plant is Growing");
}

if (flags & IS_DEAD | IS_WEED) {
console.log("Plant is Gone");
}


But this is a more C-like approach where you store multiple states in one variable. So a 32-bit integer may store 32 boolean flags taking up 4 bytes, rather than creating 32 separate integers taking up 256 byes. The Javascript object itself might actually take up hundreds of kilobytes depending on how you setup an array, so sometimes trying to be clever actually is counter-intuitive if the underlying system is just storing things in large objects anyway. For example immediately above I put 4 variables with values 1 to 8, but because Javascript is going to process these as 32-bit integers, if I actually had 32 flags, they would have taken up 256 bytes AND the flags variable taking up 4 bytes. The cost savings is only realized when you aren't constantly passing boolean values as full integers, which in Javascript might not matter.





I have no idea what you did there haha


I have basically no knowledge of scripting and computer codes and whatnot. But I am sure your way would be much more efficient than what I was doing!


I learn best by example, so if anyone wanted to make a simple demo showing how a farm system would work without a plug-in, that would be awesome. 😀 I appreciate all the comments this thread is getting. It's making me realize I need to learn a lot more about RPG Maker!
This actually sounds like a fun system to try and implement. I can see two ways of going about it. The javascript plugin method, or some modification to the way the events are being managed in the game editor itself.


I got nothing but time on my hands if you wanted some help coming up with a plugin for this. I'm quite new to RPG Maker and javascript so I need some kind of project to dive into to familiarize myself with things. Having an objective makes this easier.

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-increase-number-of-event-pages.55257/