JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 104 of 171 View original ↗
  1. hi i was wondering what the push.scene for Visutella's Quest system was im trying to make an event that involves the script pulling it up
  2. Hello.

    I'm trying to get the correct script to evaluate the TP gain of an item from the Database. Any help on that? Did not see it in the master script list.

    Cheers.
  3. Narch said:
    I'm trying to get the correct script to evaluate the TP gain of an item from the Database. Any help on that? Did not see it in the master script list.
    Where are you trying to access it? The short answer is it's the member variable tpgain - how exactly you access that will depend on where you're doing it and what code objects you're using.

    One example would be $dataItems[13].tpgain
  4. @ATT_Turan Thanks that's what I needed. I'm using it in a basic conditional branch to get the value directly from the item database.

    Edit : @ATT_Turan I think I get what you said now, I can't access it in a script to set a variable to the value of an item TP Gain.
    I'm using the script in a common event, called from an event in parallel.

    This does not work :
    Code:
    $gameVariables.setValue(1185, $dataItems[$gameVariables.value(1043)].tpgain);
    But this does :
    Code:
    $gameVariables.setValue(1042, $dataItems[$gameVariables.value(1043)].name);

    Any help?

    Edit 2 : Found the problem, lack of capitalization. It's tp.Gain and not tp.gain
  5. Is this the best way to add code to existing methods? I am worried this would be intolerant of other plugins.

    JavaScript:
    Graphics.FPSCounter.prototype._createElements2 = Graphics.FPSCounter.prototype._createElements;
    
        Graphics.FPSCounter.prototype._createElements = function() {
    
            this._createElements2();
    
            Jams_Debugger.Manager._boxDiv = this._boxDiv;
    
        };
  6. How to code this in javascript?

    Screenshot 2022-04-27 173601.jpg

    Update: Nevermind. Found it.
  7. Ignore this
  8. So ive been looking but maybe im just too impatient to find it.
    I am just in need of the script call for when an item is used.
    I am using it in a conditional branch that is based on if the item was used...
  9. AlphaOmega said:
    So ive been looking but maybe im just too impatient to find it.
    I am just in need of the script call for when an item is used.
    I am using it in a conditional branch that is based on if the item was used...
    I can't fathom what you're trying to do based on your post, but the function to use an item is...useItem().

    Game_Battler.prototype.useItem in rpg_objects
  10. Hello all,

    I am currently working on my battle HUD and I would like to add a window with the parameters of the active battler

    Do you know what plugin can I use ?

    I am on RPG MV.
  11. Boonty said:
    I am currently working on my battle HUD and I would like to add a window with the parameters of the active battler

    Do you know what plugin can I use ?
    This would really be better as a new thread in Plugin Requests, as it doesn't ask anything about using JavaScript :wink:

    But there are a number of plugins and tools for helping you to make HUDs and windows. SRD's HUD Maker and Luna Engine come to mind.
  12. ATT_Turan said:
    I can't fathom what you're trying to do based on your post, but the function to use an item is...useItem().

    Game_Battler.prototype.useItem in rpg_objects
    I thank you for your reply, and that helped thanks! It may not have made sense to you, but it was what i needed ;)


    So that brings me to the other thing i am trying to find
    in implementing subjugate from Yanfly tips and tricks and having issues figuring out where the debuffs are getting the icons assigned from
    basicly where is it in the system telling which icons to use....

    // Add DEF buff to user
    user.addBuff(3, turns);
    // Add MDF buff to user
    user.addBuff(5, turns);

    i would just like to change the icon IDs assigned to them since i have a full custom icon sheet already made... and this was a spur of the moment addin.... but not sure where to look to do so any help is appreciated!!
  13. Quick question: Is there any reason I should use one of these over the other?
    (a.equips()[1] ? 2 : 3) vs (!a.equips()[1] ? 3 : 2)
    I'm basically trying to check whether the 2nd weapon slot is empty or not.
  14. Frostorm said:
    Quick question: Is there any reason I should use one of these over the other?
    (a.equips()[1] ? 2 : 3) vs (!a.equips()[1] ? 3 : 2)
    I'm basically trying to check whether the 2nd weapon slot is empty or not.
    if you can make a syntax without !, it will perform better since ! is an operator, so it does the same thing as the first, but it has extra work changing the boolean value of a.equips()[1].

    Its not like something that will visibly effect your game, but for good practices try always to code as the first one :ysrs:
  15. If I want to include the percentage of CNT in a damage formula, do I have to do like this?

    100*a.cnt
  16. Indinera said:
    If I want to include the percentage of CNT in a damage formula, do I have to do like this?

    100*a.cnt
    I'm not sure that's a JavaScript question so much as basic math, but yes :stickytongue: You express a decimal as a percentage by multiplying by 100.

    I think the JavaScript portion of the question is...why would you want to do that in a damage formula? If you're using it to express a percentage of something, you'd do that by using the decimal, which the parameter is already formatted for.
  17. Any script that clears the current balloon from the player?
  18. boikish said:
    Any script that clears the current balloon from the player?
    This should work:
    JavaScript:
    for (const sprite of SceneManager._scene._spriteset._balloonSprites) {
        if (sprite._target._character == $gamePlayer) {
            SceneManager._scene._spriteset.removeBalloon(sprite);
        }
    }