JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 122 of 171 View original ↗
  1. Is there a reason you can't access the characters at a higher level and use the regular facing commands?

    I guess I should've clarified- by "rotation" I don't mean the direction a character is facing, but rather the rotation value (in radians or degrees) of the sprite image itself
  2. AmVa said:
    I guess I should've clarified- by "rotation" I don't mean the direction a character is facing, but rather the rotation value (in radians or degrees) of the sprite image itself
    No, you weren't unclear, I just brain farted. Did calling a refresh/update fix it?
  3. Did calling a refresh/update fix it?
    Yes! I was dumb lol I forgot that I had a plugin that modified the sprite refresh function.
    That plugin was not working as I liked so I just removed that part and it's ok now.

    The thing that is still a bit tricky for me is changing the pivot of the sprite to the center. I did this eventually:
    Code:
    Game_Event.prototype.CenterPivot = function() {
    sprite = this.findInSpriteset()
    sprite.pivot.y = -sprite.patternHeight() / 2
    }

    It works, kinda? I must invoke this function before every rotation of the event though.
    I'd rather have something that will center it permanently
  4. AmVa said:
    Yes! I was dumb lol I forgot that I had a plugin that modified the sprite refresh function.
    That plugin was not working as I liked so I just removed that part and it's ok now.

    The thing that is still a bit tricky for me is changing the pivot of the sprite to the center. I did this eventually:
    Code:
    Game_Event.prototype.CenterPivot = function() {
    sprite = this.findInSpriteset()
    sprite.pivot.y = -sprite.patternHeight() / 2
    }

    It works, kinda? I must invoke this function before every rotation of the event though.
    I'd rather have something that will center it permanently
    I don't know exactly what you're trying to do but you can take a look at this plugin and see if there's anything you can use. It allows you to rotate and offset sprites in events.


    It's from the Japanese tkool forum
    スクリプト:イベントの上下反転やクロスフェードなどを実現
  5. from a quick look at it, it doesn't seem like this plugin is changing the sprites' pivot, so probably not what I'm looking for...

    the sprite's pivot is by default the origin, which in some cases is good, but in other cases I'd rather have the pivot be the center of the sprite.
    the plugins I've found so far only have it one way or the other, without letting you dictate the pivot with a parameter, so I wrote my function as a workaround.
  6. Hey guys, glad to be finally here. :rhappy: I´m currently working on my own RPG Maker MV game and I have some "trouble" with a plugin.

    I´m using a Slot Machine Plugin from TheUnproPro
    You can buy chips for the ingame currency (gold) and then play on a slot machine with these chips.
    Problem: You cannot exchange these chips back. It looks like these chips don´t have a variable. Also you cannot see them anywhere (inventory), only at the shop/slot. Bild_2023-04-28_143632621.png
    Maybe someone can help? I´ll "spoiler" the used 2 plugins:
    casinocore
    /*:
    * @plugindesc Version: 1.00 | Core plugin for casino games!
    * @Author William Ramsey (TheUnproPro)
    *
    * @param Chip Cost
    * @desc How much Gold does it cost per chip?
    * @Default 1
    *
    * @param Max Chips
    * @desc What's the max number of Chips you can have?
    * @Default 9999
    *
    * @param Chip Name
    * @desc What are Chips called in your game?
    * @Default Chips
    *
    * @param Gold Icon
    * @desc What icon is the gold icon?
    * @Default 314
    *
    * @param Mobile Mode
    * @desc Use when exporting for touch screen devices.
    * @Default false
    *
    * @param Block Color
    * @desc Color of the dark area drawn behind the text.
    * @Default 0, 0, 0, 0.5
    *
    * @Help
    * upp_casinoCore is required for all of the casino games. This is basically
    * this shop, as well as data management.
    *
    * There are a few plugin commands you can use.
    *
    * 1) - upp_setCasinoFace name id - where name is the face name (Example:
    * People4) and id is the index.
    *
    * 2) - upp_setCasinoMsg msg - You can use the same text codes when displaying
    * a normal message. You can also use \cn to display
    * the name of the casino currency.
    *
    * 3) - upp_earnChips number - where number is how many you gain. Use -
    * before the number to subtract. Example: -50
    *
    * 4) - upp_openCasinoShop - This opens the casino shop.
    *
    */
    (function() {
    var empty={};
    var upp_miniMapCmds = Game_Interpreter.prototype.pluginCommand
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
    upp_miniMapCmds.apply(this, arguments);

    if(command=="upp_openCasinoShop") {
    SceneManager.push(Scene_ChipShop);
    }

    if(command=="upp_setCasinoFace") {
    upp_data().casinoFace = args[0];
    upp_data().casinoFaceIndex = Number(args[1]);
    }

    if(command=="upp_earnChips") {
    upp_data().chips += Number(args[0]);
    if(upp_data().chips>maxChips) {
    upp_data().chips = maxChips;
    }
    }

    if(command=="upp_setCasinoMsg") {
    var str="";
    for(var i=0;i<args.length;i++) {
    str += args;
    if(i<args.length-1) {
    str += " ";
    }
    }
    str = str.replace(/\\cn/g, chipName);
    upp_data().casinoMsg = str.replace(/\\n/g, "\n");
    }
    }

    var params = PluginManager.parameters("upp_casinoCore");
    var chipName = params['Chip Name'];
    var chipCost = Number(params['Chip Cost']);
    var goldIcon = Number(params['Gold Icon']);
    var mobileMode = (params['Mobile Mode'] == "true" || params['Mobile Mode'] == "false") ? eval(params['Mobile Mode']) : false;
    var blockColor = "rgba("+params['Block Color']+")";

    var maxChips = Number(params['Max Chips']);
    function _upp_data() {
    this.extractAlias = function(fun) {
    var dmex = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function(contents) {
    dmex.apply(this, arguments);
    $gameSystem.upp_data = {};
    fun.apply(this, arguments);
    }
    }
    }

    var upp_data = function() {
    if($gameSystem) {
    return $gameSystem.upp_data;
    } else { return empty }
    }

    var chips = function() {
    return $gameSystem.upp_data;
    }

    var gameSystemAlias = Game_System.prototype.initialize;
    Game_System.prototype.initialize = function() {
    gameSystemAlias.call(this);
    this.upp_data = this.upp_data || new _upp_data();
    this.upp_data.mobileMode = mobileMode;
    this.upp_data.casinoFace = "";
    this.upp_data.casinoMsg = "";
    this.upp_data.casinoFaceIndex = 0;
    this.upp_data.chipName = chipName;
    this.upp_data.chips=0;
    }

    var dmex = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function(contents) {
    dmex.apply(this, arguments);
    $gameSystem.upp_data = $gameSystem.upp_data || new _upp_data();
    }


    Window_ChipShop = function() {
    this.initialize.apply(this, arguments);
    }

    Window_ChipShop.prototype = Object.create(Window_Base.prototype);
    Window_ChipShop.prototype.constructor = Window_ChipShop;

    Window_ChipShop.prototype.initialize = function(width, height) {
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this.chipCount=0;
    this.cos=0;
    this.refresh();
    }

    Window_ChipShop.prototype.refresh = function() {
    this.contents.clear();
    this.contents.fillRect(0, 0, this.contents.width, this.contents.height, blockColor);
    this.contents.drawText("How many "+chipName+" do you want to buy?", 0, 0, this.contents.width, this.lineHeight());
    this.contents.drawText("x"+this.chipCount, this.contents.fontSize/2, this.lineHeight(), 50, this.lineHeight(), 'center');
    this.contents.drawText(this.chipCount*chipCost, -32-this.padding/2, this.lineHeight(), this.contents.width, this.lineHeight(), 'right');
    this.drawIcon(goldIcon, this.contents.width-32, this.lineHeight());

    this.contents.drawText("<", -Math.cos(this.cos), this.lineHeight(), 50, this.lineHeight());
    this.contents.drawText(">", 50+this.contents.fontSize/2+Math.cos(this.cos), this.lineHeight(), 50, this.lineHeight());
    }

    Window_ChipShop.prototype.update = function() {
    this.cos+=0.1;
    if(Input.isRepeated("right") && $gameParty.gold()>this.chipCount*chipCost) {
    this.chipCount+=1;
    SoundManager.playCursor();
    }

    if(Input.isRepeated("pagedown") && $gameParty.gold()>this.chipCount*chipCost) {
    this.chipCount+=10;
    SoundManager.playCursor();
    }

    if(Input.isRepeated("left") && this.chipCount>0) {
    this.chipCount-=1;
    SoundManager.playCursor();
    }

    if(Input.isRepeated("pageup") && this.chipCount>0) {
    this.chipCount-=10;
    SoundManager.playCursor();
    }

    this.chipCount = Math.min(Math.max(this.chipCount, 0), $gameParty.gold()/chipCost);
    this.refresh();

    console.log();
    }


    Chip_Window = function() {
    this.initialize.apply(this, arguments);
    }

    Chip_Window.prototype = Object.create(Window_Base.prototype);
    Chip_Window.prototype.constructor = Chip_Window;

    Chip_Window.prototype.initialize = function() {
    Window_Base.prototype.initialize.call(this, 0, 0, 240, 256);
    this.refresh();
    }

    Chip_Window.prototype.refresh = function() {
    this.contents.clear();
    this.changeTextColor(this.systemColor());
    this.contents.drawText(chipName, 0, 0, this.contents.width, this.lineHeight());
    this.changeTextColor(this.normalColor());
    this.contents.drawText(upp_data().chips, 0, 0, this.contents.width, this .lineHeight(), 'right');
    }

    Chip_Window.prototype.update = function() {
    this.refresh();
    }

    Window_ChipMsg = function() {
    this.initialize.apply(this, arguments);
    }

    Window_ChipMsg.prototype = Object.create(Window_Base.prototype);
    Window_ChipMsg.prototype.constructor = Window_ChipMsg;

    Window_ChipMsg.prototype.initialize = function(height) {
    Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, height);
    this.refresh();
    }

    Window_ChipMsg.prototype.refresh = function() {
    this.contents.clear();
    this.drawFace(upp_data().casinoFace, upp_data().casinoFaceIndex, 0, 0, 144, 144);
    this.drawTextEx(upp_data().casinoMsg, 144, 0);
    }

    Window_ChipMsg.prototype.update = function() {
    this.refresh();
    }


    function Window_CasinoChoice() {
    this.initialize.apply(this, arguments);
    }
    Window_CasinoChoice.prototype = Object.create(Window_Command.prototype);
    Window_CasinoChoice.prototype.constructor = Window_CasinoChoice;
    Window_CasinoChoice.prototype.initialize = function(x, y) {
    Window_Command.prototype.initialize.call(this, x, y);
    }

    Window_CasinoChoice.prototype.windowWidth = function() {
    return Graphics.boxWidth/1.5;
    }

    Window_CasinoChoice.prototype.makeCommandList = function() {
    if(upp_data().mobileMode == true) {
    this.addCommand('+1', 'p1');
    this.addCommand('+10', 'p10');
    this.addCommand('-1', 'm1');
    this.addCommand('-10', 'm10');
    }
    this.addCommand('Finished', 'fin');
    }

    Scene_ChipShop = function() {
    this.initialize.apply(this, arguments);
    }

    Scene_ChipShop.prototype = Object.create(Scene_MenuBase.prototype);
    Scene_ChipShop.prototype.constructor = Scene_ChipShop;

    Scene_ChipShop.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
    }

    Scene_ChipShop.prototype.start = function() {
    this.createWindows();
    }

    Scene_ChipShop.prototype.createWindows = function() {
    this.window_coinshop = new Window_ChipShop(Graphics.boxWidth/1.5, this.window_coinshopHeight());
    this.window_coinshop.x=Graphics.boxWidth/2-this.window_coinshop.width/2;
    this.window_coinshop.y=Window_Base.prototype.lineHeight()*5;

    this.window_coinDisplay = new Chip_Window();
    this.window_coinDisplay.width = 240;
    this.window_coinDisplay.height = Window_Base.prototype.lineHeight()*2;
    this.window_coinDisplay.y=Graphics.boxHeight-this.window_coinDisplay.height;
    this.gold_window = new Window_Gold(0, this.window_coinDisplay.y);
    this.gold_window.x = Graphics.boxWidth-this.gold_window.width;
    this.fin_window = new Window_CasinoChoice(this.window_coinshop.x, this.window_coinshop.y + this.window_coinshop.height);
    this.face_window = new Window_ChipMsg(Window_Base.prototype.lineHeight()*5);

    this.fin_window.setHandler('p1', this.changeNum.bind(this, 1));
    this.fin_window.setHandler('p10', this.changeNum.bind(this, 10));
    this.fin_window.setHandler('m1', this.changeNum.bind(this, -1));
    this.fin_window.setHandler('m10', this.changeNum.bind(this, -10));
    this.fin_window.setHandler('cancel', this.popScene.bind(this));
    this.fin_window.setHandler('fin', this.finishBuy.bind(this));
    this.addChild(this.window_coinshop);
    this.addChild(this.window_coinDisplay);
    this.addChild(this.gold_window);
    this.addChild(this.fin_window);
    this.addChild(this.face_window);
    }

    Scene_ChipShop.prototype.window_coinshopHeight = function() {
    return Window_Base.prototype.lineHeight()*3;
    }

    Scene_ChipShop.prototype.finishBuy = function() {
    if(this.window_coinshop.chipCount>maxChips-upp_data().chips) { this.window_coinshop.chipCount=maxChips-upp_data().chips; }
    upp_data().chips+=this.window_coinshop.chipCount;
    $gameParty.loseGold(this.window_coinshop.chipCount*chipCost);
    this.popScene();
    }

    Scene_ChipShop.prototype.changeNum = function(num) {
    this.window_coinshop.chipCount+=num;
    this.fin_window.activate();
    }

    Scene_ChipShop.prototype.update = function() {
    Scene_MenuBase.prototype.update.call(this);
    upp_data().chips=Math.min(Math.max(upp_data().chips, 0), maxChips);
    }
    })();

    CasinoSlots
    /*:
    * @plugindesc Version: 1.00 | Slot machines! (requires upp_casinoCore)
    * @Author William Ramsey (TheUnproPro)
    *
    * @param Slot Random Sound
    * @desc Sound effect when selecting random slots.
    * @Default Electrocardiogram
    *
    * @param Slot Random Pitch
    * @desc Sound effect pitch when selecting random slots.
    * @Default 100
    *
    * @param Slot Random Volume
    * @desc Sound effect volume when selecting random slots.
    * @Default 70
    *
    * @param Slot Selected Sound
    * @desc Sound effect when selecting random slots.
    * @Default Reflection
    *
    * @param Slot Selected Pitch
    * @desc Sound effect pitch when selecting random slots.
    * @Default 100
    *
    * @param Slot Selected Volume
    * @desc Sound effect volume when selecting random slots.
    * @Default 70
    *
    * @param Ticks
    * @desc How many ticks until the slot machine decides to select something?
    * @Default 10
    *
    * @param Speed
    * @desc How many frames until it switches the slots?
    * @Default 5
    *
    * @Help
    * To increase/decrease odds, you can modify the sprite sheet called upp_slotSprites
    * located in the images system folder. Remember though, it's important to make each
    * sprite 144x120, just as seen in the sprite sheet. The cherries, watermelon, etc
    * are 144x120 each, just lined up in a sprite sheet.
    *
    * Plugin commands:
    * To set up a victory goal, you can use this:
    * upp_setSlotsVictory 1 2 3 amount
    * - where 1 2 and 3 are the order you need to get. For example, using the default
    * image, 0 0 0 would be cherry cherry cherry, since 0 is the first "frame"of the
    * image, the cherries. 1 1 1 would be watermelons, etc.
    *
    * upp_setSlotsPrice Cost
    * - where Cost is how much it'll cost to play that slot machine.
    *
    * upp_startSlots
    * - After you're done setting up all of the possible victories, you can then
    * start the casino game using this command.
    *
    */
    (function() {
    var params = PluginManager.parameters("upp_casinoSlots");
    var sounds = [];
    var victories = [];
    var speed = Number(params['Speed']);
    var ticks=Number(params['Ticks']);
    sounds[0] = {
    name: params['Slot Random Sound'],
    pitch: Number(params['Slot Random Pitch']),
    volume: Number(params['Slot Random Volume']),
    pan: 0
    }

    sounds[1] = {
    name: params['Slot Selected Sound'],
    pitch: Number(params['Slot Selected Pitch']),
    volume: Number(params['Slot Selected Volume']),
    pan: 0
    }

    var empty = {};
    var sblsi = Scene_Boot.loadSystemImages
    Scene_Boot.loadSystemImages = function() {
    sblsi.call(this);
    ImageManager.loadSystem("upp_slotsFront");
    ImageManager.loadSystem("upp_slotsBack");
    ImageManager.loadSystem("upp_slotSprites");
    }
    //{ Standard UPP Settings
    var upp_data = function() {
    if($gameSystem) {
    return $gameSystem.upp_data;
    } else { return empty }
    }

    var Obj = function(name) {
    return eval(name + ".prototype");
    }

    var newObj = function(name, base) {
    return eval(
    name + ` = function() {
    this.initialize.apply(this, arguments);
    }

    `+name+`.prototype = Object.create(`+base+`.prototype);
    `+name+`.prototype.constructor = `+name+`;`
    );
    }

    var Fn = function(obj, name, funct) {
    var str=`Obj('`+obj+`').`+name+`=function() {
    funct.apply(this, arguments);
    }
    `;
    return eval(str);
    }
    //}

    //{ Commands
    var upp_miniMapCmds = Game_Interpreter.prototype.pluginCommand
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
    upp_miniMapCmds.apply(this, arguments);

    if(command=="upp_startSlots") {
    SceneManager.push(Scene_UppSlots);
    }

    if(command=="upp_setSlotsVictory") {
    victories.push({
    s1: Number(args[0]),
    s2: Number(args[1]),
    s3: Number(args[2]),
    win: Number(args[3])
    });
    }

    if(command=="upp_setSlotsPrice") {
    slotCost = Number(args[0]);
    }
    }

    var slotCost=0;
    var slotMsg = "";
    var slotWin = "";
    var slotLose = "";
    //}

    //{Windows
    newObj("Dummy_Window", "Window_Base"); //{

    Fn("Dummy_Window", "initialize", function(x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    });
    //}

    newObj("Window_SlotGraphics", "Window_Base"); //{

    Fn("Window_SlotGraphics", "initialize", function() {
    Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight);
    this.opacity=0;
    this.slot_id = [];
    this.timer=0;
    this.ticks=0;
    this.started=false;
    this.finished=false;
    this.win=false;
    this.winAmount = 0;
    this.refresh();
    });

    Window_SlotGraphics.prototype.standardPadding = function() {
    return 0;
    }

    Fn("Window_SlotGraphics", "refresh", function() {
    this.contents.clear();

    this.pad = Window_Base.prototype.standardPadding();
    this.contents.blt(ImageManager.loadSystem('upp_slotsBack'), 0, 0, 816, 624, 0, 0);
    this.contents.blt(ImageManager.loadSystem('upp_slotsFront'), 0, 0, 816, 624, 0, 0);
    if(this.started==false) {
    this.drawTextEx("Cost \\c[2]" + slotCost + " " + upp_data().chipName + "\\c[0] for 1 spin.\nDo you want to play?", this.pad, this.pad+Graphics.boxHeight-this.lineHeight()*3, this.contents.width, this.lineHeight());
    }

    if(this.started==true) {
    this.updateSlots();
    if(this.finished==true) {
    if(this.win==true) {
    this.drawTextEx("You won " + this.winAmount + " " + upp_data().chipName + "\n�Want to play again?", this.pad, this.pad+Graphics.boxHeight-this.lineHeight()*3, this.contents.width, this.lineHeight());
    } else {
    this.drawTextEx("No win... \nTry again?", this.pad, this.pad+Graphics.boxHeight-this.lineHeight()*3, this.contents.width, this.lineHeight());
    }
    }
    }
    });

    Fn("Window_SlotGraphics", "update", function() {
    this.refresh();
    });

    Fn("Window_SlotGraphics", "updateSlots", function() {
    var bitmap=ImageManager.loadSystem("upp_slotSprites");
    if(this.timer==speed && this.finished==false) {
    if(this.ticks<ticks) {
    this.slot_id[0] = Math.floor(Math.random()*(bitmap.width/144));
    }
    if(this.ticks<ticks*2) {
    this.slot_id[1] = Math.floor(Math.random()*(bitmap.width/144));
    }
    if(this.ticks<ticks*3) {
    this.slot_id[2] = Math.floor(Math.random()*(bitmap.width/144));
    }

    if(this.ticks==ticks || this.ticks==ticks*2 || this.ticks==ticks*3) {
    AudioManager.playSe(sounds[1]);
    }
    this.timer = 0;
    this.ticks+=1;

    if(this.ticks<ticks*3) {
    AudioManager.playSe(sounds[0]);
    }

    if(this.ticks>=ticks*3+1) {
    this.finished=true;
    for(var i=0;i<victories.length;i++) {
    if(this.slot_id[0] == victories.s1 && this.slot_id[1] == victories.s2 && this.slot_id[2] == victories.s3) {
    upp_data().chips+=victories.win;
    this.winAmount = victories.win;
    this.win=true;
    }
    }
    }
    }
    this.timer+=1;
    this.contents.blt(bitmap, this.slot_id[0]*144, 0, 144, 120, 132, 252);
    this.contents.blt(bitmap, this.slot_id[1]*144, 0, 144, 120, 336, 252);
    this.contents.blt(bitmap, this.slot_id[2]*144, 0, 144, 120, 540, 252);
    });
    //}

    newObj("Window_SlotChoice", "Window_Command"); //{

    Fn("Window_SlotChoice", "initialize", function(x, y) {
    Window_Command.prototype.initialize.call(this, x, y);
    this.opacity = 0;
    });

    Fn("Window_SlotChoice", "makeCommandList", function() {
    var enabled = false;
    if(upp_data().chips>=slotCost) {
    enabled = true;
    }
    this.addCommand("Yes", 'yes', enabled);
    this.addCommand("No", 'no');
    });
    //}

    Chip_Window = function() {
    this.initialize.apply(this, arguments);
    }

    Chip_Window.prototype = Object.create(Window_Base.prototype);
    Chip_Window.prototype.constructor = Chip_Window;

    Chip_Window.prototype.initialize = function() {
    Window_Base.prototype.initialize.call(this, 0, 0, 240, 256);
    this.refresh();
    }

    Chip_Window.prototype.refresh = function() {
    this.contents.clear();
    this.changeTextColor(this.systemColor());
    this.contents.drawText(upp_data().chipName, 0, 0, this.contents.width, this.lineHeight());
    this.changeTextColor(this.normalColor());
    this.contents.drawText(upp_data().chips, 0, 0, this.contents.width, this .lineHeight(), 'right');
    }

    Chip_Window.prototype.update = function() {
    this.refresh();
    }

    //}

    //{ Scenes
    Scene_UppSlots = function() {
    this.initialize.apply(this, arguments);
    }

    Scene_UppSlots.prototype = Object.create(Scene_MenuBase.prototype);
    Scene_UppSlots.prototype.constructor = Scene_UppSlots;

    Scene_UppSlots.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
    this.ready=false;
    }

    Scene_UppSlots.prototype.start = function() {

    this.dummyWindow = new Dummy_Window(0, Graphics.boxHeight-(Window_Base.prototype.lineHeight()*3), Graphics.boxWidth, Window_Base.prototype.lineHeight()*3);

    this.win = new Window_SlotGraphics();

    this.winChoice = new Window_SlotChoice(Graphics.boxWidth-240, Graphics.boxHeight-(Window_Base.prototype.lineHeight()*3));

    this.winChoice.setHandler('yes', this.yes.bind(this));
    this.winChoice.setHandler('no', this.close.bind(this));
    this.winChoice.setHandler('cancel', this.close.bind(this));
    this.addChild(this.dummyWindow);
    this.addChild(this.win);
    this.addChild(this.winChoice);

    this.chipWindow = new Chip_Window();
    this.chipWindow.width = 240;
    this.chipWindow.height = Window_Base.prototype.lineHeight()*2;
    this.chipWindow.y=this.dummyWindow.y-this.chipWindow.height;
    this.chipWindow.x=Graphics.boxWidth-this.chipWindow.width;
    this.addChild(this.chipWindow);
    }

    Scene_UppSlots.prototype.close = function() {
    victories.splice(0, victories.length);
    this.popScene();
    }

    Scene_UppSlots.prototype.yes = function() {
    upp_data().chips-=slotCost;
    this.win.win=false;
    this.win.finished=false;
    this.win.ticks=0;
    this.win.timer=0;
    this.win.winAmount=0;
    this.win.started=true;
    this.winChoice.hide();
    this.winChoice.deactivate();
    this.dummyWindow.hide();
    this.ready=true;
    }

    Scene_UppSlots.prototype.update = function() {
    Scene_MenuBase.prototype.update.call(this);
    if(this.win.finished==true) {
    this.winChoice.show();
    this.winChoice.activate();
    this.dummyWindow.show();
    this.ready=false;
    }
    if(upp_data().chips<slotCost) {
    this.winChoice._list[0].enabled = false;
    } else {
    this.winChoice._list[0].enabled = true;
    }
    this.winChoice.refresh();

    if(this.ready==false) {
    this.chipWindow.y=this.dummyWindow.y-this.chipWindow.height;
    } else {
    this.chipWindow.y=Graphics.boxHeight-this.chipWindow.height;
    }
    }
    //}
    })();


    I´m grateful about any help :).
  7. @Mrxdaunknown Welcome! Per the first post in this thread,
    "If you need help getting a plugin working, please start a NEW thread and include a link to where you downloaded the plugin from."

    Or, if that plugin has a release thread here on the forums, that would be a perfect place to ask your question.
  8. Is there a way to determine if a skill being used in combat is single target or an aoe target? Or how many targets a skill being used has?
  9. DrSyintist said:
    Is there a way to determine if a skill being used in combat is single target or an aoe target?
    BattleManager._action.isForOne() - returns true if it's single target.

    DrSyintist said:
    Or how many targets a skill being used has?
    BattleManager._action._targets.length
  10. ATT_Turan said:
    BattleManager._action.isForOne() - returns true if it's single target.


    BattleManager._action._targets.length
    Thank you!
  11. If you want 2 different things to be in a <JS Post-Damage> note tag on a skill, which is considered best practice?
    Either
    Code:
    <JS Post-Damage>
    
    Do stuff (1)
    
    </JS Post-Damage>
    <JS Post-Damage>
    
    Do stuff (2)
    
    </JS Post-Damage>

    Or
    Code:
    <JS Post-Damage>
    
    Do stuff (1)
    
    Do stuff (2)
    
    </JS Post-Damage>

    Thank you
  12. Kes said:
    If you want 2 different things to be in a <JS Post-Damage> note tag on a skill, which is considered best practice?
    Either
    Code:
    <JS Post-Damage>
    
    Do stuff (1)
    
    </JS Post-Damage>
    <JS Post-Damage>
    
    Do stuff (2)
    
    </JS Post-Damage>

    Or
    Code:
    <JS Post-Damage>
    
    Do stuff (1)
    
    Do stuff (2)
    
    </JS Post-Damage>

    Thank you
    You'd want to use the latter method.
  13. @Kes Specifically, you can't do the former. Unless plugin instructions specifically say it's supported, as a general rule you can't have a given notetag more than once in a database entry. Only one of them will actually get parsed and used by the plugin.
  14. @ATT_Turan Thank you for the additional information. Now I know what to avoid.
  15. Sorry to be back again so soon, but I have another query about double action note tags.

    If I have understood correctly, the straightforward case would be:
    Code:
    <JS Post-Damage>
     if(target.result().critical == true)
     {
        user.addBuff(3, 2);
     }
     if(target.result().critical == true)
    {
        target.addState(52);
    }
    
    </JS Post-Damage>

    Where my nerve gives out is when I have 2 things which are wildly different. I'm not sure I have my brackets in the right places and whether the order of the two actions makes a difference. e.g.
    Code:
    <JS Post-Damage>
     if(target.result().critical == true)
     {
        user.gainTp(15);
     }
    for (let i=0; i<target.friendsUnit().aliveMembers().length; i++)
    {
        if (target.friendsUnit().aliveMembers()[i]!=target)
        {
            target.friendsUnit().aliveMembers()[i].gainHp(0-Math.round(value/10));
            target.friendsUnit().aliveMembers()[i].startDamagePopup();
        }
    }
    </JS Post-Damage>
  16. @Kes looks fine to me. Is something specific not working, or why do you ask?
  17. eomereolsson said:
    why do you ask?
    Because I'm a coding moron.
    Therefore I have little confidence in anything I do until I've checked it out. I can then build on it for other things as well.

    Thanks for the confirmation that everything is correct.
  18. Kes said:
    If I have understood correctly, the straightforward case would be:
    Code:
    <JS Post-Damage>
     if(target.result().critical == true)
     {
        user.addBuff(3, 2);
     }
     if(target.result().critical == true)
    {
        target.addState(52);
    }
    
    </JS Post-Damage>
    you could simplify that to this if you really wanted to, but its up to you.

    JavaScript:
    <JS Post-Damage>
    if(target.result().critical){
        user.addBuff(3, 2);
        target.addState(52);
    }
    </JS Post-Damage>

    Kes said:
    I have little confidence in anything I do until I've checked it out. I can then build on it for other things as well.

    its not like what you have wont work, but when you make code as shorter, its usually much easier to spot errors youve made and learn from them. The notebox is small, so if youre not writing the code in some outside program, its even harder to notice a mistake at a glance.

    when you have 2 IF blocks like that with the exact same entry condition, the resulting effects can be written together in a single IF instead of 2 separate ones. you want both the user to get that buff and the target to get that state when the user crits that skill right? instead of checking if the skill crit, then buffing them, then checking again if the same skill that youve just checked is still a crit, and then giving the target that state, you can have one check for the crit to execute both effects.

    any time you have a boolean, instead of checking if its true with "== true" you can usually leave it out. by default, just typing the boolean in an IF condition means if its true or returns true, carry out the task. in the same vein, its why you dont have to type out if(x>2 == true) when you can just do if(x>2). both get you what you want, but one adds a little more clutter. a little extra clutter usually wont hurt, but if you have longer conditions that you dont want to split and its going into the tiny notebox, removing "==true"s and replacing "== falses" with "!" saves you plenty of horizontal space and makes mistakes easier to see.
  19. @Robro33 Thank you for the additional information. It all helps me to learn to avoid at least some of the more basic mistakes.