I am learning so please be patient with me. I am familiar but but by no means an expert with javascript. I need my variable to have an initial value in my plugin. I don't want it to keep the value but its returning a null value error and I can't play the game.
Code:
/** /*:
* @target MZ
*
* @author LadyLegend
* @plugindesc First Plugin
*
*
* @help
* Help text
*
*
*
*
*
*
*
*
*
*
*/
;
(() => {
class Window_GoldPop extends Window_Base {
constructor(rect) {
super(rect);
}
update() {
super.update();
this.aupdate();
}
async aupdate() {
return new Promise((s,f) => {
try {
this.contents.clear();
this.drawIcon($dataItems[$gameVariables.value(1)].iconIndex, 0, 0);
this.drawText($gameParty._gold, 0, 0, this.contents.width, 'center');
s();
} catch (e) {
f(e);
}
}).then().catch(e => {
throw e;
});
}
}
const sms = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
sms.call(this);
this.goldwinp = new Window_GoldPop(new Rectangle(0, 0, 240, Window_Base.prototype.lineHeight() * 2));
this.addChild(this.goldwinp);
}
})();