Skill that targets dead enemy, restores user HP, then "erases" dead enemy?

Featherbrain

Prehistoric Gamer
Veteran
Joined
Jan 12, 2020
Messages
64
Reaction score
68
First Language
English
Primarily Uses
RMMV
Trying to achieve something like the persistent corpses in "Darkest Dungeon" (https://darkestdungeon.gamepedia.com/Corpse) where enemies leave a corpse on the battlefield that preserves the original rows/formations until it is destroyed by the player or disappears over time.

I also want a PC skill, "Scavenge", that ONLY targets dead enemies, consuming the dead enemy for half of its max HP and then destroying the corpse/removing the enemy from the battlefield.

I've got the dead enemies remaining on the battlefield rather than disappearing using YEP_X_Animated Sideview Enemies and custom "dead" animations in the spritesheet.

Today I tried making a custom "Corpse" state that basically mimics the "Knockout"/dead state, and a "Scavenge" skill that can only target the "Corpse" state using Target Core and Selection Control commands. Using Troop controls I have it set so if an enemy reaches 0 HP the "Knockout" state is removed, a tiny amount of HP is restored, and the "Corpse" state is applied. I set "collapse" back to true for the "Knockout" state so when enemies are hit in the "Corpse" state they automatically go to the "Knockout" state and disappear.

This seems to kinda sorta work, up until the point I actually use Scavenge on an enemy; it displays the animation and plays the sound, then the game crashes with an error message.

How would you go about achieving this gameplay? What am I doing wrong with my approach? Is there a simpler approach? Thanks!
 

Attachments

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
well I see that your damage formula is wrong/mistyped

part of it says b.mph

should be b.mhp

did you fix that part yet?
 

Gregaur

Veteran
Veteran
Joined
Jan 3, 2017
Messages
134
Reaction score
20
First Language
french
Primarily Uses
RMMV
I will follow this thread as I want to create some necromocian skill with the possibilities to ressurect an enemie and apply a "controle" state :)
 

Featherbrain

Prehistoric Gamer
Veteran
Joined
Jan 12, 2020
Messages
64
Reaction score
68
First Language
English
Primarily Uses
RMMV
well I see that your damage formula is wrong/mistyped

part of it says b.mph

should be b.mhp

did you fix that part yet?

Thanks lol, that instantly solved the crash. I'm glad it was something simple. The formula was still wrong though since it sets the user's HP to exactly half the enemy's total HP, what I actually wanted was to add half the enemy's total HP to the user's current HP, and in only whole numbers/integers:

a.setHp(a.hp + Math.round(b.mhp / 2))

Everything seems to be working as I'd expect it at this point. Thanks again!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I think I've created a monster.
...and I love it. <3
Today represents my one year anniversary of throwing out the tile map. :LZSexcite: One year ago my game looked like...


And now for those that don't know, it looks like..


What a year, what a year indeed. RIP Tile Map, nobody misses you. :LZSwink:
There is now a demo released for [Beyond the Mirror]! Check the team recruitment thread to learn more!
'Tis the season to see shipping prices and go 'Yikes'.

Forum statistics

Threads
105,696
Messages
1,015,681
Members
137,380
Latest member
UGANDAN_KNUCKLES
Top