RMMV Damage Formula - ideas and help

Discussion in 'RPG Maker MV' started by Shaz, Oct 25, 2015.

  1. Aesica

    Aesica undefined Veteran

    Messages:
    748
    Likes Received:
    710
    Location:
    SW5GMW 4xVHk
    First Language:
    English
    Primarily Uses:
    RMMV
    I thought about that, but I have a ton of skills already, however in retrospect, maybe I should've because if I ever decide to change my damage formula (99.9% sure I won't, though, I'm quite happy with it) then I'll have a lot of skill review to do.

    Close, although in retrospect, maybe it would've been better to have it key off the actor's atk (or other stat) if iLength comes up 0. Easily fixed in just a moment though.

    In its current form, it "returns the total atk value of all equipped weapons, or 0 if no weapon is equipped. If the caller is an enemy, return its atk."

    Edit: Updated it to work like so: "returns the total of a given stat on all equipped weapons (atk by default) or the user's total atk value if no weapon is equipped OR if the caller is an enemy."
     
    Last edited: Aug 1, 2018
  2. Guanto

    Guanto Auteur Veteran

    Messages:
    111
    Likes Received:
    10
    Location:
    Las Vegas, NV
    First Language:
    English
    Primarily Uses:
    RMMV
    Well well well.

    So I do like this, and as mentioned I wont be using "plugins" per se (stuff made with fancy flexible user parameter boxes and aliases) but I will for sure be using my own, project specific, js files much like Engr. describes his use of damage formulas.

    At the same time, I cannot believe what it takes, vs what I thought it, and apparently what it used to, take.

    BTW I'm going to start using this line.

    And Engr, you figured out how to hotlink the user names... do tell?

    EDIT:

    Wait... thinking out loud...

    Remember I would only want to use a weapons ATK sans base ATK if a certain weapon was equipped (I originally mentioned projectile weapons, like "gun") and I would just control that through the skills 'required' weapon feature - meaning - we wouldn't have to check if a weapon was equipped, we know it is or the skill couldn't be used, so we just gotta suck the damage from that weapon we know is being used and ignore the users base ATK. So I think in this case the script may be even less involved? (AKA we already know he has a weapon so just grab its atk).

    Attack skills that don't use a missile weapon (or whatever, a weapon that doesn't utilize a characters physical strength in my mind) simple get a more traditional damage formula.

    The flipside of this (a problem that didnt occur to me when first bringing this up) is when using a "normal attack". If I called this script and the character had a sword (an instance where I want to include the base ATK) -- would the script see he has a weapon and ignore the base ATK, even though for this instance we want it? To make matters worse if the character was using "normal attack" and did have a "gun" we would again want to exclude base ATK. Ugh.
     
    Last edited: Aug 2, 2018
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,476
    Likes Received:
    2,869
    Location:
    Philippines
    First Language:
    Tagalog
    You will only call that plugin's function if you want it to ignore base ATK.

    Now if you're gonna make a skill that is usable with any weapon type but depending on the weapon might need to use only weapon atk (like if equipped with gun vs with sword) the plugin won't do it right now.

    To do that, you'd need to have a check of the equipped weapon type to differientiate what would happen.

    as for the hotlink I just do @Username, but after posting I edit it to remove the @.. The actual code was ["user=id"]name["/user"]
     
  4. Aesica

    Aesica undefined Veteran

    Messages:
    748
    Likes Received:
    710
    Location:
    SW5GMW 4xVHk
    First Language:
    English
    Primarily Uses:
    RMMV
    As I said originally, you could get away with using a.weapons()[0].atk in the damage formula, but again, that's rather volatile for all the reasons already mentioned, and it requires the weapon to be equipped in the very first slot, no dual guns or gun + ammo combinations allowed. The plugin function call I made prevents those sorts of mishaps from happening.

    If you want guns and swords to behave differently via the "Attack" command, then you'll need to create a new skill with the intended damage formula. Let's call it "Shoot" and instead of referencing a.atk, it'd reference a.weapons()[0].atk in its damage formula. Next, you'll have to script something that checks the equipped weapon type and, if it's a gun or whatever, it'll need to have the Attack command reference your newly created skill instead of the default attack skill.
     
  5. Guanto

    Guanto Auteur Veteran

    Messages:
    111
    Likes Received:
    10
    Location:
    Las Vegas, NV
    First Language:
    English
    Primarily Uses:
    RMMV
    Well I wouldn't make that skill, it's built in (normal attack). And I completely forgot how it would hose this when asking my question.

    Great minds...

    Guessing there is not a straight forward way to have the vanilla attack command reference a skill of my choosing.

    Thank you both Engr. Adiktuzmiko and Aesica
     
  6. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,476
    Likes Received:
    2,869
    Location:
    Philippines
    First Language:
    Tagalog
    Most people would probably use a weapon attack plugin which allows you to set what skill will be used as "attack" for each weapon.

    or you can just make the initial damage formula check the weapon type and use make it return the correct formula

    The benefit of the weapon attack plugin though is that since ur using a different attack skill per weapon, you can also make them have different effects in case you actually need it.

    If you choose to go the weapon attack plugin route then that's not in the scope of this thread anymore and any questions for that should be in a new thread.
     
  7. udime123

    udime123 Hero Veteran

    Messages:
    59
    Likes Received:
    4
    Location:
    Colorado
    First Language:
    English
    Primarily Uses:
    RMMV
    So... I'm trying to do something that sounds pretty simple, but while trying to accomplish it I've been tearing my hair out for a couple hours now, and after searching the internet for a while, I can't seem to find any indicators of how to do this, even though it feels pretty simple.

    So, I have a skill, let's call it Gauss, which deals (v[n] + a.mat * .75 - b.mdf *1) damage, and it hits twice. It sounds like a pretty weak skill, but the intended gimmick is that you use other skills to boost its raw power, which is what v[n] is for.

    Other skills boost v[n] by certain amounts, with the intention of adding damage equal to v[n] times the number of hits the skill in question deals. The problem is, Gauss is dealing 0 damage, and after doing some troubleshooting, the skill used to boost v[n] (I'll nickname it "Orbit") isn't doing as intended. I've tried two methods of increasing v[n]. The first is using a Note to call a common event that basically redefines v[n]'s value. Doing that crashed my game whenever the skill was used.
    The second method was to try to use the Damage Formula Box for Orbit to see if using it would redefine the variable. Instead, I received damage equal to the variable (which makes sense).

    So obviously I'm doing something wrong, but I don't know how to fix it. There's really two problems here: making the variable directly impact Gauss's damage formula, and making Orbit directly change the value of v[n]. Do you guys know what to do?
     
  8. SwiftSign

    SwiftSign Veteran Veteran

    Messages:
    184
    Likes Received:
    45
    First Language:
    English
    Primarily Uses:
    RMMV
    @udime123
    Orbit should have "Call Common Event" and this should set the Variable to the necessary number. Make sure you're using 'set' - or, if you're using 'add/sub/multiply/etc.' make sure that the variable is set to 0 prior to the battle/skill being used.

    Then it should be fine. If you're still having difficulties post some screenshots and stats for your attacker and defender. From "a.mat * .75 - b.mdf" it looks like it might be doing 0 straight off, so maybe your variable isn't set high enough to counter that.
     
  9. udime123

    udime123 Hero Veteran

    Messages:
    59
    Likes Received:
    4
    Location:
    Colorado
    First Language:
    English
    Primarily Uses:
    RMMV
    After fixing the common event, it does deal about as much damage as I expected after using Orbit. With variance at 0, it deals exactly 29 damage for each hit. The weird thing is, though, without using Orbit first, Gauss deals 0 damage per hit. Orbit sets the variable to 10, so why isn't the unbuffed attack dealing 19 damage per hit?
     
  10. SwiftSign

    SwiftSign Veteran Veteran

    Messages:
    184
    Likes Received:
    45
    First Language:
    English
    Primarily Uses:
    RMMV
    That’ll be the variable messing things up. If you don’t set the variable to zero it won’t have a true value and therefore will mess up your formula.
     
  11. udime123

    udime123 Hero Veteran

    Messages:
    59
    Likes Received:
    4
    Location:
    Colorado
    First Language:
    English
    Primarily Uses:
    RMMV
    Gotcha, so I need to define the starting variable even if I'm using Set. Thanks for the help!
     
  12. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,476
    Likes Received:
    2,869
    Location:
    Philippines
    First Language:
    Tagalog
    @udime123 - since your formula uses v[n], if that variable doesnt have a value yet (meaning its probably returning null), it would then cause an error since your formula will be null + some value (which isnt allowed, hence returns an error), and with the way the damage formula is enclosed in an error catch clause, if it ever encounters any error, it immediately returns 0 as the damage

    Also just to explain why you got damaged when you tried using the formula box to set the variable, its because the engine takes whatever return value your formula has as damage. If you want to use the formula box to set a variable, you'd need to make it return 0 after. So something like

    Code:
     set variable value; 0;
     
  13. Hjaldrbjorn

    Hjaldrbjorn Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Being a fan of low number (I hate it when I see 10's of thiusands or millioms and seeing several hundered at level 3 bugs me to no end) i keep low stats, in most my games, characters start with only 12-16 in a stat. To valculate a normal attack, I do something around a.atk*.80 - b.def*.3
    I also use equipmemt that offers a % reduction in physical damage, especially if it is supposed to be "plate" it will offer armour and physical reduction.
    In my current game, 184atk vs 185 defense with a 26% reduction will do about 80dmg
     
  14. udime123

    udime123 Hero Veteran

    Messages:
    59
    Likes Received:
    4
    Location:
    Colorado
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm all for low numbers, but I'm not really sure this is the ideal way to go about it. Having the basic attack multiplier be less than 1.0 makes the attack stat feel arbitrary. After all, why not just make the stat itself lower and keep the multiplier higher? That way, each number is actually relevant as opposed to having arbitrary stat increases that make less than one point of difference to damage.

    On an extreme note, for really low numbers, I suppose you could go with no multiplier at all. Taking an extreme example, most characters in Paper Mario deal very little damage, where 5 is considered a ridiculous number. You could easily set the formula to be (a.atk-b.def) and have the base def of every enemy set to 1, increasing it for bulkier enemies, while the base attack would go no higher than 4. It's very extreme, but that's definitely one way to go about low numbers.

    (Edit) I'd like to add that obviously there is a place for multipliers that are less than 1.0, such as if the stat is not the main source of damage or if the attack is intentionally designed to be weaker than average. I'm mainly arguing that the main attack formula shouldn't be low.
     
  15. AlecWallace

    AlecWallace Warper Member

    Messages:
    4
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I am working on a formula to incorporate normal hits, critical hits, and Critical Failures. Is there any way to use an “ else if” or “elif” to add additional conditions?
    Ex:
    H=math.randomInt(20)+1; if (H===1) {a.atk*.1} else if (H===20) {a.atk*2} else {a.atk}
     
    jetboost likes this.
  16. jetboost

    jetboost Veteran Veteran

    Messages:
    84
    Likes Received:
    26
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    It ought to work but if you want to work with values lesser than 1 and more than 0 you should use 1/10.
    As far as i know .1 would do nothing and you would get 0.
    Nevermind just tested it, it seems to work.
    I never knew. This is good to know.
    Do you know Yanfly?
    This is one of his plugins its what i use and works for me"http://yanfly.moe/2015/11/07/yep-25-damage-core/"
     
    Last edited: Dec 6, 2018
  17. AlecWallace

    AlecWallace Warper Member

    Messages:
    4
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Awesome! The nested if was what I was really curious about. Thanks for testing it for me!
     
  18. jetboost

    jetboost Veteran Veteran

    Messages:
    84
    Likes Received:
    26
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    No problem had the program open and learned something myself the only error i encountered was the m from math not being an M.
     
  19. Confodere

    Confodere Villager Member

    Messages:
    24
    Likes Received:
    26
    First Language:
    German
    Primarily Uses:
    RMMV
    Hey there. Ive would like to implement a skill that copies the targets state to the user. However, not just one certain state, but all that are available. So if the target has for example a health regen state it copies that and when the target has a shield state it copies that over to the user.
     
  20. ThePotatoOfFire

    ThePotatoOfFire Stop, in the name of candy! Veteran

    Messages:
    153
    Likes Received:
    56
    Location:
    Phoenix Caves
    First Language:
    English
    Primarily Uses:
    RMMV
    @Confodere Damage Formulas might not be the place to go for that particular effect
     

Share This Page