SHININGRIVER'S PROFILE
I do freelance photoshop and writing in my free time. I'm also a computer programmer.
Search
Filter
[SCRIPTING] [RMMV] Selectable windows and databases
Thanks! I'll check this out in the weekend. Am I right to assume that the new window that I'll be making (this opens when an actor is selected) can be worked in the same code, right? I'll just have to work on making a Window_Base for that, with its own handlers?
[SCRIPTING] [RMMV] Selectable windows and databases
So I changed the Compenium_Window to Window_Selectable... now what happens is that it doesn't allow close and hangs when a user selects an item (which I assume is because there's nothing defined when an item is selected, which supposed to open up a window with the actor's information).
Here's what I have so far:
Here's what I have so far:
//============================================================================= // // compendium2.js // //============================================================================= /*: * @plugindesc Display a list of actors * @author Geri Khan * * @param none * @desc none * @default false * * @help * * Plugin Command: * * actorlist - displays the actor list * */ (function() { var _Scene_Map_createallwindows = Scene_Map.prototype.createAllWindows; var _Game_Message_isBusy = Game_Message.prototype.isBusy; var _Actor_List = Window_Selectable.prototype.start; //addition var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; // adds the 'actorlist' plugin command Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'actorlist') { /*for (n = 1; n<=335; n++) { $gameParty.addActor(n); }*/ if (!$gameParty.inBattle()) { SceneManager._scene._myWindow.refresh(); SceneManager._scene._myWindow.show(); SceneManager._scene._myWindow.open(); SceneManager._scene._myWindow.activate(); SceneManager._scene._myWindow.select(1); }; } }; // prevents various things happening while the new window is open, // such as the player moving Game_Message.prototype.isBusy = function() { if (SceneManager._scene._myWindow.isOpen()) { return true; } return _Game_Message_isBusy.call(this); }; // create the compendium window while starting the map Scene_Map.prototype.createAllWindows = function() { _Scene_Map_createallwindows.call(this); this._myWindow = new Compendium_Window(0, 0); this.addWindow(this._myWindow); this._myWindow.close(); }; // define the compendum window class function Compendium_Window() { this.initialize.apply(this, arguments); } //Compendium_Window.prototype = Object.create(Window_Command.prototype); Compendium_Window.prototype = Object.create(Window_Selectable.prototype); Compendium_Window.prototype.constructor = Compendium_Window; // set the width of the window Compendium_Window.prototype.windowWidth = function() { return 816; }; // set the number of items in the list. Could use different values here, // such as $gameParty.members() or $gameParty.battleMembers() Compendium_Window.prototype.maxItems = function() { return $gameActors._data.length; }; // the number of visible rows in the window. Without this the height of the // window could be too tall for the screen with large numbers of actors Compendium_Window.prototype.numVisibleRows = function() { return Math.min(10,this.maxItems()); }; // draw each line of the window. Its width is evenly divided into three Compendium_Window.prototype.drawItem = function(index) { if (index == 0) { this.drawHeader(); return; } var actor = $gameActors.actor(index); var rect = this.itemRectForText(index); var segmentWidth = rect.width/3; if (actor) { this.drawActorClass(actor, rect.x, rect.y, segmentWidth); this.drawActorName(actor, rect.x+segmentWidth, rect.y, segmentWidth); this.drawActorLevel(actor, rect.x+(segmentWidth*2), rect.y, segmentWidth); } }; // refresh the window, including moving it into position Compendium_Window.prototype.refresh = function() { this.move(0,0,this.windowWidth(),this.fittingHeight(this.numVisibleRows())); this.createContents(); this.drawAllItems(); }; // draw the header text for each column Compendium_Window.prototype.drawHeader = function() { var rect = this.itemRectForText(0); var segmentWidth = rect.width/3; this.drawText('Class', rect.x, rect.y, segmentWidth); this.drawText('Name', rect.x+segmentWidth, rect.y, segmentWidth); this.drawText('Level', rect.x+(segmentWidth*2), rect.y, segmentWidth); }; // the header text is on line 0, which is selectable but shouldn't be. // Modifying the cursor code means the cursor can't stop on it Compendium_Window.prototype.cursorDown = function(wrap) { Window_Selectable.prototype.cursorDown.call(this,wrap); if (this.index() == 0) { Window_Selectable.prototype.cursorDown.call(this,wrap); } }; Compendium_Window.prototype.cursorUp = function(wrap) { Window_Selectable.prototype.cursorUp.call(this,wrap); if (this.index() == 0) { Window_Selectable.prototype.cursorUp.call(this,wrap); } }; Compendium_Window.prototype.isOkEnabled = function() { return true; }; Compendium_Window.prototype.isCancelEnabled = function() { return this.isHandled('cancel'); }; Compendium_Window.prototype.callCancelHandler = function() { this.callHandler('cancel'); } Compendium_Window.prototype.processCancel = function() { SoundManager.playCancel(); this.updateInputData(); this.deactivate(); this.callCancelHandler(); }; Compendium_Window.prototype.close = function() { if (!this.isClosed()) { this._closing = true; } this._opening = false; }; Compendium_Window.prototype.isOkTriggered = function() { return Input.isRepeated('ok'); }; Compendium_Window.prototype.isCancelTriggered = function() { return Input.isRepeated('cancel'); }; Compendium_Window.prototype.processOk = function() { if (this.isCurrentItemEnabled()) { this.playOkSound(); this.updateInputData(); this.deactivate(); this.callOkHandler(); } else { this.playBuzzerSound(); } }; })();
[SCRIPTING] [RMMV] Selectable windows and databases
It's totally fine. I appreciate the help. I'll take the time over the next weekend to review the codes. For now I'm making maps and updating databases before I go back to work T_T
[SCRIPTING] [RMMV] Selectable windows and databases
Thanks! I guess the next step would be to make a new window that opens and closes when you select an actor (and displays the stats and profile of the actor). Is the action of selecting the actor part of the script or would that be a scene (or a separate script)?
[SCRIPTING] [RMMV] Selectable windows and databases
Yes, this is very close to what I want to accomplish, basically. I'll try including a sort function (so it sorts by class, by name, or by level). I'll also explore how to go with this opening and closing a window that shows the information about the selected actor if you press 'ok' or something.
I'll experiment with this one. The concern with this code is it doesn't allow you to quit the list. Thanks so much for the big, big help. :D
I'll experiment with this one. The concern with this code is it doesn't allow you to quit the list. Thanks so much for the big, big help. :D
[SCRIPTING] [RMMV] Selectable windows and databases
So I worked on this a bit. Now, I'm not sure how to have this script run after triggering an event (like speaking to an NPC). I also don't know how to work on making this selectable... any help would be appreciated. Thanks!
(function() {
var _Scene_Map_start = Scene_Map.prototype.start;
var _Actor_List = Window_Selectable.prototype.start; //addition
var _actor_Size = 40; //size of party
Scene_Map.prototype.start = function() {
_Scene_Map_start.call(this);
this._myWindow = new Compendium_Window(0, 0);
this.addWindow(this._myWindow);
};
function Compendium_Window() {
this.initialize.apply(this, arguments);
}
Compendium_Window.prototype = Object.create(Window_Selectable.prototype);
Compendium_Window.prototype.constructor = Compendium_Window;
Compendium_Window.prototype.initialize = function(x, y) {
Window_Base.prototype.initialize.call(this, x, y, this.windowWidth(), this.windowHeight()*_actor_Size);
this._index = 1;
this._cursorFixed = false;
this._cursorAll = false;
this._stayCount = 0;
this._helpWindow = null;
this._handlers = {};
this._touching = true;
this._scrollX = 0;
this._scrollY = 0;
this.deactivate();
for (n = 1; n < _actor_Size; n++){
this.drawText($gameActors.actor(n).name()+ "\t\t\t\t" +$gameActors.actor(n)._level, 0, this.windowHeight()*(n-1), this.windowWidth(), this.windowHeight());
}
};
Compendium_Window.prototype.windowWidth = function(){
return 816;
};
Compendium_Window.prototype.windowHeight = function(){
return this.fittingHeight(0);
};
})();
[SCRIPTING] [RMMV] Selectable windows and databases
With a bit of fiddling, I found the game actors variable same with Ace.
$gameActors.actor(1).name()
$gameActors.actor(1)._level
So this one accesses the name and level for the first actor. I'm not sure how to access the class, though.
$gameActors.actor(1).name()
$gameActors.actor(1)._level
So this one accesses the name and level for the first actor. I'm not sure how to access the class, though.
[SCRIPTING] [RMMV] Selectable windows and databases
Yes, I did work on something similar back in Ace, and I forgot where I placed the file... I'm not sure about the implementation in MV, and hopefully I can explore it more fully in the weekend.
My end goal with that table is to display a list of recruitable party members (to which you can confirm if you want to add them or not to your current party, but this part can come later on), and that the values in this list (or the database that is used by this list) is updated by player's choice (so an option to update or not).
I believe the mechanics is something similar to Devil Survivor 2 or something.
My end goal with that table is to display a list of recruitable party members (to which you can confirm if you want to add them or not to your current party, but this part can come later on), and that the values in this list (or the database that is used by this list) is updated by player's choice (so an option to update or not).
I believe the mechanics is something similar to Devil Survivor 2 or something.
[SCRIPTING] [RMMV] Selectable windows and databases
Good morning,
It's been a long time since I went back to working on codes. Going with MV was a bit of a shocker (going from RGSS then a long hiatus, then JavaScript), so I'm... in a bit of a slump.
I watched a tutorial about making a basic window (which makes a window, but you can't do any action on it). So my question is...
...How is a selectable window made (and probably accessed through an event)?
...Is it possible to have the contents of the selectable window be from the database (like, showing the list of Actors, their classes, and level)?
I've included a mockup in Excel that I'm trying to accomplish:
Thank you very much~
It's been a long time since I went back to working on codes. Going with MV was a bit of a shocker (going from RGSS then a long hiatus, then JavaScript), so I'm... in a bit of a slump.
I watched a tutorial about making a basic window (which makes a window, but you can't do any action on it). So my question is...
...How is a selectable window made (and probably accessed through an event)?
...Is it possible to have the contents of the selectable window be from the database (like, showing the list of Actors, their classes, and level)?
I've included a mockup in Excel that I'm trying to accomplish:
Thank you very much~














