View Single Post
Old 07-02-2009, 12:58 PM   #3
Join Date: Jun 2009
Posts: 63
there's yet another problem with the Whirlwind spell, both Kotor 1 and TSL - it deals more damage than it should. The problem is with the following code:

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamage, oTarget);
the duration is not set, so the damage is applied once only, but it's still more damage than there should be, because damage is already handled by the following code:

SP_InterativeDamage(eDamage, 13, oTarget);
so if your jedi is level 12, for example, the spell should deal 6*4=24 pts damage, but instead a single casting of the spell actually applies 6*4+4=28 pts damage at lvl 12, because every time you cast the spell additional 1/3 of your caster lvl is applied in damage. So the first code line above needs to be removed.

And yet another problem with Plague and all other spells or special abilities that apply poison to a target: due to a hardcoded bug the poison effect is applied for a lesser amount of rounds than it should be, for example, if the effect is applied for 12 seconds, it should actually last for exactly 4 rounds, meaning you should be actually be able to cast 4 spells before it wears off, but it will often wear off 500-700 milliseconds before you cast your 4th spell, which basically leaves you with 3.8-3.9 rounds duration, which is completely and utterly useless.

To fix this, the duration should be increased by like 700 milliseconds, but since the effect is handled not through scripting, but through a hardcoded function relying on poison.2da, the changes must be done to the 2da file. I have to test this yet though. There's a duration column there, if you set the "POISON_ABILITY_SCORE_VIRULENT" duration to 12.7 it should actually allow you to cast 4 spells before plague wears off. The duration should not be increased to 13 seconds, because then the spell would be dealing more attribute damage than it should, since it applies -1 to all attributes each second

hmm, I just tested the poison function some more, and it seems poison.2da doesn't accept mathematical fractions, only natural numbers, so it's basically either 12 seconds or 13. 13 is too much, dealing more attribute damage than the spell should and 12 is not enough due to the bug described above. So it's best to delay the execution of the script by a couple of milliseconds. In k_inc_force.nss, find the plague script and change the line:

Sp_ApplyEffects(FALSE, oTarget, 0.0, 1, eLink1, 1000.0, eInvalid, 0.0);

DelayCommand(0.1f, Sp_ApplyEffects(FALSE, oTarget, 0.0, 1, eLink1, 1000.0, eInvalid, 0.0));
Use the same line for TSL too! As described above, Obsidian changed the duration of the spell from permanent to 12 sec., but the real duration is set in poison.2da anyway. Still, the Obsidian change is not without consequence, since if the number in the script is lower than the one in poison.2da, the hardcoded poison function and the hardcoded ApplyEffectToObject functions will interfere with each other, the game engine will become confused and remove the effect earlier than is set in poison.2da

0.1 float should be enough, but if not, try changing it to 0.2 or even higher, but don't set it too high, otherwise it will change the way the spell is supposed to work

Combined double post - please use the "edit" function for your posts in future -- j7

Last edited by jonathan7; 07-07-2009 at 07:05 AM. Reason: Combining double post -- j7
WRFan is offline   you may: quote & reply,