View previous topic :: View next topic |
Author |
Message |
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Thu Oct 06, 2011 14:01 Post subject: Stable nwnx_events for windows + source |
|
|
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 |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Thu Oct 06, 2011 19:38 Post subject: Re: Stable nwnx_events for windows + source |
|
|
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 |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Thu Oct 06, 2011 19:58 Post subject: |
|
|
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 |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Oct 07, 2011 17:57 Post subject: hooking question |
|
|
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 |
|
|
werehound
Joined: 17 Aug 2010 Posts: 41
|
Posted: Fri Dec 02, 2011 0:39 Post subject: Re: hooking question |
|
|
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 |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Fri Dec 02, 2011 8:29 Post subject: |
|
|
Yes, there is a damage hook in Fixes (Linux) for other purposes. _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
|