Fix MP Amount at Battle Start / States Apply Automatically at TP level

So I have two questions, as it lists in the topic title.

#1) I recently downloaded the Wine and Roses game and frankly I love the setup. I've been digging through the scripts trying to see how stuff is done, but one thing I can't figure out.

In battle, you regen 3 mp (ENergy) per turn. But at the start of the battle, you have 3 EN already. How do I get a game to do this? I know to regen 3 EN, I have to use the Ex-Param thing for a class. In the case of WaR I see that the max MP is locked permanently at 7, and the bonus is set at 45%, meaning 45% of 7 is regenerated each turn, which gives us the 3.

But what do I do to set it to three at the start? I put in the second half, but I'm starting at 7. I believe it's a script, but somewhere else it mentioned a troop event starting at 0 and calling up a common event, that set mp to 0 at battle start. But the common events called up like that in WaR don't appear to have anything setting the current mp to 0.

#2) This is a question about a game I was thinking of working on, based of what I'd seen in WaR. In it, you have Sanity to replace TP, and it's at 100%, but can go higher with skills or something.

I was thinking about a possible replace for TP called Humanity. Where at 100% you are fully human, while the closer to 0% you get, the more monstrous you become. While I realize TP can be restored, obviously in the contexts of this game you wouldn't regen it over time or through items.

The monstrous bit comes into play with my question. The ability to apply a state to an actor, who's TP/Humanity reaches a certain level. The state is applied in such a way that it doesn't remove at the end of battle, but it would remove if the Humanity level reached a certain point.

The closest game where this type of system exists, that I know of, would be Neverwinter Nights 2: Mask of the Betrayer, in which you can elect to suck souls to feed yourself, but it brings you closer to your evil nature. Another game/rp would be Vampire the Masquerade, in which your actions can add to, or strip away your humanity.

Here is an example, as best I can put it. I'll use TP in place of Humanity to make this easier to understand.

Setup) The character is vampire, traveling from area to area.

Skills)

Feed - You feed on a human-type victim. (-5 TP)

Drain - You completely drain a human-type victim. (-10 TP)

Release - You allow a human-type victim to flee. (Basically the skill forces them to "escape".) (+10 TP)

So in a battle, you can feed to drain their HP, but that reduces your humanity. You can let them go to regain it.

When TP reaches 50, you are in a gray area. The state that applies would, for instance, cut the TP charge rate to 50%. (I believe this would only work with skills/items, but the normal TP regen is set to 0% anyways.) (In theory, I'm thinking this makes it twice as hard to go back up to 100%, but you can go below 50% at a normal rate still.)

Let's say TP reaches 10. You are really bad now. So the above state is still in effect, let's say the skills that recover TP and make you more Human, now have a higher cost.

I think that explains it, but I could be wrong. I'm hoping there are already scripts out there that could cover something like this.

(To make a long question short: I'm looking for a script that would apply/remove a state at the start of a turn, based on the TP value during that turn.)
For the first question, look at Game_Battler line 752 and 838.

Too lazy/incompetent to help with the second question >_>
Thanks.

I thought I had a way to do it, but of course it needs a script or something.

Wine and Roses has a universal troop thing setup to run certain events for every battle by default. It looks like I could set that up, with it like this:

(Note: This is just IF/ELSE theory, and not the way it would look exactly in the engine.)

(Events on the page take place at the end of each turn.)

IF Actor does not have this state

--IF Actor has this level of TP

----apply this state to the Actor

--Else Do Nothing

Else Do nothing

So basically, if they already have the state inflicted, the branch is ignored. If they don't have it inflicted, and their TP is at the requisite level at the end of the turn, it triggers and slaps the state on them.

The problem is that there is no conditional branch based on any parameters. So I think the Conditional Branches would require a script.

This is how I tried to build it in the Database.

@>Conditional Branch: Script: <insert script here>

    @> Change State: [character], +[state]

:    Else

    @>

:    Branch End

The primary condition is set to; End of the Turn, and span is set to Turn. (So, every turn it rechecks to see.

If I understand correctly, it runs the <insert script here>, let's say it does a check on the TP value of one of the actors present in the battle.

If the TP is equal to a specified amount, the script would resolve, leading into the Change State part, otherwise it goes to Else and does nothing else.

On the Change State, it only works on a specific character, but it would add the necessary state as listed.

So basically, the event page would look like this:

Conditional Branch: Is character in the party?

If Yes, then put in mini-conditional branches that run the scripts to check for TP levels, which if successful will apply the state to that character.

And each character would have one of those.

Though I could probably do it like this:

Is character in battle?

Yes - call common event to check TP levels

No - do nothing

Have the universal one run that, which should speed things up more.

Of course, I'm just guessing here. And I'm not much of a scripter, though I don't think it'd take much to write a script to check the current TP level of a specific actor.
It does require scripting if you want it like in WaR.

Spoiler
class Game_Battler < Game_BattlerBase def init_mp; self.mp = 3; end alias on_battle_start_original on_battle_start def on_battle_start on_battle_start_original init_mp end end
But yes, it can be made with events.

For the Conditional Branch try this $game_actors[x].tp = y.
Okay, I think I got it now. Here is all I did. If there is any way to write this differently or to fix what I wrote, please let me know.

Edit: Thanks Mihel. I was about to post this. I did some Google-work and tinkering. And got this written in.

--Troop Battle Event--

Condition: End of the Turn

Span: Turn

Conditional Branch: [Eric] is In the Party

>Call Common Event: [A1 TP Check (50%)]

>

:Else

>Exit Event Processing

>

:Branch End

--Common Event--

A1 TP Check (50%)

Trigger: None

Conditional Branch: Script: $game_actors[001].tp <= 50

>Change State: [Eric], + [Vamp]

>

:Else

>Exit Event Processing

>

:Branch End

>Exit Event Processing

--State--

Vamp

No Removal

MaxHP * 150%

Element Rate Physical * 50%

Element Rate Fire * 200%

I tried that out and I don't see any problems, with that one condition. I ended the first turn, TP is still normally ran, so it was going up from attacks and started at less than 100. It immediately popped up the icon for Vamp.

When I fled, Eric's HP was increased by 50% of normal.

I'm unsure if the Exit Processing is necessary, or if I used it too much.
For the Troop Battle Event you could avoid the need to call a Common Event to check actors tp and use only one conditional branch per actor.

@> $game_actors[x].battle_member? && !$game_actors[x].state?(1) && $game_actors[x].tp <= 50

   @> Do your stuff/Apply the state

   @>

@> Branch End

$game_actors[x].battle_member? checks if x actor is in the battle party, && adds another condition, and !$game_actors[x].state?(1) checks whether the actor is dead; so the event inside the Conditional Branch will run only if all conditions are met.

Note this is the same thing as using 3 conditional branches, it just saves space in the event editor.

Exit Event Processing is not necessary as things are now. You can use it if there are more events you don't want to run if the conditions are not met, but if there aren't any other events it's redundant.
Thanks. I tweaked the formula a little.

$game_actors[x].battle_member? && !$game_actors[x].state?(1) && !$game_actors[x].state?(#) && $game_actors[x].tp <= 50

That way, if you already have the state, it doesn't have to go any farther.

Thanks for the help. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/fix-mp-amount-at-battle-start-states-apply-automatically-at-tp-level.15384/