How to make Guard increase defense by a specific number?

Do I'm trying to make guarding increase defense by an exact number. In the database, I have Skill 2 set to add the state Guard. Then, the default option is "Special Flag, Guard" but I don't know exactly how that guard effect works.

I know that I can set a parameter to multiple defense by a percentage value, but as far as I can tell, there isn't a way to just ADD defense.

On a totally different note, is there a way to disallow the attack command if the user doesn't have a weapon equipped at all? I was also wondering the order of operations with skills. Does it check if the target is weak to the element of the attack BEFORE or AFTER it runs the formula for HP Damage? And if it runs it after, is there a way to change it to before without a plugin? The reason is because my numbers are very low, (The main formula for attack is just a.atk - b.def, so if the user has an attack of 1 and the victim has a defense of 1, it would do zero damage, so if the formula applies before, then the enemy would take 0 damage even if it's 200 percent damage scale for the element of the attack.)

Thanks in advance, sorry if I'm supposed to post multiple threads for this I just figured they were both quick and easy questions.
I know that I can set a parameter to multiple defense by a percentage value, but as far as I can tell, there isn't a way to just ADD defense.
There is no simple way to do it, no. You'll need a plugin for this and there are lots of different ways to go about doing it. However, one thing you CAN do without plugins is use common events, which can change around equipment, modify stats permanently, literally anything regular eventing can do. While you can easily set up bonuses that last a whole battle this way, trying to make a different "Guard" is much harder.

Then, the default option is "Special Flag, Guard" but I don't know exactly how that guard effect works.
Guard halves all damage and I believe it's done very late in the damage check, after everything else. But GRD (Guard Effect) actually modifies that further. So, more accurately;

Damage / (1 + GRD)

GRD defaults to 100% (or 1), so increasing or decreasing it will increase or decrease the divisor*.

*I hope I actually got the formula right, another place I checked says it's "Damage / (2 * GRD)" which seems absurd.

is there a way to disallow the attack command if the user doesn't have a weapon equipped at all?
Without plugins, no, but you can sort of make it work without plugins. Note that it's important that a character can choose something to do on their turn in combat, otherwise you might accidentally softlock. One way to get around needing a weapon is to remove the hit rate bonus in Class (defaults to 95%) and put hit rate directly onto weapons. This'll make it so Attack (and any other physical skill) will always miss without a weapon. This of course assumes that weapon choice comes up; I did make one game where everyone had a unique weapon they couldn't unequip.

WeaponSkill does come with the RTP and should show up in your plugins list. To accomplish having an Attack you can't use; make a second Attack skill that does what you want Attack to do, have all weapons use that in place of regular Attack, make another Skill Type that no one will have, make the regular Attack (ID:1) skill that skill type, and then seal that skill type on all actors (just have enemies use the second Attack skill). This will make it so if you are unarmed, you can't select attack. Mind, there are plugins out there that also make it impossible to have no weapon and you might like that more. Here's Yanfly's (free) Equip Core that has that as an option;


Does it check if the target is weak to the element of the attack BEFORE or AFTER it runs the formula for HP Damage?
Mathematically, it wouldn't do anything to check before the damage formula because it wouldn't have anything to affect. But if you specifically want it to affect only part of a formula, you can actually put that in the formula directly; If we assume Fire is element id:2,

a.atk * b.elementRate(2) - b.def

This will modify the user's atk by the target's elemental rate and then apply def. Note that if the skill is set to Fire element, it'll then modify damage again afterwards. You can solve this by not having the skill have an element, which is easy enough for regular skills but not for Attack if your weapon changes your attack element. Which isn't something I offhand know how to solve.


Thanks in advance, sorry if I'm supposed to post multiple threads for this I just figured they were both quick and easy questions.
You're welcome! I actually am unsure myself if this needed to be multiple threads or just one. However, if you go asking about plugins, it's usually best to restrict that to one request just to make everyone's lives easier.
I mean unless neither your player nor the enemies get any stronger during your game, having a fixed amount of added defense would become less and less useful.

On a totally different note, I would recommend achieving low numbers in a different way than trying to get around RMs way of calculating things. Might be a lot easier.

Overall I'd say keep your numbers low, but not so low that you end up having trouble with calculations (like you do right now)

You can use plugins like Hime's actor battle commands to remove attack/guard and put in your own. (For example you put a skill type as the regular attack command, then have your weapon add skill "attack" when equipped, it should then show up whenever you got a weapon equipped)

There are many ways to achieve what you want.
On a totally different note, is there a way to disallow the attack command if the user doesn't have a weapon equipped at all?
It depends on how many weapon types you have - there are two dropdowns at the bottom of the skill window that list required weapons, so the actor must be using one of those two weapons in order for the skill to function.

I'm not sure why you need to do this, though...if a player intentionally removes their weapon, the loss of ATK in a low-number game should be penalty enough without making them completely useless in battle. Or, if there's some scenario where you intentionally strip them of their weapons and want them to be unable to fight, it's probably easier to apply a state that seals the Attack skill.
Thanks for the replies! I've decided to just have the weapon grant 1 attack and allow the user to unequip them if they so choose.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-guard-increase-defense-by-a-specific-number.153296/