Battle Begin/End Script

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Let me just start by saying that my scripting knowledge is limited at best.

I'm sure there are multiple solutions for this problem, but every time I get close to an answer, I hit a roadblock due to my own ignorance.

Problem - During combat, the maximum HP of party members can and likely will be decreased permanently by most damaging skills. I'm using add_param(0, value) to do this because it allows me to control the MHP attribute with integers as oppose to percentages. After combat, I naturally want the MHP values of the party to be returned normal. I have figured out how to do this with an event, but I'm looking for something more efficient.

If you're thinking I should use a state, then please tell me how I would go about this. The change to the MHP attribute is based on the amount damage dealt by an attack, so it must be plugged into, or directly effected by, the damage formula.

To be thorough, I'll explain the different ways I've attempted to tackle this problem.

Event Solution - At the start of battle on turn 0, I set a variable(HP-Max) to be equal to the actor's mhp. When the battle ends I run the event below.

@> Control Variables: [0002:1.HP-Min] = Variable [Actor 1]'s MHP

@> Change HP: Entire Party, -9999

@> Change Parameters [Actor1]'s, MHP - Variable [0002:1.HP-Min]

@> Change Parameters [Actor1]'s, MHP + Variable [0001:1.HP-Max]

@> Change HP: Entire Party, +9999

I have gotten this to work, but to commit to it completely would require that I set two variables for each actor in the database. Lets just say I have a lot of them...

Script Solution? - I tried running a common event with the script below. I'm using the script N.A.S.T.Y. Extra Stats by Nelderson. The point of this is to avoid using a variable.

p1 = $game_party.members[1]
p1.xstat.ahp == p1.mhp;

It kinda works. I get an error when I try to add more than 1 actor through.

Skill/Script Solution? - I create two skills: combat begin and combat end. One to be cast at the beginning of battle on turn 0, and the other sometime after combat.

Damage Formula: Combat Begin: a.xstat.ahp == a.mhp; add_param(0, -250)

Damage Formula: Combat End: a.add_param(0, -a.mhp);a.add_param(0, a.xstat.ahp)

Then I run the script below as a common event to force these skills

battler1 = $game_party.members[1]
battler1.force_action(138, 0)
BattleManager.force_action(battler1)
Fiber.yield while
BattleManager.action_forced?

Kinda works, except it doesn't. Whenever try this on more than 1 actor, I get an error. I guess force action can't be used on multiple actors at once? idk.

I really just need a way to return the MHP value of all party members to normal after battle.

How would I start off simple script that runs when battle begins and just after it ends?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
== is a comparison.


= is an assignment.


p1.xstat.ahp = p1.mhp
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
== is a comparison.

= is an assignment.

p1.xstat.ahp = p1.mhp
Thanks, that definitely would have caused a problem later, though it seems unrelated to the issue I'm having.

This works.

p1 = $game_party.members[1]

p1.xstat.ahp = p1.mhp

But this doesn't.

p1 = $game_party.members[1]

p2 = $game_party.members[2]

p3 = $game_party.members[3]

p4 = $game_party.members[4]

p1.xstat.ahp = p1.mhp;

p2.xstat.ahp = p2.mhp;

p3.xstat.ahp = p3.mhp;

p4.xstat.ahp = p4.mhp

I get: undefined method error 'xstat' for nil:NilClass
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top