Life stealing skill

Solved 5 replies · 3434 views

battledrainformulaskillvariable

The Ramen Dutchman 1 likes received

Hi all!

I'd like to give my Bats a life-stealing skill, similar to Zubat's Life Leech, but I'm running into some problems.

What works:

Dealing damage (duh)

Healing self with a set amount afterwards

What doesn't work:

Self-healing based off the damage

What I have so far:

Imagelife-draining-skill-overview

A skill that targets one enemy of choice, deals damage to HP (called Life Points in my game) and sets the damage in a temp variable.

Imageit-deals-damage-and-sets-a-var

Afterwards it recovers 10 LP

Imageraise-lp-by-exactly-10

Is there a way to read a formula in script?

For example `u.lp += v[101]` to raise the user's LP by the value of variable 101?

P.S.: If my images seem stretched, you can right-click them and open them in a new tab or save them, there they look fine.

Edited

Answers

Wano 38 likes received Admin Accepted answer

Doing u.lp += Core.Game.current.variables[101] works?

The Ramen Dutchman 1 likes received

@wano Yep it does! Thank you very much! I should really try to find things in the documentation/code better >.<"

Xion 0 likes received

@wano I use this formula "u.lp += Core.Game.current.variables[101]" How can I avoid HP overflow?

Game9IUJY7tinn.png

Wano 38 likes received Admin

Maybe try "u.lp = Math.min(u.lp + Core.Game.current.variables[101], u.maxlp);"

Back to Questions