Grunwave

Veteran
Veteran
Joined
Feb 4, 2017
Messages
636
Reaction score
182
First Language
English
<Custom Apply Effect>

target._paramPlus[3] += origin.mdf;

</Custom Apply Effect>

<Custom Remove Effect>

target._paramPlus[3] -= origin.mdf;

</Custom Remove Effect>

I am currently accomplishing this with:


The issue is that, if the Actor dies with this buff up, his DEF is permanently raised.

Anyone know another way to accomplish this? Thank you in advance.
 

Johnny_Ray

Also known as Toby Yasha
Veteran
Joined
Sep 11, 2019
Messages
70
Reaction score
40
First Language
English
Primarily Uses
RMMV
You will need BaseParamControl Plugin.
Try this:

<Custom Apply Effect>
var org = target.stateOrigin(YourStateID);
user.addDef(org.mdf);
</Custom Apply Effect>

<Custom Remove Effect>
var org = target.stateOrigin(YourStateID);
user.minusDef(org.mdf);
</Custom Remove Effect>
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
928
Reaction score
582
First Language
English
Primarily Uses
RMMV
You will need BaseParamControl Plugin.
Try this:

<Custom Apply Effect>
var org = target.stateOrigin(YourStateID);
user.addDef(org.mdf);
</Custom Apply Effect>

<Custom Remove Effect>
var org = target.stateOrigin(YourStateID);
user.minusDef(org.mdf);
</Custom Remove Effect>
While this suggestion is good for removing the extra defense if something happens to the origin, like being removed from the party mid-battle, or being killed (if it's an enemy), it won't solve OPs problem.

The problem here is that on death, states are not removed in the traditional sense. The battler.states array is just cleared. That means no states that have a remove (or leave) effect will have them happen on death, and is why you can't make a re-raise state that would auto-resurrect someone without also making it bypass the death removal.

A <Custom Deselect Effect> might run before the death is actually registered. You could put that on the same state, and have it check if the battler's hp == 0, and then reset his defense that way. Alternatively, you could make this state bypass death removal via the state categories plugin, and it will not be removed upon death, then you can use <custom regeneration effect> to check if the afflicted battler is currently dead, and reset his defense and/or remove the state then.

If the deselect effect doesn't work by itself, bypassing the death removal and then using that same tag to remove the state if the battler is dead probably will work, so you could do that too.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
959
Reaction score
504
First Language
English
Primarily Uses
RMMV
@Johnny_Ray - How would that function differently from the OP? The script calls he's making are changing the parameter, but it's not getting called during the Custom Remove - why would your suggestion, getting called at the same time, work differently?

(as an aside - why create a variable you use only once on the very next line?)

I'd suggest...ninja'ed!
 

Grunwave

Veteran
Veteran
Joined
Feb 4, 2017
Messages
636
Reaction score
182
First Language
English
While this suggestion is good for removing the extra defense if something happens to the origin, like being removed from the party mid-battle, or being killed (if it's an enemy), it won't solve OPs problem.

The problem here is that on death, states are not removed in the traditional sense. The battler.states array is just cleared. That means no states that have a remove (or leave) effect will have them happen on death, and is why you can't make a re-raise state that would auto-resurrect someone without also making it bypass the death removal.

A <Custom Deselect Effect> might run before the death is actually registered. You could put that on the same state, and have it check if the battler's hp == 0, and then reset his defense that way. Alternatively, you could make this state bypass death removal via the state categories plugin, and it will not be removed upon death, then you can use <custom regeneration effect> to check if the afflicted battler is currently dead, and reset his defense and/or remove the state then.

If the deselect effect doesn't work by itself, bypassing the death removal and then using that same tag to remove the state if the battler is dead probably will work, so you could do that too.




<Custom Deselect Effect>

if (target.hp <= 0) {-= origin.mdf * 0.5};

</Custom Deselect Effect>

Is that the correct script?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
928
Reaction score
582
First Language
English
Primarily Uses
RMMV
<Custom Deselect Effect>

if (target.hp <= 0) {-= origin.mdf * 0.5};

</Custom Deselect Effect>

Is that the correct script?
No. You have no reference to the target's current def, so the argument inside the if check has an error in it.

The easiest way to do this would be to remove the state in the deselect effect, which would cause it to do what your <custom remove effect> was already doing. The only difference being this should happen before the actor actually dies, so it should still remove the extra def in that case.

Another thing I'd change is to remove the reference to the origin in anything other than the <custom apply effect>. Things can happen during battle, like a battler could be ejected from the fight, removed from the party, or killed (if it's an enemy), which will cause your remove effect to no longer know what the origin was, or its mdf, so it'll crash when it tries to remove the extra defense.

In your apply effect, set a local variable on the battler:

Code:
<Custom Apply Effect>
target._bonusdef = origin.mdf * 5
target.def += target._bonusdef
</Custom Apply Effect>
It might also be a good idea to prevent this state from giving the bonus defense if it is reapplied, to prevent it from stacking up in a weird way, and causing you to remove an incorrect amount of defense later:
Code:
<Custom Apply Effect>
if (target._bonusdef){
target._bonusdef = origin.mdf * 5
target.def += target._bonusdef
}
</Custom Apply Effect>
With the above change, you'd also want to add a delete target._bonusdefto the remove effect, to allow the bonus to be applied again later.
 

Latest Threads

Latest Posts

Latest Profile Posts


concept: zombie slayer fest.

Lag because of outdated hardware.

Lots todo:
-Terrax lightning should have another step for the flashlight, between up down left right.
-Also Online mv from Nelderson should emit the flashlight from the other player.
-Animation needed for killing the zombie...
Before adding it to #crypchania.
Working on a case. Get all the evidence to prosecute some bad guys. :kaojoy:
But, the game development schedule delayed. :kaoswt2:
The moral of the story: No good deed goes unpunished... I guess...
Except that, nothing to see here. :kaoswt2:
just beat ff7 original for the first time since 2010. having played remake last year, I have a much better appreciation for the original oddly enough. I still like some of the character presentation in remake more, but the original's got a lot going for it.
Ever reach that moment in your life when your juggling a dozen or more projects that you know will never be made but don't have the heart to delete them? Ugh, I hate those moments...
:kaosigh: Why must you hurt me so?

Forum statistics

Threads
111,452
Messages
1,061,217
Members
144,821
Latest member
yoiro
Top