TP manipulation

Hi.

I'm trying too have an enemy which has a skill that.....

if it's target (Actor) is at or above X TP, The actor looses X tp and the enemy buffs himself (ideally through using a seperate skill).

if the target has less than X TP, the skill fails, the enemy doesn't buff himself.

I'm already controlling the enemies targeting with battle events and force-action, so what I'ld like ideally is a way to....

A ) set a variable too a specific actors TP

B ) set a specific actors TP too a variable

anyone can point me too a way too do this? thanks!
There are a couple of ways of doing this (as far as I can see). One is through scripting, but it seems to me like you would rather handle this without resorting to scripts.

If that is the case, here's what I would suggest:

Since you're already using Force Action calls, you'll probably know some of this, but I'll spell it out for anyone else who might find it useful.

If you already have a structure in place, try

A )  $game_variables[x] = $game_actors[y].tp

B )  $game_actors[y].tp = $game_variables[x]

in a script tag, where y is the desired actor's index, and x is the desired variable's index.

Otherwise, here's a longer and more in-depth way of implementing a skill that does what you want:

First, create a skill that will drain an actor's TP.

img_3.png

Second, create a state with no effect to 'mark' the target.

img_2.png

Next, create a skill for the enemy to use.

img_1 copy.png

Under the Effects for the enemy's skill, set it to add your marking state, and add a Common Event effect.

img-5.png

In that Common Event, find the marked target with a Conditional Branch (first tab, right under Flow Control). Set the condition to Actor is State Inflicted (second tab, at the bottom). Within that Conditional Branch, for each of your actors, have another Conditional Branch to check the actor's TP. Set the condition of this branch to Script, and enter "$game_actors[2].tp > X" (without the quotes), replacing X with whatever value you want (this can also be a variable ($game_variables[n], where n is the variable id)). Do this for each actor in the party, adding a line to force that actor to perform an action (third tab, under Battle, second from the bottom). Set the action to the first skill you created. Finally, remove the state from the actor (first tab, third down under Actor).

img_4.png

Since you're using Battle Events to do this, you should have the enemy id as a parameter somewhere (I'm not sure how you've got it implemented though). Use that to pass a buff state through Change Enemy State (third tab under Battle, third from the top) to the enemy using the ability.

Hopefully this answers your question, if not let me know and I'll change it as necessary.

Cheers,

Duncan
You can do this in the damage formula.

If the target TP is 50, do this:

if b.tp <=50; b.tp-=50; a.Add_state(x); end; 0

This should check to see if battler b (the defender)'s TP is at or above 50 and if so reduces his/her TP by 50 and then adds state x to the attacker.

All the while doing no actual damage.

(If you want to inflict damage, just change the 0 at the end to what you want.)

Give this a try and see if it works for you.
Thanks!

I just used the script tag too lower the actors TP manually, but knowing I can drain TP in the formula will almost surely help me out later!

(really should mess with formula more)

problem = solved!
Cool! I wasn't aware you could inject scripts into the formula like that!

I guess you learn something new every day 😛 .
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/tp-manipulation.18199/