JavaScript questions that don't deserve their own thread

Discussion in 'Javascript/Plugin Support' started by Shaz, Oct 23, 2015.

  1. worshipme

    worshipme Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    Filipino
    Primarily Uses:
    RMMV
    Hello again guys. I'm back and brought another problem beyond my knowledge.

    Yanfly's Cleric Stance is a buff that makes the user deal more magical damage at the expense of lessening his/her healing capabilities.

    My problem is that my heals has an element called "HEAL" (so I can buff or debuff them anytime I want) and has a damage formula. Can we go around the Cleric Stance's code and make my magic damages deal more and the "HEAL" element be debuffed? I really am out of ideas >_<

    Yanfly's Cleric Stance (state):
    //Cleric Stance (Yanfly)
    <Custom Confirm Effect>
    if (this.isMagical() && this.isHpEffect() && value > 0) {
    value = Math.ceil(value * 1.50);
    } else if (this.isMagical() && this.isHpEffect() && value < 0) {
    value = Math.ceil(value * 0.50);
    }
    </Custom Confirm Effect>

    TY in advance! :)
     
  2. IAmJakeSauvage

    IAmJakeSauvage Veteran Veteran

    Messages:
    417
    Likes Received:
    667
    Location:
    Hamilton, ON
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey guys,

    I'm still struggling with this - in my status menu the bottom line is cut off - is there a way to either change the padding for "Parameters/Experience" or to remove them entirely so that the bottom line will show? :)
     

    Attached Files:

  3. AsuranFish

    AsuranFish Veteran Veteran

    Messages:
    115
    Likes Received:
    83
    First Language:
    English
    Is it possible to change a skill's name and icon if certain conditions are met?

    Thanks!
     
  4. darien_jarkeld

    darien_jarkeld Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    I'd like to execute movement commands in a plugin that I am building, but I am having trouble because it looks like the plugin execution happens outside of the regular movement loop. I end up with behavior where the move commands are executed very quickly in sequence without waiting for previous movement commands to resolve.

    In my latest iteration, I am trying to control movement by using setMoveRoute or forceMoveRoute, but this seems to have the same limitations as executing the movement commands directly.

    Code:
    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
      Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command === 'RandomMovement') {
          var gc = Game_Character;
          character = this.character();
          moveRoute = {
            list:[
              {code: gc.ROUTE_TURN_RANDOM, indent: null},
              {}
            ],
            repeat: true,
            skippable: true,
            wait: true
          };
          character.forceMoveRoute(moveRoute);
        }
      };
    
    When I run character.setMoveRoute(moveRoute), nothing happens
    When I run character.forceMoveRoute(moveRoute), the event turns randomly very, very quickly.

    I have a similar problem if I call character.turnRandom(); directly

    How can I execute a movement command and then instruct the plugin to wait until the movement is completed before executing additional code?

    If it is helpful, the project is here: https://github.com/wbhumphrey/special-tactics/blob/master/js/plugins/RandomMovement.js
     
    Last edited: Jun 10, 2017
  5. yuyu!

    yuyu! The Hero of Rhyme Member

    Messages:
    25
    Likes Received:
    11
    Location:
    Texas
    * EDIT - SOLVED (already) *
    OK, I'm dumb. I was calling the scene via SceneManager.goto, instead of SceneManager.push. Can't pop what hasn't been pushed!

    ...Carry on. ;)

    * END EDIT *

    popScene() closes my game ??

    Trying to create my own custom scene (so far, so good). However, my cancel handler (which triggers popScene) keeps closing my game, instead of simply returning to Scene_Map. Any clues? I'm guessing the game is closing Scene_Map instead of my custom scene, but I'm not sure why it would do that. :(

    Code:
        function Scene_CustomShop() {
            this.initialize.apply(this, arguments);
        }
    
        Scene_CustomShop.prototype = Object.create(Scene_MenuBase.prototype);
        Scene_CustomShop.prototype.constructor = Scene_CustomShop;
    
        Scene_CustomShop.prototype.initialize = function() {
            Scene_MenuBase.prototype.initialize.call(this);
        };
    
        Scene_CustomShop.prototype.create = function() {
            Scene_MenuBase.prototype.create.call(this);
            this.createGoldWindow();
            this.createDummyWindow();
            this.createListWindow();
            this.createBuyConfirmMenu();
        };
    
        Scene_CustomShop.prototype.createGoldWindow = function() {
            //this._goldWindow = new Window_Gold(0, this._helpWindow.height);
            this._goldWindow = new Window_Gold(0, 0);
            this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
            // Add window
            this.addWindow(this._goldWindow);
        };
    
        Scene_CustomShop.prototype.createDummyWindow = function() {
            var wy = this._goldWindow.y + this._goldWindow.height;
            var wh = Graphics.boxHeight - wy;
            this._dummyWindow = new Window_Base(0, wy, Graphics.boxWidth, wh);
            this.addWindow(this._dummyWindow);
        };
    
        Scene_CustomShop.prototype.createListWindow = function() {
            // Create window
            var wy = this._goldWindow.height;
            var ww = Graphics.boxWidth;
            var wh = Graphics.boxHeight - wy;
            this._csListWindow = new Window_CustomShop(0, wy, ww, wh);
            // Set handlers
               this._csListWindow.setHandler('ok',     this.onBuyOK.bind(this));
            this._csListWindow.setHandler('cancel', this.popScene.bind(this));
            // Add window
            this.addWindow(this._csListWindow);
            // Activate window
            this._csListWindow.activate();
            this._csListWindow.select(0);
        };
    
        Scene_CustomShop.prototype.createBuyConfirmMenu = function() {
            var wy = this._dummyWindow.y;
            this._confirmBuyWindow = new Window_CSBuyConfirm(0, wy);
            this._confirmBuyWindow.hide();
            this.addWindow(this._confirmBuyWindow);
        };
    
        Scene_CustomShop.prototype.start = function() {
            Scene_MenuBase.prototype.start.call(this);
        };
    
        Scene_CustomShop.prototype.update = function() {
            Scene_MenuBase.prototype.update.call(this);
        };
    
        Scene_CustomShop.prototype.onBuyOK = function() {
            this._item = this._csListWindow.item();
            this._csListWindow.hide();
            this._confirmBuyWindow.setup(this._item[0], this._item[1]);
            this._confirmBuyWindow.show();
            this._confirmBuyWindow.activate();
        };
    
    
     
    Last edited: Jun 13, 2017
  6. Snuffy

    Snuffy Veteran Veteran

    Messages:
    32
    Likes Received:
    28
    First Language:
    English
    NEW QUESTION (that doesn't deserve its own thread)

    What is the best way to have a side view battle system (currently using YED Sideview Battlers) where the actor has a walk animation, but that animation is only used when the actor is moving? I'm almost at the point of putting my walk animation in another sprite slot, and then specifically calling for it in Yanfly's Action sequences before I tell the actor to move. I just don't get it, why would the engine use the "walk" animation once the actor is standing still?
     
  7. worshipme

    worshipme Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    Filipino
    Primarily Uses:
    RMMV
    Hi again guys!

    I have a passive state that will temporarily give +1 bonus DEF to the affected battler each time he takes physical damage but I want to erase all bonuses given after every battle.

    <Custom Respond Effect>
    if (value > 0 && this.isPhysical()) {
    target._paramPlus[3] += 1;
    }
    </Custom Respond Effect>

    <Custom Turn End Effect>
    if ($gameParty.performEscape() || $gameTroop.aliveMembers().length == 0 || $gameParty.aliveMembers().length == 0) {
    target.clearParamPlus();
    }
    </Custom Turn End Effect>

    Erasing the bonuses seems to work if I clear all the troops and win the battle but if the party has managed to escape, the bonuses will stay and becomes permanent.

    The words highlighted in red doesn't work. What should I replace there to remove all the bonuses after every battle even if the party manages to escape?

    Thank you very much in advance.
     
  8. KillerK70

    KillerK70 Villager Member

    Messages:
    10
    Likes Received:
    0
    Location:
    Oregon
    First Language:
    English
    Edit: I figured it out. In that case, anyone know a list of javascript terms/commands?
     
    Last edited: Jun 30, 2017
  9. TheChilliPL

    TheChilliPL Villager Member

    Messages:
    23
    Likes Received:
    3
    First Language:
    Polski [Polish]
    Is there any Window_Base method to clear text if I want to change it?
     
  10. LTN Games

    LTN Games Veteran Veteran

    Messages:
    643
    Likes Received:
    498
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    @TheChilliPL it's usually done in your refresh() method. It won't clear just text but everything within the window itself. This should do the trick.
    PHP:
    this.contents.clear() 
     
  11. TheChilliPL

    TheChilliPL Villager Member

    Messages:
    23
    Likes Received:
    3
    First Language:
    Polski [Polish]
    Oh, thanks ;)
    By the way is it possible to make two windows with common border (Window_Base with text + Window_Command for selecting)
     
  12. AFletch88

    AFletch88 Veteran Veteran

    Messages:
    38
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    How could I check say for example I have an exp system the the max Exp increases to the value of the parameter.
    Code:
    <Custom Deselect Effect>
    
    var paramId = 6;
    
    target._agiExp = target._agiExp || 0;
    
    var maxAgiExp = //the current value of the actor's Agility Value\\
    
    if (target.result().missed || target.result().evaded) {
    
    var agiExpGain = 1;
    
    target._agiExp += agiExpGain;
    
    if (target._agiExp >= maxAgiExp) {
    
    var agiGain = Math.floor((Math.random() * 3) + 1);;
    
    target.addParam(paramId, agiGain);
    
    target.startAnimation(123);
    
    target._agiExp = 0;
    
    }
    
    }
    
    </Custom Deselect Effect>
    
    The part // \\ is what I'm trying to get to work. I've tried actor.paramId but that didn't seem to work, any help would be great.
     
  13. Teague

    Teague Villager Member

    Messages:
    13
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    Which game function is called when an actor uses a skill in RPG Maker MV? I want to conditionally switch what weapon is used for the skill.
     
  14. waynee95

    waynee95 Lunatic Coder Veteran

    Messages:
    640
    Likes Received:
    527
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
  15. Teague

    Teague Villager Member

    Messages:
    13
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    @waynee95
    This is for a plugin I'm making, intended to fix the issue where actors only ever use their first weapon by default even if they have multiple weapon slots. It's almost there, I just gotta make sure I'm applying the changes in the right function so it's a little more dynamic than just 'Actor uses their strongest available weapon to attack'.

    A notetag for another plugin is not the most helpful answer in this situation.

    Edit: Plus, that doesn't change the internal variable my plugin adds to keep track of which weapon to use.
     
    Last edited: Jul 14, 2017
  16. Nantas

    Nantas - Game developer - Veteran

    Messages:
    209
    Likes Received:
    135
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMMV
    I need a little javascript requirement.
    It's for an action sequence.

    I want the javascript "if" check if the skill's target is the user of the target.

    Thank you in advance !


    EDIT : I have found myself, even if I don't know any javascript xD

    this is the eval :
    if (target.name() === user.name())
    else
     
    Last edited: Jul 24, 2017
  17. AsuranFish

    AsuranFish Veteran Veteran

    Messages:
    115
    Likes Received:
    83
    First Language:
    English
    Hi all, was hoping I could get some help w/ this issue!

    I have an ability that inflicts a state and calls a common event to change a party member's battler if the state is inflicted, similar to the Toad spell from Final Fantasy. I'm handling this by creating a conditional for each party member to check if they're under the state, and changing their actor images if so.

    The trouble comes with changing the image back. Because I'm using custom images for each and every job class, I'd have a ton of conditionals to create to get the proper images set back up once the state is removed. Seems it would be very easy to overlook something in this process as well.

    Is there a better way to swap an actor's images back and forth other than having a ton of conditional statements?
     
  18. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,460
    Likes Received:
    1,052
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    I'm curious to know if there's a way to modify the space between characters in certain windows, name so that I can have a two-part icon within text.
     
  19. D.L. Yomegami

    D.L. Yomegami Sanely Insane Veteran

    Messages:
    159
    Likes Received:
    204
    Location:
    Somewhere
    First Language:
    English
    Primarily Uses:
    RMMV
    Never mind; I made my own thread for this question.
     
    Last edited: Aug 12, 2017
  20. Johnboy

    Johnboy Veteran Veteran

    Messages:
    325
    Likes Received:
    109
    Location:
    Canadia
    First Language:
    English
    @AsuranFish Have you tried Victor's State Graphics Plugin? You can specify in the actor noteboxes which characterset to use with which state. You can even change faces and map sprites if you wanted to go the extra mile.

    If you are using Yanfly plugins, place the Victor plugin below the Yanfly ones and it will work. I use it in my game.
     

Share This Page