Help creating a skill formula!

Hi! I want to make a skill that switches the TP of the target with the HP of the target! But I don't know how to make it happen? I tried using common events, but it just doesn't work? I guess i need a formula for the attack, but I don't know how to approach it! Can anyone here help me by chance?

Thanks!
SW = b.tp; b.tp = b.hp; b.hp = SW; [Damage Formula]

This should work. SW can be renamed to anything. If you don't want it to do damage, putting 0 is fine though you'll have to find a way so "does 0 damage" doesn't show. It's possible, but I don't remember how.
SW = b.tp; b.tp = b.hp; b.hp = SW; [Damage Formula]

This should work. SW can be renamed to anything. If you don't want it to do damage, putting 0 is fine though you'll have to find a way so "does 0 damage" doesn't show. It's possible, but I don't remember how.
Yeah! Something along those lines... But there's a problem - the HP translates fine to TP with your formula but when the TP is applied as HP, it becomes this long small decimal number... Like 0.7,678,650 etc. etc. But it's starting to get there! Any ideas? 🙂
Yeah! Something along those lines... But there's a problem - the HP translates fine to TP with your formula but when the TP is applied as HP, it becomes this long small decimal number... Like 0.7,678,650 etc. etc. But it's starting to get there! Any ideas? 🙂
Aight, did some testing. Do this:
SW = b.tp; b.tp = b.hp; b.hp = SW.floor; [Damage Formula]

This will force it to round down due to the ".floor" added when you are making their HP equal their TP.
SW.round would be better for it will simply remove the decimals.
SW.round would be better for it will simply remove the decimals.
On testing, it can round up when it shouldn't which is why I use floor instead. The number before the decimal is always the number the TP was, so making it floor reduces the chances of it rounded up when the rounded down answer is always right anyways.
Aight, did some testing. Do this:
SW = b.tp; b.tp = b.hp; b.hp = SW.floor; [Damage Formula]

This will force it to round down due to the ".floor" added when you are making their HP equal their TP.
Thanks for taking you're time to help me I really appreciate it! It's a lot closer! When i use the HP Damage type, the one actor dies instantly. But when i use the HP recover type, they heal - but double the amount... So I've set it to the element Holy, and made the class of the actor 50 % immune to Holy attacks, and it works! But they still heal a little bit, but I'll take it 🙂
Thanks for taking you're time to help me I really appreciate it! It's a lot closer! When i use the HP Damage type, the one actor dies instantly. But when i use the HP recover type, they heal - but double the amount... So I've set it to the element Holy, and made the class of the actor 50 % immune to Holy attacks, and it works! But they still heal a little bit, but I'll take it 🙂
Weird. Have you put 0 where it says damage formula but without brackets?
Ah of course! Works like a charm! 🙂 Thanks a ton
Weird. Have you put 0 where it says damage formula but without brackets?

Original thread: https://forums.rpgmakerweb.com/threads/help-creating-a-skill-formula.154189/