logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Can we fix "Restore Spell Uses On Login"?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Jambo



Joined: 24 Sep 2008
Posts: 22

PostPosted: Wed Oct 22, 2008 22:59    Post subject: Can we fix "Restore Spell Uses On Login"? Reply with quote

Restore Spell Uses On Login:

Quote:
Added new nwnplayer.ini file setting to restore the remaining spell uses from the character file on log in to a "server vault" server. This option defaults to off



When I first saw this was in NWN 1.69, I thought it would be great to enable to close an age old exploit of sorts - the ability for casters to simply log off/back in to refresh their spell usage. Unfortunately, like many things in NWN 1.69, this feature is bugged. If a character has only one item with a charisma bonus, it will work correctly. If they have multiple items with charisma bonuses, that's when we start to have more of a problem.


For the rest of this, let's take a working example of:

- Level 20 Sorceror
- Base charisma score of 20


Now, enable this feature, and equip the character with the following:

- Two rings with +5 charisma ability bonus
- A robe with +1 charisma ability bonus
- A cloak with +1 charisma ability bonus.


That takes the charisma bonus to 32 for the sake of spell usage calculation, bonus slots, etc. Rest with this character, and afterward take particular note of the number of remaining spell uses at each level.

Log out, and back in. You will notice a drop in the number of spell uses they have.


From what I could work out, the following appears to be happening either when NWN is recording the number of remaining spell uses, or reinstating the number of remaining spell uses when logging in:

NWN will loop through the equipped items in reverse order and establish the ability bonuses from items worn. Rather than adding multiple bonuses together, it only records the last ability bonus it sees on an item.

Using the above character example, with the rest/relog process: if two rings are equipped, the top ring having +2 charisma and the bottom ring having +8 charisma, the remaining spell uses would imply it calculated the charisma as 22. Swap the ring order, it implies it calculated it as 28.

It should be calculating it 30.

Throw a +1 charisma helm and robe in to the mix (to take the equipped total to 32 charisma), rest, relog, and the remaining uses would imply NWN calculated the charisma as 21, rather than 32.


Question is: can we get this patched, or are we going to have to live with another broken feature? (We can be sure Bioware aren't going to fix it, in any case).

Edit:
- This issue only affects Sorcs/Bards
- From what I can tell, it's down to how NWN is saving the data.


Last edited by Jambo on Thu Oct 30, 2008 9:37; edited 2 times in total
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Oct 23, 2008 1:58    Post subject: Reply with quote

Im able to fix it in nwscript without hak packs.

I working on "No ability stacking" and to get it work I made new itemproperty FakeAbilityBonus with same text so player don't recognize it. When PC acquire item with true AbilityBonus, i swap it for the fake one. Now when PC equip item with fake ability bonus, I add true ability bonus to player skin and when PC unequip I remove ability bonus.

And this idea is usable in this case too.

Multiple ability bonuses on 1 item don't stack (and thats what I wanted) so you should in both evets recalculate all bonuses on equipped items.

I know its complicated, but player don't recognize anything and for you its a hour of scripting.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Jambo



Joined: 24 Sep 2008
Posts: 22

PostPosted: Thu Oct 23, 2008 3:23    Post subject: Reply with quote

Nice, I can see what you're going with that.

Out of interest, does the ability bonus issue noted in my first post affect any other aspects of NWN which I may not have noticed?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Oct 23, 2008 22:05    Post subject: Reply with quote

Bad news. I tried to fix that and I got results.

It works correctly, but only if you don' t using ELC. If you do, then skin is unequipped when PC logs in and even copy ips to another item didn't helped.

If anyone interested in the non-ELC fix, I put it on vault, it can spare you few hours of scripting.

EDIT: I did that copy ips before item was equipped, see this:
Code:
[Thu Oct 23 21:44:02] pvp-master (xxxxx) Joined as Player 1
[0] Object: "aibug", Running Script: sh_noabstack_ueq
[Thu Oct 23 21:44:04] PC properties
[0] Object: "aibug", Running Script: sh_noabstack_aqu - HERE I DID IT
[0] Object: "aibug", Running Script: sh_noabstack_equ - NOW PC HAVE ALL ABILITY BONUSES
[Thu Oct 23 21:44:04] Boots of Striding +1
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_equ
[Thu Oct 23 21:44:04] Nymph Cloak +7
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_equ
[Thu Oct 23 21:44:04] Ring of Crimson
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_equ
[Thu Oct 23 21:44:04]
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: sh_noabstack_aqu
[0] Object: "aibug", Running Script: x3_mod_def_enter
[0] Object: "aibug", Running Script: sh_noabstack_equ
[Thu Oct 23 21:44:05] PC properties
[0] Object: "Test Area", Running Script: area_enter

_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Jambo



Joined: 24 Sep 2008
Posts: 22

PostPosted: Fri Oct 24, 2008 2:14    Post subject: Reply with quote

What if you make it a temporary bonus with a really really long duration and refresh it after a server/module reset?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Oct 24, 2008 3:05    Post subject: Reply with quote

Thats no matter. To get it work under ELC = on you need to store true ability bonuses somewhere else than skin.

And thats even more complicated (pc can unequip that item) and mainly visible.

Second solution would be switch the ab bonuses in onexit, but as you know you can't get pc items there at least if you not using nwnx_leto.

and third solution is to use Makazasky's ELC plugin and turn off ELC.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Jambo



Joined: 24 Sep 2008
Posts: 22

PostPosted: Thu Oct 30, 2008 9:39    Post subject: Reply with quote

For anyone interested in looking at this from a NWNX plugin perspective (perhaps for NWNX Fixes), it would seem the issue I reported in my first post is down to how NWN is saving the data from what I've heard/can tell, rather than how it's loading it back up.

It also only affects Bards/Sorcs, which are notably the only two classes with X spells per day vs pre-prepared.
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Thu Oct 30, 2008 13:06    Post subject: Reply with quote

Other way around -- the issue is in loading. It loads the right data, which then gets overwritten in memory by some other code.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Nov 22, 2008 15:01    Post subject: Reply with quote

Its weird - it looks that it dont work as you posted Jambo. I tried few things:
1) Special item with onactivate to log off. This item loop over all items, counting for ability increase andd then give them to one single item. Then BootPC. T tried to give them to last item in slot and first item in slot, neither one solution worked. I always logged back with lesser spell uses than before and that one item really had +8charisma. Once i rested with this single item an relog it worked...

2) Temporary effect ability increase with +12ability boost. That workd but only so long the effect was there. When effect goes off, spell uses dropped althoug, that skin that was unequipped was already equipped again.

Increase spell uses function would help it Smile
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Clisair



Joined: 27 Jun 2006
Posts: 9

PostPosted: Sat Dec 13, 2008 20:42    Post subject: Reply with quote

It is highly possible that the spells are figured before all of the equips. I do know that when a person logs in, everything is equipped and then they get access. With that in mind, it seems that what happens is that the program reads the file and figures the spells and then goes on to start the log in, hence none of the equips getting counted.

Just a thought, no hard evidence on it.
_________________
Firinn Of Elisair
http://www.elisair.com/
Back to top
View user's profile Send private message Visit poster's website
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Wed Dec 17, 2008 15:31    Post subject: Reply with quote

I have a fix for this (Windows only), though it's a relatively ugly bit of code. I'll commit it to fixes soon.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Thu Oct 15, 2009 1:07    Post subject: Reply with quote

Significantly cleaner version committed.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Mar 04, 2010 18:13    Post subject: Reply with quote

There is one more bug in restoring spells - extra spells from caster ability from feats

more info: http://nwn.bioware.com/forums/viewtopic.html?forum=47&topic=721001

I have tested it on server I know have new nwnx_fixes, but not sure which version though.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group