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 
 
Looking for a solution
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
dsabrae



Joined: 30 Jul 2008
Posts: 23

PostPosted: Mon Dec 07, 2009 22:38    Post subject: Looking for a solution Reply with quote

for nwnx2 or nwn1 that can suppress the XP awarded message to a player. The PW I run uses pwfxp to award xp from combat and I would like to suppress the award message that appears in the combat log. Can anyone suggest a means to an end?
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Dec 08, 2009 1:39    Post subject: Reply with quote

One solution is to store "virtual XP" in your database, check the amount every time it changes, and if appropriate, award a full level of real XP. This is almost certainly easier than a NWNX solution, which may not even be possible.
_________________
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
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Dec 08, 2009 13:41    Post subject: sorta done Reply with quote

I do something like this already.

Except its not so much as xp I am storing, I store 'souls' of the deceased monsters.


You would just need to edit the 'base' xp script that is being used.

Find the int value, of the xp that is being awarded, and then replace the

GiveXPToCreature() function with something like

int iCurrentXP = GetLocalInt(oPC,"VIRTUAL_XP");
iCurrentXP = iCurrentXP + newXP; (newXP being the value that the GiveXP function would have given.)
SetLocalInt(oPC,"VIRTUAL_XP",iCurrentXP);


This stores the xp on the players, what you could then do, is a loop on the ModuleHeartbeat, which then goes through all Players,

Code:


object oPC = GetFirstPC();
while(oPC != OBJECT_INVALID)
             {
                  int iVirtualXP = GetLocalInt(oPC,"VIRTUAL_XP");
                  if(iVirtualXP >= 5000)
                         {
                            GiveXPToCreature(oPC,iVirtual); // Give xp at 5000 intervals.               
                             SetLocalInt(oPC,"VIRTUAL_XP",0); //Once xp is harvested, return it to 0.
                          }
               oPC = GetNextPC();
             }
           
 



Obviously, if you wana have any sort of persistence, you may want to store the xp into a database on certain intervals, and then perform your calculations on the database values, as they may be more secure and safe to work with.


@ Zeb - Would it be possible with nwnx to hook onto the XP Gain method/function in nwn Server and then script an event to fire on xp gain?

Just thought it might be as feasible to do, as a 'Pause' hooking script from nwnx_events. Eg - On xp gain override it, and use nwn script on that event instead.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue Dec 08, 2009 16:48    Post subject: Re: sorta done Reply with quote

Baaleos wrote:
@ Zeb - Would it be possible with nwnx to hook onto the XP Gain method/function in nwn Server and then script an event to fire on xp gain?
It's possible to hook the function that sends these messages, but that could affect the performance, as it'd fire the script on each line of the combat log.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
dsabrae



Joined: 30 Jul 2008
Posts: 23

PostPosted: Wed Dec 09, 2009 2:56    Post subject: thanks Reply with quote

for the ideas and examples this is exactly what I needed to look at!
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Dec 09, 2009 16:31    Post subject: Re: sorta done Reply with quote

virusman wrote:
Baaleos wrote:
@ Zeb - Would it be possible with nwnx to hook onto the XP Gain method/function in nwn Server and then script an event to fire on xp gain?
It's possible to hook the function that sends these messages, but that could affect the performance, as it'd fire the script on each line of the combat log.

Well but hook setxp function and remove that message, should be possible too. Or to make new function which would alter xp without message, xp is just field in bic so as in memory i guess.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Dec 09, 2009 16:39    Post subject: Re: sorta done Reply with quote

ShaDoOoW wrote:
Well but hook setxp function and remove that message, should be possible too. Or to make new function which would alter xp without message, xp is just field in bic so as in memory i guess.
This is too specific. Hooking message function would allow to hook and suppress other messages ("Item lost", for example).
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Dec 09, 2009 17:08    Post subject: Re: sorta done Reply with quote

virusman wrote:
ShaDoOoW wrote:
Well but hook setxp function and remove that message, should be possible too. Or to make new function which would alter xp without message, xp is just field in bic so as in memory i guess.
This is too specific. Hooking message function would allow to hook and suppress other messages ("Item lost", for example).
I know but thats exactly why it would affect performancy, isnt it?
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Dec 09, 2009 18:18    Post subject: xp gain function Reply with quote

Perhaps I got lost somewhere but

Are we saying that the alteration of the Message Function - that reports the xp gain, is what would be laggy to hook onto or to edit.

or

Are we saying that the alteration of the xp gain function in nwnserver.exe - that gives xp, and then calls the messaging function, would be laggy to edit?


Surely the XP Gain Message is only reported on xp gain, therefore, would only be called on each line of text in combat log, that actually involves xp gain?


Eg - XP Gain Event- > Calls the xp gain function -> Gives xp & Calls the Reporter Function to report this to the player.

If there was someway of Hooking onto the second thing in this series , the "Calls the xp gain function" - then this would effectivly be like hooking onto the xp gain event, and then possibly replacing it with a nwnscript equivelant.

I appreciate that my knowledge of nwnx is pretty basic, but is this not do-able?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Dec 10, 2009 12:56    Post subject: Re: xp gain function Reply with quote

Baaleos wrote:
Perhaps I got lost somewhere but

Are we saying that the alteration of the Message Function - that reports the xp gain, is what would be laggy to hook onto or to edit.

or

Are we saying that the alteration of the xp gain function in nwnserver.exe - that gives xp, and then calls the messaging function, would be laggy to edit?


Surely the XP Gain Message is only reported on xp gain, therefore, would only be called on each line of text in combat log, that actually involves xp gain?


Eg - XP Gain Event- > Calls the xp gain function -> Gives xp & Calls the Reporter Function to report this to the player.

If there was someway of Hooking onto the second thing in this series , the "Calls the xp gain function" - then this would effectivly be like hooking onto the xp gain event, and then possibly replacing it with a nwnscript equivelant.

I appreciate that my knowledge of nwnx is pretty basic, but is this not do-able?

Its hooking something like SendSystemFeedback which could slow down nwserver. I guess this function, (the name is made up by myself) sends every combat messages, initiative, attack roll, hit, damage, copy of floating text, xp gain, xp lost, gp gain, item gain, item lost and who knows what else.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Thu Dec 10, 2009 13:07    Post subject: Re: xp gain function Reply with quote

ShaDoOoW wrote:
Its hooking something like SendSystemFeedback which could slow down nwserver. I guess this function, (the name is made up by myself) sends every combat messages, initiative, attack roll, hit, damage, copy of floating text, xp gain, xp lost, gp gain, item gain, item lost and who knows what else.
Exactly.
I've managed to hook a higher-level function, though, that doesn't handle combat messages. It's SendServerToPlayerFeedbackMessage. Smile

It's also possible to hook SetXP function, but the function has complex logic that can't be reimplemented easily in NWScript (i.e. how do you actually give XP to the player if you already override the SetXP function?) so I think it'd be easier to override the scripting function by editing nwscript.nss and call the original function whenever it's needed.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Dec 10, 2009 16:54    Post subject: nwscript.nss ?? Reply with quote

Is there a nwscript.nss - I've never noticed it... Whats in it? Lol
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Dec 10, 2009 16:59    Post subject: Reply with quote

Some googling has revealed to me that nwnscript.nss is the script that the main game functions are contained in.

Handy.


When I get home, I will have a look at the contents of it.

Is it the actual functions which are defined here? or are they just declared?

Eg - Can you for instance, actually edit the

GiveXPToCreature() function, so by default, it gives pseudo xp, instead of actual xp?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Dec 10, 2009 17:55    Post subject: Reply with quote

Baaleos wrote:
Some googling has revealed to me that nwnscript.nss is the script that the main game functions are contained in.

Handy.


When I get home, I will have a look at the contents of it.

Is it the actual functions which are defined here? or are they just declared?

Eg - Can you for instance, actually edit the

GiveXPToCreature() function, so by default, it gives pseudo xp, instead of actual xp?
Its only declared there however there is one experienced trick.

LINK

This trick actually isnt from my head, I fond it on Georg Zoeller pages (nwn developer) but there was only explanation, I provide usage. Also those pages seems to not work.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Thu Dec 10, 2009 18:17    Post subject: Reply with quote

A better solution would be to simply define your own give XP function, then search all your scripts for "give XP" calls, replacing them with your own function.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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