(RMMV) How to make this damage system?

Discussion in 'RPG Maker MV' started by FoxiePrincess, Jan 15, 2019.

  1. FoxiePrincess

    FoxiePrincess Warper Member

    Messages:
    4
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    First off I know the title isn't the most specific in the world, but this idea is a bit complicated and I have no idea how to sum it up in a short title, so forgive me for that please!

    With that out of the way, I've got an idea for my first real project, though at the moment it's more of a proof-of-concept kind of thing. This is meant primarily for me to share with the people closer to me to gauge the basic ideas and everything, and because of that I'm not using a bunch of fancy custom graphics or musics or anything like that. I bring this up to say that my project is totally vanilla right now, so if plugins or something are required, then I'd have to add them after the fact. Also, while I do have a fair amount of general knowledge, I'm still *relatively* new to a lot of stuff in RPG Maker, especially when it comes to stuff like variables. This is also a learning experience for me.

    Now, the damage system I want to incorporate involves numbers outside of attack and defense, and I'm struggling to find *exactly* how to do it.

    The idea is basically that weapons and spells have a base damage to them (Rather than increasing your attack directly). This base damage is consistent, and will always be the same every attack, provided the stats match up. However, that's where atk and def come into play.

    If your attack is exactly DOUBLE or higher than the enemy's defense, you'll do double the damage of the weapon. If your attack is exactly HALF or less than the enemy's defense, you'll do half the damage of the weapon. As an example, if you have a [Steel Sword] that does 20 damage, you have 10 atk and the enemy has 10 def, every time you *attack*, you'll deal exactly 20 damage. However, if your atk is 20, you'll deal 40 damage, and if your atk is only 5, then you'll do 10 damage.

    The same would go with magic, except it's based off of Magic vs Magic Defense obviously.

    Ideally, having an atk between those two points (Like 15 in this example) would still increase/decrease your damage by a % each point, but still having half and double being the min/max.

    I think of this like a soft-requirement of sorts. It's not just "You need to have 30 atk to wield this weapon", it's more "You can wield this weapon that does 90 damage, but you haven't invested in atk at all, so it's lower than half of the def of all the enemies you're fighting, so you're only going to do 45 with it, making it much less effective, but still at least *usable*"

    I've been poking around, but I haven't quite found any way of doing this yet, and I'm unsure if it can even be done in a vanilla project (Though with that said, I'm *not* against getting a plugin if need-be. I'm trying to keep this as stock as it can be, but I *do* want it to actually function the way I want).

    As a side note, this is much less important in this proof of concept, but it'd still be nice to play around with, I also want to make it so that elemental weaknesses and resistances raise/lower the end damage by a set amount (This being 50%). By the end amount, I mean all the damage would be calculated *before* the element came into play (In the case of multiple attacks, each swing wouldn't get the boost, just the final, added amount). This would affect both weapons with elements imbued on them, as well as spells themselves. Instead of a % weakness or something, it's just "You use a fire attack. If the monster is weak to fire, your damage is increased by 50%. If it's resistant to fire, your damage is decreased by 50%. If the monster is neutral, there is no increase or decrease in damage.

    (And to make sure I'm saying the increases right on the elements, what I mean is, a fire sword that does 10 damage to an enemy, if it's weak to fire it'll do 15 damage, if it's resistant then it'll do 5 damage. 50% of the final damage, which is 10.)

    I hope this is the right place to be asking this question, I've never been very good with forums. I didn't quite mean for this to get so long, but hopefully it's detailed enough to get the idea across!
     
    #1
  2. MushroomCake28

    MushroomCake28 KAMO Studio Veteran

    Messages:
    1,442
    Likes Received:
    2,644
    Location:
    Montreal, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    You could do this without a plugin. You will however need to sacrifice one parameter, maybe luck since that's the less useful parameter usually. So here's how I would do it (without coding, cause I'd prefer just to code the thing):

    1) Rename the "Luck" parameter to "Weapon Damage".
    2) Make it so the new Weapon Damage parameter is 0 by default and doesn't increase with level.
    3) The only way to gain some Weapon Damage stat is with weapons (so the weapon damage parameter will act as your weapon base damage).
    4) In the skills' damage formula use this (ofc, replace a.atk and b.def by a.mat and b.mdf for magical attacks):
    Code:
    a.luk * Math.max( Math.min( (a.atk / b.def), 2 ), 0.5 )
    Now, I can't think of a way to implement your requirement thing to equip a weapon, but the concept of using the weapon base damage corrected by the stats is doable (and I concept I really like). As for the elemental thing, it would work with the default system, so no worries there.
     
    #2
  3. Silva

    Silva Scoobityboo Veteran

    Messages:
    255
    Likes Received:
    114
    First Language:
    English
    Primarily Uses:
    RMMV
    Slightly different approach; this will read the attack of the weapon equipped in the first slot (so won't work immediately with dual wield) meaning that weapon also boosts the actors attack. I haven't included a min or max in my example so this would mean that someone with 3 times the attack will deal 3 times the damage.

    Code:
    a.equips()[0].params[2] * a.atk/b.def
    //physical attacks
    a.equips()[0].params[4] * a.mat/b.mdf
    //magical attacks
    If it's going to be possible not to have a weapon equipped, this would also need an if statement to make sure something is equipped or I suspect this might throw an error (I don't have access to MV to check at the moment).
     
    #3
  4. FoxiePrincess

    FoxiePrincess Warper Member

    Messages:
    4
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh I didn't mean that there'd *be* a requirement, I just meant that this system would essentially *act* like a sort of 'soft requirement', since you can still use the weapon, but it's not as strong if you didn't put points towards the attack (Same with spells).

    I'll definitely give this all a try, thank you!

    How would I make this work for magic spells, also? They're not based off of 'weapon damage' since they're not equipped.
     
    #4
    MushroomCake28 likes this.
  5. MushroomCake28

    MushroomCake28 KAMO Studio Veteran

    Messages:
    1,442
    Likes Received:
    2,644
    Location:
    Montreal, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    @FoxiePrincess Unless you want the spells to work differently, they will work just fine with what I proposed. The truth is that what happens behind the curtains (like in the game's code) is that the weapon will increase the actor's luck parameter. So it's just cheating to achieve the weapon damage feature, but since the game reads the luck (or renamed to "weapon damage") parameter as an actor parameter and not a weapon parameter.

    The system I proposed to you will work for every skill, magical or physical, that uses the formula I provided. If you want spells to scale off something different, you just need to change the formula. Basically, for everything you want to use the weapon damage use "a.luk" in the formula.
     
    #5
  6. FoxiePrincess

    FoxiePrincess Warper Member

    Messages:
    4
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    @MushroomCake28 (Today I learned I can @ people lol) I guess I'm just not sure I understand how exactly spells are going to work with this?

    Every weapon would have an individual damage, which in this case would be the renamed 'luck' stat as a variable. But spells aren't equipped as weapons, they're learned skills, and I meant for them to have their own damage as well. If I had them use the 'luck' stat as well, then the system would break, would it not?

    Because in that case, I could wield a sword that does 100 damage (So, 100 luck), and then a spell that's supposed to do 10 (so 10 luck), but since I have the sword equipped, my spell now does 110?
     
    #6
  7. Silva

    Silva Scoobityboo Veteran

    Messages:
    255
    Likes Received:
    114
    First Language:
    English
    Primarily Uses:
    RMMV
    Just replace a.luk with a number that represents the spells magical power ie.

    Code:
    10 * Math.max( Math.min( (a.mat / b.mdf), 2 ), 0.5 )
    
     
    #7
    MushroomCake28 likes this.
  8. MushroomCake28

    MushroomCake28 KAMO Studio Veteran

    Messages:
    1,442
    Likes Received:
    2,644
    Location:
    Montreal, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    @FoxiePrincess Let me explain it to you by asking how exactly do you want spells to work? I'll guide you toward how to make it work.

    The thing is that there's a difference between the weapon's stat and the hero's parameter. The weapon's parameter increases the hero's parameter, which is effective regardless of the nature of the skill. In this case, even tho luck is renamed into "weapon damage", it is still a hero parameter. It just happens that that hero parameter is the same as the weapon damage.

    EDIT: If you simply want spells to have their own basic damage, similar to weapons but independent from them, it's exactly as @Silva said above. Replace the a.luk by the base damage.
     
    #8
    Silva likes this.
  9. FoxiePrincess

    FoxiePrincess Warper Member

    Messages:
    4
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    @MushroomCake28 @Silva Silva's solution is exactly what I needed for the magic, the system is now working pretty much exactly how I wanted, thank you both so much!
     
    #9
    Silva and MushroomCake28 like this.

Share This Page