Jump to content

Improved handling of troll regeneration


argent77

Recommended Posts

I have recently made an attempt to further improve the falling-down mechanism of trolls, which had been initially improved in EE games by moving it from script to spell effect, but still only triggers once per round.

My change includes a second opcode 232 (Cast spell on condition) to the trolls' TROLLREG items which triggers an intermediate spell on "TookDamage()/instant" that executes the original falling-down spell (TROLLREG.SPL, etc.) when the current hit points fall below a certain threshold.

The result of this change is that trolls will immediately fall down and are susceptible to elemental damage without being invulnerable for another full round (in the worst case).

Would such a (quite radical) change of the regeneration behavior be suitable for inclusion in the EE fixpack?

Can you think of unintended side effects this implementation might introduce? I have only tested it with direct damage and continuous poison effect damage, which both worked as expected.

Relevant WeiDU code:

Spoiler
// Intermediate filter spells
ACTION_DEFINE_ASSOCIATIVE_ARRAY reg_spl BEGIN
  // original SPL resref, cur. HP => intermediate SPL resref
  "trollreg", 12 => "#trollrg"
  "cdhgtrl", 12  => "#cdhgtrl"
  "cdtrlblz", 12 => "#cdtlblz"
  "cdtorgal", 12 => "#cdtorgl"
  "cdiwdtr1", 10 => "#cdidtr1"
  "cdiwdtr2", 10 => "#cdidtr2"
END

ACTION_PHP_EACH reg_spl AS keys => resref2 BEGIN
  OUTER_SPRINT resref1 $keys("0")
  OUTER_SET cur_hp = $keys("1")
  COPY_EXISTING "%resref1%.spl" "override/%resref2%.spl"
    LPF DELETE_SPELL_EFFECT
      INT_VAR opcode_to_delete = "-1" // all effects
    END
    LPF ADD_SPELL_EFFECT
      INT_VAR
        opcode = 318        // Protection from resource
        target = 1          // Self
        parameter1 = cur_hp
        parameter2 = 144    // STAT CURHITPOINTS >= [parameter1]
      STR_VAR
        resource = EVAL "%DEST_RES%"
    END
    LPF ADD_SPELL_EFFECT
      INT_VAR
        opcode = 146      // Cast spell
        target = 1        // Self
        parameter2 = 1    // Cast instantly (caster level)
        timing = 1        // Instant/Permanent until death
      STR_VAR
        resource = EVAL "%SOURCE_RES%"
    END
  IF_EXISTS
END


// Regeneration items
ACTION_DEFINE_ASSOCIATIVE_ARRAY reg_itm BEGIN
  // ITM resref => Intermediate SPL resref
  "trollreg" => "#TROLLRG"
  "cdhgtrl"  => "#CDHGTRL"
  "cdtrlblz" => "#CDTLBLZ"
  "cdtorgal" => "#cdtorgl"
  "reg1hp2"  => "#CDIDTR1"
  "cireve"   => "#CDIDTR2"
END

ACTION_PHP_EACH reg_itm AS resref1 => resref2 BEGIN
  COPY_EXISTING "%resref1%.itm" "override"
    LPF ADD_ITEM_EQEFFECT
      INT_VAR
        opcode = 232      // Cast spell on condition
        target = 1        // Self
        timing = 2        // While equipped
        parameter2 = 11   // TookDamage() / instant
      STR_VAR
        resource = EVAL "%resref2%"
    END
  BUT_ONLY IF_EXISTS
END

 

Edited by argent77
Link to comment
1 hour ago, argent77 said:

My change includes a second opcode 232 (Cast spell on condition) to the trolls' TROLLREG items which triggers an intermediate spell on "TookDamage()/instant" that executes the original falling-down spell (TROLLREG.SPL, etc.) when the current hit points fall below a certain threshold.

Just out of curiosity: does "TookDamage()" still trigger immediately if the troll in question is slowed...?

1 hour ago, argent77 said:

... without being invulnerable for another full round (in the worst case).

As I said before, the worst case scenario is when the troll in question is slowed (i.e. two rounds)

Link to comment
14 minutes ago, argent77 said:

Slow doesn't appear to delay the falling-down trigger. Maybe it's delayed from one tick to two ticks, but that isn't noticeable by the player.

Fine. Guess another possible solution would be that of replacing op232 with op272 (p1=1, p2=3, i.e. once per second / once per 2 seconds if slowed)... In any case, I think this tweak is suitable for inclusion in the fixpack...

Before I forget: in SoD there are certain wolves that also have this falling-down mechanics. As a result, you might want to patch them as well...

Link to comment
42 minutes ago, Luke said:

Before I forget: in SoD there are certain wolves that also have this falling-down mechanics. As a result, you might want to patch them as well...

That's handled slightly differently where the trigger delay isn't as noticeable, but the patch should work basically the same.

Edit: There is also "BDTROLL1.ITM" in SoD, but I couldn't find out where or whether it is actually used.

Edited by argent77
Link to comment
On 10/11/2023 at 5:55 PM, argent77 said:

That's handled slightly differently where the trigger delay isn't as noticeable, but the patch should work basically the same.

Yes, the trigger condition is slightly different (i.e. HPPercentLT 25)... However, it is still checked once per round (once per 2 rounds if slowed), so you might want to patch it as well...

On 10/11/2023 at 3:11 PM, argent77 said:

which had been initially improved in EE games by moving it from script to spell effect

Unless I'm missing something, in IWD:EE the falling-down mechanism still relies upon scripts...?

Link to comment
14 minutes ago, Luke said:

Unless I'm missing something, in IWD:EE the falling-down mechanism still relies upon scripts...?

The script that was responsible for the falling-down mechanism in oIWD is still in place but doesn't contain any code. Instead it's realized by REG1HP2.ITM (or CIREVE.ITM for revenants) which does basically the same as TROLLREG.ITM in BG2EE.

I have already made a PR which should cover all instances in SoD, BG2EE and IWDEE.

Link to comment
6 minutes ago, argent77 said:

The script that was responsible for the falling-down mechanism in oIWD is still in place but doesn't contain any code. Instead it's realized by REG1HP2.ITM

The only odd thing is that not all trolls are equipped with REG1HP2... Some of them still rely upon scripts (see f.i. CDTROLL1.CRE and CDTROLL1.BCS...) Intended...? They probably forgot to update them... Also because such scripts are partially broken (cdtroll2.cre does not exist as a game resource...)

Link to comment

Why not just make the trolls actually regenerate at a fast speed, and remove the min1hp item ? My earlier suggestion was 10 hit points per round... that can be adjusted by the trolls difficulty. As a one with 1000 hit points probably should have a little more than say one with 60.
Also, the fire and acid weapons/spells could just "remove" the regeneration effect, by flagging the hitted enemy to be immune to the regen effects(.eff using opcode 98) for a while(say 2 fight rounds/12 real time seconds), via opcode 101 or 321. Also, the player characters should be effected by this regeneration immunity, but you can still heal them, using other effects. As I cannot see a reason for there to be regenerating from fire or acid damage during it's effects. You can regen from fire by being more than 100% immune to it via the protection effect heal.  

Yes, this will make the trolls able to be defeated by 6 fighters even without fire, easier... as they will be ripped to shreads. But that happens when you put them into a meat grinder...
And yes, this is possibly an EE game only, cause the 321 effect usage, but the 101 could be used in non-EE games.... as far as I know.

Edited by Jarno Mikkola
Link to comment

I think that behavior would already be too far away from the original AD&D description. It sounds more like an idea for a tweak mod.

AD&D description of trolls:

Quote

Trolls regenerate at an amazing rate. Starting three rounds after first blood, the creatures recovers 3 hit points per round until healed. Trolls reduced to 0 or fewer hit points fall to the ground, incapacitated but not slain. Incapacitated trolls continue to regenerate and stand up to fight as soon as they have a positive number of hit points. ... A troll reduced to 0 or fewer hit points and immersed in acid or burned with fire is killed.

The current implementation is still quite faithful to the AD&D description.

Link to comment
25 minutes ago, argent77 said:

The current implementation is still quite faithful to the AD&D description.

Q1: So does the regeneration actually only kick in, in round 3 ?
Q2: Also with 3 hit points per round doesn't sound correct ?


A1: No. Cause most battles are over by that point.
A2: Cause usually in BG, they get up and they are unharmed at the point of their getting up, cause it's technically a different creature. Yeah, cause it's bullshit. This is a computeraized Role Playing Emulation, not P&P game.

Edited by Jarno Mikkola
Link to comment
2 minutes ago, argent77 said:

Considering the engine limitations and the powergaming potential of the game, it's still quite faithful.

And you cannot throw a lit torch in P&P... ouh yeah, you can. Then why does the player never do that... cause the DM doesn't like the players, and so can disallow that.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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