Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

How to change a event page from within a plugin?

Desro

Villager
Xy$
0.00
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.
 
I'm going to need a bit more info than that. are you creating a multipage event? what is the purpose of this plugin?
this will help me figure out how to help you.
 
Top