Changing Event Pages from within a plugin

Drako King

Villager
Member
Joined
Jun 8, 2016
Messages
5
Reaction score
0
First Language
English
Primarily Uses
I'm creating a plugin. I've overridden the Game_Event.prototype.initialize function. 


var alias_Game_Event_initialize = Game_Event.prototype.initialize;

Game_Event.prototype.initialize = function(mapId, eventId) {
alias_Game_Event_initialize.call(this, mapId, eventId);
if(note) {
this.setFirstPageList();
this.setSecondPageList();
}
}


I aliased the initialize function and added a way to check for a tag in the event note. In the MV project, I added an event with the necessary tag. Now, when the event with the tag initializes, it will run two new functions that I have added to the Game_Event.prototype: setFirstPageList() and setSecondPageList(). 


Game_Event.prototype.setFirstPageList = function () {
this.event().pages[0] = this.page();
this.event().pages[0].list =[objects]; // this list is an array holding command objects that I've left blank here



The first function takes the first page of the event that I placed in the project and simply changes the list. In the commands, there is a command to turn the self switch "A" on. I've been testing the plugin, and when I trigger the event, this first page will in fact run, however, when I check the console, the _pageIndex of the Game_Event never changes to the second page. 


Game_Event.prototype.setSecondPageList = function () {
this.event().pages[1] = {};
this.event().pages[1].conditions = {
selfSwitchCh: "A", selfSwitchValid: true, actorId: 1, actorValid: false,
itemId: 1, itemValid: false, switch1Id: 1, switch1Valid: false,
switch2Id: 1, switch2Valid: false, variableId: 1, variablevalid: false, variableValue: 0
};
this.event().page[1].list = []; // again, command objects left blank
}


The second page seems to be my problem. In the game project itself, I only created one page in the event; I only set a note tag and an image. There weren't event commands inserted in the project nor is there a second page. However, in my console, the event appears to be set up correctly. And, when I trigger the event, the commands that I've programmed for it appear to work: in my case, I have the players image change, and the event turns on a self switch. However,


console.log(this);


shows that that Game_Event's _pageIndex is still set at 0. My question is this, does anyone know how I can make the page change for this plugin that I'm working on with the info I've given? The second page that I created actually requires the selfswitch that the first page turns on, however, the page index simply doesn't change like I expected it would in accordance with the correct conditions being met.  
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top