Hi, all!
First of all, I'm not sure if this is the right place to post this, I apologize if not.
I need help with a custom Window_Selectable I'm trying to make.
So basically, I want to make a List of Cards the Player has in his Inventory. And of course the Player should be able to select a Card and add that Card to the Deck or remove it.
I thought that the adding and removing should be done by the cards themself, by calling a common Event with a Script in it.
And here is the problem: How can I actually select and use the Item?
I'm a complete Noob when it comes to programming, so I just followed Poryg's RMMV javascript tutorial a bit and came up with this:
And up until now it works like its intended (it lists all Hidden Items A the Player has):
The "selection" (or however the blue rectangle behind Card1 is called) is not controllable and doesn't blink.
I know that I have to setup a Handler that determines what happens when "ok" is pressed
(this._CardListWindow.setHandler("ok", method)
But exactly this method is what I'm struggling with. It somehow has to get the ID of the selected Item and use it or at least executes its effects. (also I'm not sure if a Handler solves the problem that the selection is not blinking).
Maybe someone can help me with this problem, I appreciate any help I can get.
Thank you in advance!
First of all, I'm not sure if this is the right place to post this, I apologize if not.
I need help with a custom Window_Selectable I'm trying to make.
So basically, I want to make a List of Cards the Player has in his Inventory. And of course the Player should be able to select a Card and add that Card to the Deck or remove it.
I thought that the adding and removing should be done by the cards themself, by calling a common Event with a Script in it.
And here is the problem: How can I actually select and use the Item?
I'm a complete Noob when it comes to programming, so I just followed Poryg's RMMV javascript tutorial a bit and came up with this:
function Scene_DeckBuilder() {
this.initialize.apply(this, arguments);
}
Scene_DeckBuilder.prototype = Object.create(Scene_MenuBase.prototype);
Scene_DeckBuilder.prototype.constructor = Scene_DeckBuilder;
Scene_DeckBuilder.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_DeckBuilder.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this._CardListWindow = new Window_CardList(0, 0, 320, 600);
this._CardListWindow.select(0);
this._CardListWindow.activate();
this.addWindow(this._CardListWindow);
}
Scene_DeckBuilder.prototype.update = function () {
if (Input.isTriggered("cancel")) SceneManager.pop();
}
function Window_CardList () {
this.initialize.apply(this, arguments);
}
Window_CardList.prototype = Object.create(Window_ItemList.prototype);
Window_CardList.prototype.constructor = Window_CardList;
Window_CardList.prototype.initialize = function (x, y, width, height) {
Window_ItemList.prototype.initialize.call(this, x, y, width, height);
this._category = 'none';
this._data = searchForTypeId($gameParty.items(), 3);
console.log(this._data);
this.drawAllItems();
}
Window_CardList.prototype.maxCols = function() {
return 1;
};
function searchForTypeId(itemList, typeId){
var resultList = [];
for(var i=0; i<itemList.length; ++i){
if(itemList[I].itypeId == typeId){
resultList.push(itemList[I]);
}
}
return resultList;
}
//endAnd up until now it works like its intended (it lists all Hidden Items A the Player has):
The "selection" (or however the blue rectangle behind Card1 is called) is not controllable and doesn't blink.
I know that I have to setup a Handler that determines what happens when "ok" is pressed
(this._CardListWindow.setHandler("ok", method)
But exactly this method is what I'm struggling with. It somehow has to get the ID of the selected Item and use it or at least executes its effects. (also I'm not sure if a Handler solves the problem that the selection is not blinking).
Maybe someone can help me with this problem, I appreciate any help I can get.
Thank you in advance!