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 
 
Stable nwnx_events for windows + source

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



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Oct 06, 2011 14:01    Post subject: Stable nwnx_events for windows + source Reply with quote

Does anyone have a stable nwnx_events + source?

I did use the one on the vault, which has dev crit hooked, however I noticed that every 7-8 hours it would sometimes crash the server, with a nwnserver.exe had an error in nwnx_events.dll error message.


I dont know if its due to the hooks I added to it, or an inherrent instability, but I was wondering if anyone had a recommended source to use as a good base for development.


I recently found the need to hook the Levelup Event.
Eg - When the player gains the level, not when they spend it.

I'd imagine there is a function in the nwnserver.exe that would be easy enough to find, and hook.
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Thu Oct 06, 2011 16:09    Post subject: Reply with quote

One thread down and you got your stable dev-crit hook http://www.nwnx.org/phpBB2/viewtopic.php?t=1833
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Oct 06, 2011 19:38    Post subject: Re: Stable nwnx_events for windows + source Reply with quote

Baaleos wrote:

I recently found the need to hook the Levelup Event.
Eg - When the player gains the level, not when they spend it.
Easy to do without nwnx. Just change all your XP calls to your own function where you look level before and after (by XP not HD) if after is lower that you just deleveled PC, if not then player just gained enough xp to get another level.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Thu Oct 06, 2011 19:58    Post subject: Reply with quote

There is three functions I know of level-related:

Levelup (this one fires the standard module script)
Leveldown
CheckCanLevelUp

And check can level up is a constant check so hooking that wouldnt be very effective.
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Oct 07, 2011 17:57    Post subject: hooking question Reply with quote

has anyone tried hooking damage receiving?

I would like to try and make it possible for Damage to heal.


eg
Ice Damage heals Elementals.

etc
Back to top
View user's profile Send private message
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Fri Dec 02, 2011 0:39    Post subject: Re: hooking question Reply with quote

Baaleos wrote:
has anyone tried hooking damage receiving?

I would like to try and make it possible for Damage to heal.


eg
Ice Damage heals Elementals.

etc


This is already easy to do. Under a creature's OnDamaged event for
Code:
int nCold = GetDamageDoneByType(DAMAGE_TYPE_COLD);
if (nCold > 0)
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectHeal(nCold/*or other multiplier*/, OBJECT_SELF);


Alternatively you can do a loop increasing nDamage by *2 each time around.

Code:
int nHeal = GetLocalInt(OBJECT_SELF, "HealType");
int i;
for(i = DAMAGE_TYPE_ACID; i < 2049; i*=2) //starting at acid
{
    int nDam = GetDamageDoneByType(i);
    if (i == nHeal /* or even if nHeal & i for masking*/ && nDam > 0)
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectHeal(nDam OBJECT_SELF);
}


However, it would indeed be nice to have a player OnDamaged event.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Fri Dec 02, 2011 8:29    Post subject: Reply with quote

Yes, there is a damage hook in Fixes (Linux) for other purposes.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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