Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Steal HP/MP on Kill


Kaejer
 Share

Recommended Posts

I'm currently in the process of trying to make it so when you kill an enemy it steals an amount based off of the NPC/Player's max HP and adds it to your MP. I have tried a few things and seem to be failing and running out of logical options (for me). I'm really rusty… again, so it may be an obvious fix for some of you guys.

Here is my line of code I'm attempting it with right now, which doesn't work.

```

Call SetPlayerVital(attacker, Vitals.MP, GetPlayerVital(attacker, Vitals.MP) + GetNpcMaxVital(mapNpcNum, Vitals.HP) / 5)

```

It's in the PlayerAttackNPC sub after the enemy has been killed. My current test NPCs have 25 health or 50 health.

I plan to do this for the other subs for PlayerAttackPlayer, but it'll be roughly the same after I get this first part to fix.

RESOLVED:

```

Call SetPlayerVital(attacker, Vitals.MP, GetPlayerVital(attacker, Vitals.MP) + (GetNpcMaxVital(npcNum, Vitals.HP) / 5))

Call SendVital(attacker, Vitals.MP)

```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...