Jump to content

Photo

Opcode 12 (damage) and EE


7 replies to this topic

#1 Galactygon

Galactygon

    Nostradoctopus

  • Modders
  • 728 posts
  • Gender:Male
  • Location:Sweden

Posted 23 December 2016 - 04:25 AM

Much of this is already known: EE expands the use of this opcode so that the special field can be used. In this case, the special field acts as a bitfield as described below.

 

 

Known values for the 'Special' field:
1 - Drain HP to Caster
2 - Transfer HP to Target
4 - Fist Damage Only
0x100 - Save for Half
0x200 - Made save
0x400 - Doesn't wake sleepers

 

 

----------------

Here is a more detailed explanation on life drain functionality (bits 1 and 2). In all cases, the healing amount is identical to the damage inflicted, so resistance against a certain damage type may reduce or even eliminate the amount of hitpoints gained. Damage and healing is not affected by the amount of hitpoints remaining if the creature is killed. For example you can inflict and gain 20 hit points with a Vampiric Touch even if the target has 1 hitpoint remaining.

----------------

If bit0 is set (1 - drain hp to caster) then the effects increases the caster's current and/or maximum hitpoints in the following manner:

  • if the the timing mode is permanent with no duration value specified (at dword 0xe) only the caster's current hp is increased, up to his/her normal maximum.
  • if a duration value is specified (at dword 0xe) then the caster's maximum hitpoints are temporarily increased by the same amount for a number of real time seconds that matches the duration value specified at 0xe. Current and maximum hitpoints are increased by the same amount regardless of injured/uninjured status of the caster.

The temporary maximum hitpoint increase is stored on the caster as an instance of opcode 18 with the special field set to 1. 

 

These added maximum hitpoints do not carry any parent resource so you cannot use opcode 321 to dispel/remove previous instances of added max hitpoints. Also note that the added hitpoints are not dispellable (dispel type is set to 0)

----------------

bit1 (2 - transfer hp to target) works the same way as bit1 except the caster suffers damage and the target gains current (and maximum) hitpoints, as described above. In this case, there doesn't seem to be any limit on extra hitpoints beyond the normal maximum so you can repeatedly increase your max hitpoints. PS:T has similar behavior in Sensory Touch and Blood Bridge, although they both use a PS:T-specific opcode for this.

----------------

bit2 (4 - fist damage only) is used in MONKFLAM.eff via a set melee effect in SPCL238.spl. It applies damage onto a target creature if the caster is attacking with his/her fists.

----------------

bit3 (8) is identical to bit0, in all respects except that hitpoints are not added to the caster's current AND maximum hitpoints if any instances of opcode 18 with special field "1" are carried by the caster.

 

This prevents additional hitpoints from being gained by the life drain functionality of opcode 12 even if the caster were to gain more hitpoints. For example draining and gaining 1 hit point would prevent subsequent hitpoints (both current and maximum) from being added to the caster even if (s)he were to drain 20 hitpoints during this duration. Note that damage is always inflicted even if the caster would not gain hitpoints.

----------------

bit4 (16) seems to be unused

----------------

bit5 (32 - Suppress damage feedback) Does not show damage message in the combat log.

----------------

bit6 (64) and bit7 (128) seem to be unused

----------------

bit8 (256 - save for half) behavior that works if a saving throw is allowed. If this bit is set then the total damage applied will be halved on a successful saving throw instead of being eliminated. Most save-for-half effects in the non-EE games use two separate effects to achieve this (one with a save, one without) that results in two instances of damage text being shown in the combat log if the target fails its saving throw. The save-for-half flag is an elegant way to eliminate the excess text in the combat log and to use a single instance of opcode 12 to handle save-for-half behavior.

----------------

bit9 (512 - made save) "was implemented to support bit 8 (save for half). The saving throw is handled by a separate code (as in all engine versions), so it has to tell the damage opcode that the save was successful.  You can indeed use it for exact expressions where one has to suffer xdy/2 damage. But it is best used with bit 8 so it can eliminate the lame double opcodes of fireball, lightning bolt, etc." -Avenger

----------------

bit10 (1024 - doesn't wake sleepers) EE changes the behavior of opcode 39 to awaken creatures on taking damage. Setting this bit in opcode 12 does not awaken creatures.


Edited by Galactygon, 24 June 2018 - 08:12 AM.

Posted Image

Posted Image

#2 argent77

argent77
  • Modders
  • 823 posts
  • Gender:Male

Posted 23 December 2016 - 04:43 AM

There is a bit more.

Bit 3: Drain to max. HP of caster
Is supposed to increase the caster's max. HP as well.

Bit 5: Suppress damage feedback
Do not show damage message in the combat log.

Bit 9: Made save
This bit is used internally by the game engine.
 



#3 kjeron

kjeron
  • Members
  • 132 posts

Posted 23 December 2016 - 07:43 AM

Bit0/1/3: The Timing Mode still needs to be "Permanent" when using a duration.  Other timing modes do not calculate proper duration - it ends up with an extra (gametime(ticks) * 15) seconds added to its duration.

 

Bit0: For me, this one stacks with itself while Bit 3 does not stack with itself, though both stack with each other.

Bit3: It's identical to Bit 0, except it sets param2 of the Opcode 18 effect to (6) - Unknown, while Bit 0 sets it to (0) - Increment.

 

Bit9: Made save - This is actually "Fail for half".  If you don't make the saving throw, whether because you failed it or there isn't one to make, you only take half damage.  The only practical use I've found is for deal half-odd damage amounts, such as (5d3)/2.

Bit0: This one stacks for me while Bit 3 does not.



#4 Avenger

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

Posted 24 December 2016 - 01:19 AM

Bit 9 (made save) was implemented to support bit 8 (save for half). The saving throw is handled by a separate code (as in all engine versions), so it has to tell the damage opcode that the save was successful.  You can indeed use it for exact expressions where one has to suffer xdy/2 damage. But it is best used with bit 8 so it can eliminate the lame double opcodes of fireball, lightning bolt, etc. 



#5 Galactygon

Galactygon

    Nostradoctopus

  • Modders
  • 728 posts
  • Gender:Male
  • Location:Sweden

Posted 25 December 2016 - 09:06 AM

What is the difference between bit0 and bit3? They both increase caster hitpoints beyond normal maximum while blocking subsequent increases during the duration. What does param2 = 6 for opcode 18 do?


Posted Image

Posted Image

#6 Avenger

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

Posted 28 December 2016 - 12:30 PM

6 does exactly the same as 0 as far as opcode 18 works. They won't be considered equal by the engine. I don't know why this needed a new parameter.



#7 Galactygon

Galactygon

    Nostradoctopus

  • Modders
  • 728 posts
  • Gender:Male
  • Location:Sweden

Posted 04 January 2017 - 11:00 AM

Thanks for the info, I've updated the first post.


Posted Image

Posted Image

#8 Galactygon

Galactygon

    Nostradoctopus

  • Modders
  • 728 posts
  • Gender:Male
  • Location:Sweden

Posted 24 June 2018 - 08:15 AM

I've updated/clarified the differences between bit0 and bit3. I can confirm that bit3 is the noncumulative version of hp transfer in that if the recipient carries any instance of opcode 18 with special set to 1, then no current and maximum hitpoints are added.


Posted Image

Posted Image



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users