Jump to content


Photo

Damage as a percentage of Max HP


6 replies to this topic

#1 IDontKnow

IDontKnow
  • Members
  • 5 posts

Posted 23 June 2018 - 10:13 AM

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?



#2 Grammarsalad

Grammarsalad
  • Modders
  • 469 posts
  • Gender:Male

Posted 24 June 2018 - 07:11 AM

Just asking, but have you tried all possibilities? The iesdp could be more clear here, but looking at 12, I see:
https://gibberlings3...s/bgee.htm#op12

E.g.:
0 Crushing
1 Crushing Set to Value
2 Crushing Set to Percentage
3 Crushing Reduce by Percentage

Both 2 and 3 reduce current hp%?

#3 IDontKnow

IDontKnow
  • Members
  • 5 posts

Posted 24 June 2018 - 01:55 PM

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

 

0---Crushing
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*



#4 kjeron

kjeron
  • Members
  • 100 posts

Posted 24 June 2018 - 03:37 PM

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.

#5 IDontKnow

IDontKnow
  • Members
  • 5 posts

Posted 25 June 2018 - 05:21 AM

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.

 

EDIT:

 

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


Edited by IDontKnow, 27 June 2018 - 04:42 PM.


#6 Avenger

Avenger
  • Modders
  • 3794 posts
  • Gender:Male
  • Location:Hungary

Posted 28 June 2018 - 10:31 AM

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?



#7 IDontKnow

IDontKnow
  • Members
  • 5 posts

Posted 02 July 2018 - 02:29 PM

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...)





Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users