[VX ACE] REGAIN MP ON GUARD.

Posts

Pages: 1
As of right now I have a system where battlers regain 25% of their MP when they Defend. However there is some equipment that raises or lowers this amount gained. How do I do that in the program?
How are you currently having it regenerate MP when they Defend? I've got a vague notion of how to go about doing it, but I'm curious as to what you're using now and if it's possible to adapt it or if you'd have to do something new.
This is how I got it.

All right, so - by default, all characters regenerate 25% of their MP when you make them guard. What percentage should other types of armor regenerate? And what numbers do those armor types occupy on your "armor type" list? Is it only based on body armor?

I'll work on something and get back to you with it and the customizations you'll need to match your database.
The percentage would be variable, lower or higher depending on what is equipped. It can be based on any kind of equipment.
Are the armor modifiers applied additively or multiplicatively? Also do they apply to anything besides defend?

My horrible hack would be to add a tag to armor of said amount. Then have the hack check when the user uses skill #2 to calculate the sum/product of said values and apply it to the base RecoverMP amount then execute the skill.
Hmm, let me get back to you on that.
Yeah, that's basically what I've got written (it's on my other PC and not fully tested yet) - the hack thing, though I haven't written in tag support yet as I've always hated working with tags and tend to leave that stuff until last. I've been looking for an alternate solution that might work a little more elegantly, but it's a pain sometimes.

A personal suggestion is multiplicatively, as additively can get out of hand if you stack the right gear (ie. if you don't watch your balancing and numbers, it can recover 100% MP in a single turn).
Appologies for the double post but wanted to make sure this was seen:

module KTM
module REGEXP
module BASEITEM
MP_REGEN = /<(?:MP_REGEN|mp regen):[ ]*(\d+)([%%])>/i
end
end
end

class Game_Battler < Game_BattlerBase

def item_effect_recover_mp(user, item, effect)
value = (mmp * effect.value1 + effect.value2) * rec
if (item.is_a?(RPG::Skill) && (item.id == guard_skill_id))
value *= mp_regen_adjust(user)
end
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.mp_damage -= value
@result.success = true if value != 0
self.mp += value
end

def mp_regen_adjust(user)
mpra = 1.0
for armor in user.armors
mod = 1.0
note = armor.note
note.split(/[\r\n]+/).each { |line|
case line
when KTM::REGEXP::BASEITEM::MP_REGEN
mod = 1 + ($1.to_f / 100)
end
}
mpra *= mod
end
return mpra
end

end

Currently works multiplicatively. Standard install method - paste above Main but below Materials. Used by adding a notetag to any piece of armor:

<mp regen: x%>

Only works using armor at the moment. I can't guarantee compatibility with any custom battle systems as it's written, but can try to work it in if it's necessary.

Sorry for taking so long to get back to you on this; I hate regex and ended up just using Yanfly's as a basis for the actual regex. Tested and working in an otherwise blank project (actually, that's slightly a lie - tested and working in a project with Yanfly Ace Menu Engine and the mod I did for unity, but that doesn't affect this in anyway).

Let me know if there's any errors and I can fix them up (I only did rudimentary testing - two items with MP Regen on a single character in test battle).
I'm pretty sure you can make the guard skill recover MP by changing Type to MP Recover in the frame just above the Effects frame, then use a custom formula to get the results you want.

If you're comfortable implementing your own damage reduction state that doesn't rely on the guard flag, you could repurpose guard effectiveness to be your "how much MP do I recover on guard?" stat.

In the formula box, a.grd and b.grd reference the guard effectiveness of the skill user and the target respectively.
author=pete_mw
I'm pretty sure you can make the guard skill recover MP by changing Type to MP Recover in the frame just above the Effects frame, then use a custom formula to get the results you want.

If you're comfortable implementing your own damage reduction state that doesn't rely on the guard flag, you could repurpose guard effectiveness to be your "how much MP do I recover on guard?" stat.

In the formula box, a.grd and b.grd reference the guard effectiveness of the skill user and the target respectively.


The standard damage formula isn't robust enough to do what he wanted. He wanted to be able to, based on the equipped gear, alter the percentage of MP that they regenerate. The damage formula box doesn't allow for things like that without scripting, at which point you might as well just do it the easier way.
author=Travio
The standard damage formula isn't robust enough to do what he wanted. He wanted to be able to, based on the equipped gear, alter the percentage of MP that they regenerate. The damage formula box doesn't allow for things like that without scripting, at which point you might as well just do it the easier way.


I know what he wants to do, I'm pointing out that it actually can be done without too much hassle without needing scripting. Make a custom guard state that doesn't use the guard flag, have the armour in question influence the GRD SP-parameter, and then use a formula like:

0.25 * a.grd * a.mmp

for the amount of MP regenerated.
Pages: 1