JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 168 of 171 View original ↗
  1. Fischz said:
    ssue was the version of MV used. I tried to use this plugin with 1.5.0: does not work.

    1.6.3: works perfectly fine.

    First time I've run into this unfortunately but I am happy to conclude that the issue was not my reading comprehension
    You'll likely find that with most post 2019-2020 (I think it was around then) plugins. Surprised you've not come across it yet (and surprised anyone is still using 1.5!).
  2. Social_Knight said:
    You'll likely find that with most post 2019-2020 (I think it was around then) plugins. Surprised you've not come across it yet (and surprised anyone is still using 1.5!).

    I try to keep running the version of rpgm for a project consistent to prevent random things stopping working. I think I got lucky then that I never ran into this before :rswt

    Thank you for helping though!
  3. So im using the visustella core plugins for my project, along with mz3d. I'm using the visustella battle core, which has a small collection of damage formulas you can set to be the default. these include formulae based on FF7-10. the benefit to this is that you should theoretically just be able to put in a skill power number (that is a whole number) into the damage formula and handle any extra effects via custom action sequences.

    So to test things out, I set things to ff9 style damage, then went and copied stats from ff9 for a test enemy (trick sparrow), actor classes (based on steiner, zidane, vivi, and quina), and base equipment (they don't start with anything equipped). I set the skill power for the attack command to 0 (as in, the attack formula box just has the number 0 in it), so it functions as a sort of baseline, but my characters are dealing way too much damage and taking way too little damage.

    for example, a ff9 trick sparrow is a lvl 5 enemy that has 191 hp and 10 def. with no weapon equipment and at lvl 1, characters should be dealing less than a hundred damage to them. my expected range is around 50-90 damage per hit for the physical characters, maybe half that for the mage classes. but theyre all dealing like 500 damage with basic attacks, while the monster deals around 15. now, for ff9, 15 damage on a lvl 1 character is a workable amount, vivi at lvl 1 only has 60 hp, but dealing over 200 with basic attacks at the same time is weird.

    how do i check the damage formula so i can figure out where the discrepancy is? there's stats that are missing- monsters have both an attack stat and a strength stat in ff9, for example, and i may just need to add them together if im trying to emulate an enemy of that type. but defensively there's just defense and evasion. worst case scenario i just tweak the stats until they reach the range that im looking for or go back to individual formula calculations, but I'd like to see if theres like a notetagged armor stat that it's expecting in the enemy's notebox and that'd explain why things are so uneven.

    edit: to make things more confusing, the magic damage calculations seem pretty fine, a thunder spell in ff9 is power level 14, and a functionally identical skill (only the number 14 in the damage formula box) deals maybe 120 damage to said trick sparrow with 10 mdef. but all the physical damage calculations on the party's end are way stronger than they should be. a 14 in the basic attack formula makes it deal 600-800 damage. and if i add equipment, basic attacks suddenly start dealing 1500 or more. i feel like there's a substat im missing here, or that having equipment that directly enhances strength like how rpg maker normally handles it is giving way too much of a benefit.
  4. Happy new year!

    I would like skills that reduce MP cost based on missing HP, using Yanfly in MV, but for some reason it seems like the cost is not updating correctly.

    I've been using:

    <Custom MP Cost>
    cost *= Math.round(user.hp / user.mhp);
    </Custom MP Cost>
    This one has a base cost of 40 MP, on a character normally starting with 4, the idea being it's super strong but only works on low HP. On tests, the MP cost stays 40, and then suddenly disappears when the character is on low HP.

    And another
    <Custom MP Cost>
    cost = Math.round(user.mmp * 0.9);
    cost *= Math.round(user.hp / user.mhp);
    </Custom MP Cost>
    This one recovers HP, on a character that has the option to cycle between MP and HP use. Doesn't seem to update the cost when the character is using HP cost skills, though, stays at 90% MP.

    What am I doing wrong?
  5. Social_Knight said:
    What am I doing wrong?
    Social_Knight said:
    cost *= Math.round(user.hp / user.mhp);
    *= sets the value on the left to itself multiplied by the value of whats on the right. Because hp/mhp can only give you values between 0 and 1 and youre rounding it, it means the only thing that happens to the cost is - nothing when hp/mhp is above 50%, or it gets waived when hp is below 50%

    You need to set the cost to itself times the hp% and then round the total value, not multiply it by the rounded hp%
  6. Robro33 said:
    *= sets the value on the left to itself multiplied by the value of whats on the right. Because hp/mhp can only give you values between 0 and 1 and youre rounding it, it means the only thing that happens to the cost is - nothing when hp/mhp is above 50%, or it gets waived when hp is below 50%

    You need to set the cost to itself times the hp% and then round the total value, not multiply it by the rounded hp%
    Ty, thought I was just doing something dumb like that.

    For reference, for anyone else wanting MP cost reduced by missing HP; the revised version is
    <Custom MP Cost>
    slmultiplier = cost;
    slmultiplier *= (user.hp/user.mhp);
    cost = Math.round(slmultiplier);
    </Custom MP Cost>
  7. Yep, it's me again.

    I can't for the life of me figure out how to SET TP to match another value in MV in a Yanfly state reaction.

    I'm trying to track Yanfly Absorption Barrier Points using the TP gauge (which on this character is not gained or used by anything else with YF Enhanced TP plugin). As Barrier Points has the option to apply a state, I use that as a method to track if Barrier is active on the actor. My notetag attempt at this was along the lines of:
    Code:
    <Custom Apply Effect>
    user.gainBarrier(20, 0);
    user._currentBarrierPoints = user.barrierPoints();
    </Custom Apply Effect>
    
    <Custom Regenerate Effect>
    var bpoints = user.barrierPoints();
    if (bpoints !== user._currentBarrierPoints) {
    user._currentBarrierPoints = user.barrierPoints();
    user.setTp(bpoints);}
    </Custom Regenerate Effect>
    
    <Custom Remove Effect>
    user._currentBarrierPoints = undefined;
    </Custom Remove Effect>
    
    <Custom Respond Effect>
    if (user.barrierPoints()<=0)
    remove state 6: user
    </Custom Respond Effect>
    
    <Custom Deselect Effect>
    var bpoints = user.barrierPoints();
    if (bpoints !== user._currentBarrierPoints) {
    user._currentBarrierPoints = user.barrierPoints();
    user.setTp(bpoints);}
    </Custom Deselect Effect>
    I figured Deselect was the best time to track if the barrier had decreased, and then use Regenerate as a backup. However, user.setTp() seems to flat out not work here ~ and I can't even find reference to it in some documentation, just gainTp(), but that's not going to optimal for my purposes as it will require some strange math (I think). And setTp was referenced in a several posts I perused in the process of trying to solve this myself.

    tl;dr -After enemy action, want to set TP to Barrier value so player can see it.
    -----------------------
    And yes, this is already a workaround of sorts, since I can't for the life of me figure out how to force an extra temporary gauge for a single character into MOG_BattleHud ~ SRD's Hudmaker and such just explode the game, so I also can't use those.
  8. Social_Knight said:
    However, user.setTp() seems to flat out not work here
    Just to be sure, you dont mean "target" instead of "user"? The user in a deselect effect is the battler performing the skill. not the one being targeted, nor the battler with the state (unless theyre targeting themself)
  9. Robro33 said:
    Just to be sure, you dont mean "target" instead of "user"? The user in a deselect effect is the battler performing the skill. not the one being targeted, nor the battler with the state (unless theyre targeting themself)
    It's quite possible that I'm getting target/user messed up, yes.

    I did try replacing all of the 'user' with 'target', and certainly when I tried target.gainBarrier(20,0); in the custom Apply effect, no barrier was given at all (the current example is just giving 20 with the skill itself). So I figured it must be user.

    But yes, I want all the effects to apply to the recipient of the state. I'm using the state purely to alter the TP and track the BP/Barrier of the user (and ideally, I'll also add it to a damage calculation later).

    The character in question gets their barrier from being a chronomancer, basically, shifting attacks into the future when she is not there anymore, which is represented abstractly by BP (and TP, because we can't see BP with my Battle HUD).
  10. Social_Knight said:
    I did try replacing all of the 'user' with 'target', and certainly when I tried target.gainBarrier(20,0); in the custom Apply effect, no barrier was given at all (the current example is just giving 20 with the skill itself). So I figured it must be user.
    Im not familiar with the barrier plugin and wouldnt know if theres an issue in there, but in the buffs and states core, all of the "timing effect" notetags (regenerate, remove, apply, etc) have user and target point to the battler the state is on. Its only the "action effect" notetags (deselect, respond, etc.) that distinguish the target as being the target of a skill and the user as the user. I mentioned the deselect effect before because it does make a difference there. Replacing it in the apply effect shouldnt have changed anything.

    Are you certain you changed all the references in the deselect effect? share what the notetag looks like now if you arent

    Social_Knight said:
    <Custom Respond Effect>
    if (user.barrierPoints()<=0)
    remove state 6: user
    </Custom Respond Effect>
    Also you cant put action sequence code here. The tags use JS
  11. Robro33 said:
    Im not familiar with the barrier plugin and wouldnt know if theres an issue in there, but in the buffs and states core, all of the "timing effect" notetags (regenerate, remove, apply, etc) have user and target point to the battler the state is on. Its only the "action effect" notetags (deselect, respond, etc.) that distinguish the target as being the target of a skill and the user as the user. I mentioned the deselect effect before because it does make a difference there. Replacing it in the apply effect shouldnt have changed anything.

    Are you certain you changed all the references in the deselect effect? share what the notetag looks like now if you arent


    Also you cant put action sequence code here. The tags use JS
    Yep, okay that clarification was the hint I needed. For some reason I wasn't aware of the distinction between the timing and action notetags being that way. And thanks for the action sequence derp catch there.

    It is now:
    Code:
    <Custom Apply Effect>
    user.gainBarrier(user.luk, 0);
    user._currentBarrierPoints = user.barrierPoints();
    user.setTp(user._currentBarrierPoints);
    </Custom Apply Effect>
    
    <Custom Regenerate Effect>
    var bpoints = user.barrierPoints();
    if (bpoints !== user._currentBarrierPoints) {
    target._currentBarrierPoints = user.barrierPoints();
    user.setTp(bpoints);
    }
    </Custom Regenerate Effect>
    
    <Custom Remove Effect>
    user._currentBarrierPoints = 0;
    </Custom Remove Effect>
    
    <Custom Respond Effect>
    if (target.barrierPoints()<=0)
    target.removeState(6);
    </Custom Respond Effect>
    
    <Custom Deselect Effect>
    var bpoints = target.barrierPoints();
    if (bpoints !== target._currentBarrierPoints) {
    target._currentBarrierPoints = target.barrierPoints();
    target.setTp(bpoints);
    }
    </Custom Deselect Effect>
    Seems to function now I'm aware of that, ty, though anything else you can spot that could be wrong?
  12. Using MV here. Is there a simple and elegant solution to add an option to the options menu and have that option execute a script when it is clicked? I'm using SRD Options Upgrade so I basically just need a way to link a script execution with an options symbol.
  13. I didnt look into SRD's plugin past the video, but you just need to provide a symbol, a display name, and a description to make an option appear? So you'd just need a way to have the process ok function there run script then?

    Code:
    (() => {
        var aliasOk  = Window_Options.prototype.processOk;
        Window_Options.prototype.processOk = function() {
            var index = this.index();
            var symbol = this.commandSymbol(index);
            var value = this.getConfigValue(symbol);
            if (symbol.contains('Script')) {
                //CODE GOES HERE
            } else {
            aliasOk.call(this);
        }
        };
    
        var aliasStat  = Window_Options.prototype.statusText;
        Window_Options.prototype.statusText = function(index) {
            var symbol = this.commandSymbol(index);
            if (symbol.contains('Script')) {
                return "";
            } else {
                return aliasStat.call(this, index);
            }
        };
    })();

    so theoretically, if the symbol contains "Script" in the name, it should just run the code you put in where I have the comment to put it. if you need anything more specific, youre going to have to give details (and at that point, probably make a thread)
  14. <Removed, can't seem to delete my own post?>
  15. Social_Knight said:
    Hi all, I'm trying to add in a Skill thats only purpose is to add a permanent passive HP Regen state with Yanfly's Passive States in MV (i.e. when you buy this skill, the character now permanently has 2% HP Regen), but I can't for the life of me understand why it's not working.
    please make a plugin support thread for this question. This doesnt appear to be a JS question

    Shaz said:
    If you need help getting a plugin working, please start a NEW thread and include a link to where you downloaded the plugin from.
  16. In RMMZ, Is there any way to edit a skill's success rate in js? I'm trying to make a skill have diminishing chances of success with each use but I can't seem to find anything that references it? I must be blind.
  17. the skill's hit rate is taken directly from the success rate listed within the $dataSkills object, which is taken directly from the skills json file. as far as editing that goes, any change made to it will only last the play session. You should be able to use Turan's hit formula plugin to pull off what you want better.
  18. Not 100% what I was looking for, but, I'll make it work. Thanks.
  19. Hope my question make sense. I'm looking for a script call that's asking 'If the user that is currently acting has X state do XYZ'

    For even more detail, i'm using SRD Timed attack core, and just want the bar to move slower if the user casting has slow state for example. But It would be useful to know how to reference actors.

    I'm using MV
  20. Hi all, I would like to know if there is a tutorial for the scrollable Windows MZ. Cause I really need one right now. Seems my brain can't compute this. Ive found some post in the forum but didn't really give concreat exemple of how to set them up. I've look into the core files, doing some experiments but can't figure out anything about this. I'll be gratefull for some help. Thx