It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Hey all,

How do I make a spell last hours/level, instead of minutes/level?

Which value do I have to adjust in spells.2da?

Thanks in advance!
This question / problem has been solved by V0idheadimage
Unfortunately it's not that simple.

spells.2da does not contain any information about the spell duration. Instead the duration is handled in the script for each infividual spell.

For instance this calculates the duration of the bless spell ({NWN2GameDir}\Data\Scripts.zip\Scripts\nw_s0_bless.nss, line 51):
float fDuration = TurnsToSeconds(1 + GetCasterLevel(OBJECT_SELF));

Making the spells last longer like you want is not hard, but it's a lot of work as you have to modifiy each script and compile it.
Well, I would just like to have Greater Magic Fang last Hour/level, as per P&P rules.
Alright, that should not be a problem.
I'm assuming you're on Windows, because I don't know how the toolset works anywhere else.

The script for Greater Magic Fang is x0_s0_gmagicfang.NSS.
Extract that file from the Scripts.zip and put it into your Override-Folder.
Now open the Toolset (NWN2ToolsetLauncher.exe).
In the Toolset go to File -> Open Conversation / Script.
In the Filter Text Box type x0_s0_gmagicfang, select the file that has your Override-Folder in the Location (NOT the one with the original Scripts.zip as location) and click Open Selected.

This a rather clean script, on line 41 you see the calculation for the duration:
float fDuration = TurnsToSeconds(GetCasterLevel(oCaster));

change the line to:
float fDuration = HoursToSeconds(TurnsToSeconds(GetCasterLevel(oCaster)));

Now click Save & Compile.
If everything worked you will now have a x0_s0_gmagicfang.NCS file in your override-folder.
This compiled script will now be used by the game instead of the original.

Feel free to ask if you need more details.

Sidenote: If you have the Toolset open for 5 minutes or so the autosave will kick in and a Messagebox will open that asks if you're sure you want to save the module, since you don't actually have a module open, just answer no.
Thanks for the detailed explanation and sorry for my late response. You're a hero!

Edit: I was too hasty: the toolset opens, I select the file I extracted to the override folder, I see something pop up, and then nothing happens. The toolset doesn't freeze, it just seems like nothing happened...

Edit 2: I was incapable if reading your post properly, so thats on me. Solved! :)

Edit 3: I do wonder: how do you formulate the other durations? Like 10minutes per level?
Post edited July 18, 2021 by GawainBS
No problem, I was very-AFK the last few days anyway :)

How to make it last 10 minutes per level:
fDuration is always in seconds because the functions that apply the effects take the time it should last in seconds.
So all you need to do is to express whatever duration you want to seconds.

Let's start with the caster level:
float fDuration = GetCasterLevel(oCaster);

Now we add the conversion from seconds to minutes:
float fDuration = GetCasterLevel(oCaster) * 60;

Now multiply by 10 to make it last 10 times as long:
float fDuration = GetCasterLevel(oCaster) * 60 * 10; //or 600


And now you may also realize the mistake I made in my original Post.
float fDuration = HoursToSeconds(TurnsToSeconds(GetCasterLevel(oCaster)));

Is not an hour per level. It's off by a factor of however long a turn is in NWN2 (AFAIK it's 6, but I'm not sure, it's been a while). woops.

The correct formula is:
float fDuration = HoursToSeconds(GetCasterLevel(oCaster));

Sorry about that.
Thank you!
avatar
GawainBS: Thank you!
No,problem, happy to help!