Vampiric Touch

Discussion in 'General Modification' started by Raaagh, Aug 14, 2004.

Remove all ads!
  1. hellblazer

    hellblazer Established Member

    Joined:
    Feb 27, 2006
    Messages:
    227
    Likes Received:
    0
    Will this perform_touch_attack function work for ghoul touch?
     
  2. Salk

    Salk Established Member

    Joined:
    Jan 2, 2006
    Messages:
    258
    Likes Received:
    0
    Sitra Achara,

    if your .DLL investigation brings you to understand why Vampiric Touch does not really work the way it should, it'd be great to have some new infos about it... :)
     
  3. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Can you summarize what's wrong with it and how it should work?
     
  4. Salk

    Salk Established Member

    Joined:
    Jan 2, 2006
    Messages:
    258
    Likes Received:
    0
    The problem with this spell is that when you drain HPs from the opponent you should gain those HPs (temporarily) but you don't.
     
  5. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    I'll look into it - this will probably take a while, though, so be patient.

    That said, I actually do appreciate these requests, they're very motivational. Just don't go overboard ;)
     
  6. Salk

    Salk Established Member

    Joined:
    Jan 2, 2006
    Messages:
    258
    Likes Received:
    0
    I will endeavor to restrain myself...
    (It's actually easy since I can't remember of any other game bugs :) )

    Thanks, Sitra Achara...
     
  7. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,745
    Likes Received:
    375
    This thread explains why my wandering Necromancer's False Life potion does sod all :yawn:
     
  8. Salk

    Salk Established Member

    Joined:
    Jan 2, 2006
    Messages:
    258
    Likes Received:
    0
    Oh Sitra Achara... It seems I didn't realize there is a second bug with the Vampiric Touch spell: it's reported as bug#473 in the Atari bug list. Apparently, instead of multiplying the damage with the caster level, it adds the caster level to it.
     
  9. gazra_1971

    gazra_1971 Knights of Legend

    Joined:
    Aug 3, 2010
    Messages:
    818
    Likes Received:
    2
    Hey Sitra, any chance that you could fix the major bug with the spell Chain Lightning? That was the malfunctioning spell that bothered me the most when my spellcasters used to trial different spells in the game.

    Here's how the spell is supposed to function:

    http://www.d20srd.org/srd/spells/chainLightning.htm

    Oh, and is there any chance that you could fix the major bug exploit with the spell Haste so that it no longer stacks with itself? (it isn't supposed to stack with itself)
     
    Last edited: Mar 13, 2015
  10. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Gazra, I guess that shall be my next goal, because I just finished the Vampiric Touch fix :)

    First off, major thanks to my forebears who laid down the groundwork for this fix. I'm using a slightly altered version of the files moebius and Raagh posted above - actually, in the end, the only change to the Py script was correcting the float messages.

    However, there still remained two issues after that:
    1) The spell condition would give you a 'touch attack charge', which would end the spell and remove the temp HP if you performed it.
    2) Making a touch attack via script would use Dex modifier instead of Str modifier.

    Fortunately, through some DLL diving, I was able to fix both! TBH I thought it would be a lot tougher to fix.

    The only remaining issue is that this spell suffers from the same bug as the Cure X Wounds spell, namely that it can sometimes work at range. Oh well! Enjoy your OP spell :p

    The necessary DLL changes are as follows:

    1) Fixing the "sp-vampiric touch" condition: This basically changes the spell condition into something similar to False Life, except that the damage amount is specified in the condition_add arguments. To be precise it gets rid of the 'touch attack charge' and fixes the spell removal ~stuff~ so you don't get an annoying lingering 0 Temp HP.

    Code:
    2E0A24: change 04 10 into -> EA 00
    2E0A28: change D0 93 0C 10 into -> D0 43 0C 10
    2E0A2C: change 00 00 00 00 into -> F0 09  2E 10
    (this modified Disp_Key_Q_HoldingCharge into Disp_Key_Q_Critter_Has_Condition - I think it's not really critical TBH)
    
    2E0A8C: change 30 B3 0C 10 into -> D0 8F 0E 10
    
    2E0AC4: change A5 into -> A6
    2E0AC8: change A0 DD 0D 10 into -> 20 76 0D 10
    
    2E0B00: change A4 int0 -> A6
    2E0B04: change 40 BE 0D 10 into -> B0 BA 0C 10
    
    In the end, the DLL section should look like this: (generally affected area highlighted in red)

    [​IMG]

    2) The second fix is for the dex modifier bug. This is a bit tricky since I had to alter the py script for perform_touch_attack.

    First thing, I used up some NOPs in the DLL:
    Code:
    2CEEEC:  change 20   into -> 16 
    (in the end it turned out they weren't really necessary, but that's how the hack was written)

    Then, I removed the D20CAF_Ranged modifier that was applied by default:
    Code:
    B2CAC: change 04 into -> 00
    Finally, I added a hack that allows you to make a non-ranged touch attack. This works by checking the number of arguments the function is called with. That is:
    perform_touch_attack( obj ) - performs a ranged touch attack (using DEX mod)
    perform_touch_attack( obj , 1) - performs a melee touch attack (using STR mod)

    I know, it's far from ideal, but hey, it's a hack, not a rewrite :p
    This change is a bit longer - starting from offset B2C16
    Code:
    B2C16:
    0:  83 ec 58                sub    esp,0x58
    3:  57                      push   edi
    4:  31 c0                   xor    eax,eax
    6:  8d 7c 24 04             lea    edi,[esp+0x4]
    a:  31 c9                   xor    ecx,ecx
    c:  b1 16                   mov    cl,0x16
    e:  f3 ab                   rep stos DWORD PTR es:[edi],eax
    10: 48                      dec    eax
    11: 8d 7c 24 3c             lea    edi,[esp+0x3c]
    15: b1 03                   mov    cl,0x3
    17: f3 ab                   rep stos DWORD PTR es:[edi],eax
    19: bf d4 c3 26 10          mov    edi,0x1026c3d4
    1e: 56                      push   esi
    1f: ff 57 f8                call   DWORD PTR [edi-0x8]
    22: 83 c4 04                add    esp,0x4
    25: 83 f8 01                cmp    eax,0x1
    28: 0f 86 05 00 00 00       jbe    33 <_main+0x33>
    2e: 80 4c 24 0c 04          or     BYTE PTR [esp+0xc],0x4
    33: c6 44 24 04 0f          mov    BYTE PTR [esp+0x4],0xf
    38: 6a 00                   push   0x0
    3a: 56                      push   esi
    3b: ff 17                   call   DWORD PTR [edi]
    3d: 83 c4 08                add    esp,0x8
    40: 5f                      pop    edi
    41: 56                      push   esi
    42: 31 f6                   xor    esi,esi
    
    and then a bunch of NOPs (90) up to and including B2C6F
    In the end, this section should look like this: (affected area highlighted in red)

    [​IMG]

    For now this is presented as-is - if you wanted a conveniently downloadable DLL, you'll have to wait for the next modpack. Happy hunting!
     

    Attached Files:

  11. Salk

    Salk Established Member

    Joined:
    Jan 2, 2006
    Messages:
    258
    Likes Received:
    0
    Oh my... Sitra Achara... That's just great... And the minor drawback is nothing compared to what you accomplished.

    To me, this is the dawn of a new era for ToEE... Thank you for all your invaluable work.

    I'll wait for the next patch level before I play and with these kind of fixes you have already provided and are working on, I can't stop dreaming...
     
  12. Metathiax

    Metathiax Member

    Joined:
    Dec 27, 2011
    Messages:
    28
    Likes Received:
    0
    Talk about a coincidence, I'm currently playing through 8.1.0 NC with a solo Fighter/Sorcerer and I was pretty disappointed to have picked this broken spell, especially since Sorcerers don't get much spells to begin with. I'm aware that spells can be switched upon leveling up but, in the case of my build, that would mean having to wait for my 10th and last Sorcerer level, gimping my character in the mean time.

    Now, I'm a complete newb as far as modding goes and I would like to know if this fix can be applied to an ongoing game without corrupting my saves. I'm getting close to level 12 and don't feel like starting over.

    Thank you for still supporting this awesome old(er) game (when modded by Co8).
     
  13. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    As long as you apply it to a game where there isn't an active Vampiric Touch spell it should be fine.
    Be aware that the zips don't include the DLL changes however (other than documentation), you have to apply that manually for the time being.
     
  14. Metathiax

    Metathiax Member

    Joined:
    Dec 27, 2011
    Messages:
    28
    Likes Received:
    0
    Thanks, it didn't break my saves.

    The spell is much improved but I still have the following problem:

    1) The spell condition would give you a 'touch attack charge', which would end the spell and remove the temp HP if you performed it.

    It makes the spell clunky to use since the game assumes that you discharge your touch attack when you click on a foe as opposed to selecting the single or full attack actions from the radial menu.

    This 'touch attack charge' also makes the spell incompatible with Ghoul Touch. Does the ToEE engine even allow to keep more than one touch attack active at once?

    I've copied the contents of the attachments found under post #25 in the appropriate folders of my ToEE directory. Am I missing something?

    I've also observed that the spell fails to give temporary HP when used against trolls, presumably because of their regenerative ability which makes the damage non-lethal. A minor issue really but I thought I should report it.
     
  15. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Like I said, the files don't include the DLL changes - you have to apply those manually for now.
     
Our Host!