Jump to content

Damage as a percentage of Max HP

Recommended Posts

I vaguely remember creating an item or spell effect years ago that caused a percentage of a target's Max HP in damage periodically and would after enough time kill the target. A bleed effect, basically. The problem is, I don't remember how I did it. (Or even if I really did do that or if I am just misremembering.)


I've tried using the percentage damage types in opcode 12 (Damage) but they only work with Current HP so after each "tick" the effect causes less and less damage. Opcode 17 (Current HP Modifier, used for healing) does work with Max HP but can't kill a target. In fact it will bug the target and give them negative HP. Opcode 17 is completely unacceptable here because the intent is to kill the target if it isn't healed through the effect, not put them in a bugged state.


Anyway, is it possible to cause damage to a target based on its Max HP?

Link to comment

I'm running what I believe you guys call "vanilla" and my opcode 12 is a little different than those.


1---Crushing Set to Value
2---Crushing Set to Percentage
3---Crushing (save for half)


My #2 is the one I described using in the first post. I don't actually know if my #3 works as it should since, for example, my game's Fireball spell uses two sources of Fire damage. One with a saving throw enabled and one without. But in any case I believe it's basically the same as #0.


The #3 you posted looks like it should work the way I want... Now I wonder if over the years I picked up an Enhanced Edition and am remembering working with that. *sigh*

Link to comment

That looks like IWD2 - it's damage opcode is setup differently from every other game.


I think the closest you'll get there is:

Opcode 17: -XX%

Opcode 12: 1 damage - to properly "kill" targets. Any valid type will do, damage reduction will not block the death.

Link to comment

I forgot to mention in my first post that I only have SoA and ToB installed, sorry. I don't even have BG1 installed at the moment.


If my game is using IWD2 opcodes, how and why?


I just checked my DLTCEP (7.4b) setup and it is set to read BG2Effects.dat.




I just got around to trying your idea, kjeron. It bloats the effect a little, but it works just fine. Thanks! :)

Edited by IDontKnow
Link to comment

3 Crushing Reduce by Percentage is a vanilla feature, apparently. Except in iwd2, where it is save for half.

Old DLTCEP effect desc might be using the IWD2 syntax only because at the time we didn't know how that bit works, except in IWD2.


Save for half can be achieved in EE in a different way (special field, bit 0x100).


Doesn't set to 0 percentage (2), or damage 101% (3) work just as you wanted?

Link to comment

Apparently the DLTCEP effect description is incorrect, on my end at the least.


Using damage type #3 (Described in my editor as; Crushing (save for half)) and setting the damage amount to 10 caused the target to take 10% of its Max HP in Crushing damage. I applied the effect several times to be certain it was using the target's Max HP rather than Current HP. I also checked with Piercing's #3 (#1048579) damage just in case, and it worked there too.


#2 and #3 use the target's Current and Max HP for damage calculations, respectively. For example, say the target has 10/100 HP. If #2 applies 50 damage, the target will be lowered to 5/100 HP. Using the same target with #3 applying 50 damage lowers the target to -40/100 HP. I don't know how the game handles HP that is a fraction somewhere between 0 and 1, so I don't know if #2 could ever kill a target if less than 100% damage is applied. #3 however will quite happily kill a target and is also precisely what I was looking for.


So, the solution was there the whole time, it was simply mislabeled. Thanks! :)


(Now I just have to remember what #3 actually does...)

Link to comment
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...