Author Topic: Creature weapons onhit cast spell doing rediculous damage  (Read 522 times)

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« on: November 28, 2014, 08:17:44 am »


               

For some reason when I put onhit cast spell on a creature weapon, and put that weapon in the 'special attack slot', the spell will do MASSIVE damage when it goes off. Even if the spell level is 2 for instance, the spell will do 500+ damage. I've looked through every line of the spell script to see where an incompatibility might be, and there's nothing.


 


Any idea whats going on?


 


So far I've seen this happen with Melf's Acid Breath and Delayed Blast Fireball when used as onhit castspell effects. I'm going to test for others.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #1 on: November 28, 2014, 08:42:11 am »


               

I am not able to reproduce this.  Try GetCasterLevel() to get the caster level used and compare it by script with the caster level for the item property (GetItemPropertyCostTableValue() with the 1 offset included).



               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #2 on: November 28, 2014, 10:27:33 pm »


               

It's very strange. I've tried making the creature cast the spell at the same level and the damage is normal. When the spell is cast onhit from creature slots 1 and 2 its normal, on special attack it is normal most of the time. Once I give the enemy a cast of acid fog with the onhit cast of Acid Breath, thats where the real fun seems to happen randomly.


 


I've given the creature natural casts of acid breath and acid fog, and combined they don't spike any crazy damages, but when you put the acid breath onhit cast it seems to have some really random results. I think I am just going to stay away from onhit cast.



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #3 on: November 29, 2014, 06:19:18 pm »


               

I couldn't replicate this either. It is a curious thing, if you could give more details on how you were getting it to happen.


 


BTW, I don't know that it would even be a caster-level issue. All of my tests showed GetCasterLevel() returning the caster level assigned to the on-hit spell in the Toolset. But, even if GetCasterLevel() were somehow reporting the spell's caster level to be 127 or something, Mestil's Acid Breath has an internally scripted caster-level cap of 10.



               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #4 on: November 29, 2014, 07:13:14 pm »


               

It does seem to be very very particular. Here's how I can get it to happen:


 


Create a creature with 2d12 slams on cweapon 1 and 2, and a 2d12 slam with onhit lvl 20 mestils acid breath, put that on the special attack.


 


Give the creature a few casts of acid fog. Go into your module, use dm_spawncreature to summon it as a pseudo-follower (maybe even put follower AI on it, for ease), and stand near the creature when it fights things (make sure sure PVP friendly fire is on for best testing).


 


I notice that when the onhit cast goes off while the target is standing in acid fog, EVERYONE in the cone gets massive damage spikes.


 


Just a note, in my spellscripts I have removed the caster level limits, but even with them removed there is no way these damages could be coming out.



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #5 on: November 29, 2014, 08:10:41 pm »


               

Could you post the X2_S0_AcidBrth.nss that you are using? And, have you modified any includes or are you doing any spellhooking?



               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #6 on: November 29, 2014, 08:46:20 pm »


               

I'm not modifying any includes, or doing any extra spellhooking than default.


 


Heres acid fog


http://pastebin.com/UvnZ0BVd


 


Heres acid breath


http://pastebin.com/fVVPjuCJ


 


My module doesn't use maximize magic or empowered magic, yet, so that's why the values are the same. Just FYI



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #7 on: November 30, 2014, 02:47:48 am »


               

This is how caster level works.  When casting a spell from an item the caster level for the creature is temporarily overridden.  When the spell script is finished, the caster level is replaced with the creature's caster level before the casting unless the on-hit property used a higher value.  Since you have a level 20 caster level for your on-hit, then the area of effects created before you triggered the on hit, will now retrieve a caster level of 20 (or more if the creature had a higher caster level).  So your acid fog is being enhanced by your mestil's acid breath, which is why the damage suddenly increased.


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #8 on: November 30, 2014, 09:45:48 pm »


               


This is how caster level works.  When casting a spell from an item the caster level for the creature is temporarily overridden.  When the spell script is finished, the caster level is replaced with the creature's caster level before the casting unless the on-hit property used a higher value.  Since you have a level 20 caster level for your on-hit, then the area of effects created before you triggered the on hit, will now retrieve a caster level of 20 (or more if the creature had a higher caster level).  So your acid fog is being enhanced by your mestil's acid breath, which is why the damage suddenly increased.




this


 


out of curiosity, my community patch fixes this as many other issues, bugs and exploits...


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #9 on: November 30, 2014, 10:12:38 pm »


               

Also look at your heartbeat script for acid fog.


 


This line:


int nDamage = (6 * nCasterLvl) / 3;


 


Doubles the amount of the caster level for damage.


 


These lines:


if(!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ACID, GetAreaOfEffectCreator(), fDelay))


            {

                 nDamage = (6 * nCasterLvl) / 3;

            }

 

Double the damage for each creature that would be affected.  So the first creature takes 2 * caster level damage, the second 4 * caster level, the third 8 * caster level, etc.

 

Edit: Oops that's not the case because you never passed the damage done in the loop to the effect.  So your saving throws are meaningless (as they are with the regular spell script as it does this too).


               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
Creature weapons onhit cast spell doing rediculous damage
« Reply #10 on: December 01, 2014, 07:34:28 am »


               

I am still not sure why the damage is getting in the ~500hp range. Unless the scripts I am seeing have been modified since the earlier posts.


 


The persistent AoE caster-level issue shouldn't be affecting Mestil's Acid Breath at all, if I understand correctly. So, by the scripts I am seeing, that would be a constant 3*CasterLevel hp of damage, which doesn't explain the high damage numbers for any normal caster level.


 


The Acid Fog scripts look they should do 15 hp of damage on entering and the 2*CasterLevel hp as long as a creature is within one. Even if CasterLevel is getting bumped by a higher-level effect firing during the AoE's duration, it should still only be the creature or item-property's level, right?


 


It's getting late, so my semi-glazed eyes may be missing something, but it doesn't look to me like these should be producing extreme damages unless the creature has very high levels or his on-hit property does.