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 
 
nwnx_effects

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



Joined: 25 Aug 2010
Posts: 75

PostPosted: Tue Oct 25, 2011 11:43    Post subject: nwnx_effects Reply with quote

nwnx_effects allows the creation of arbitrary and custom effects that are applied / removed as builtin effects.

Finally got around to cleaning this plugin up. It's tested against nwnx2.so built from the trunk and it worked fine. There is some demo code and a mod included in the 7z.

Note: I hijacked EffectModifyAttacks(), so if you used this plugin you would have to change all occurrences in your module (including bioware spell scripts) to EffectAdditionalAttacks() which is included with the plugin and functions identically.

Dependencies: nwnx_structs
Download: http://dl.dropbox.com/u/32687721/nwnx_effects.7z
Repository: https://github.com/jd28/nwnx

Code:
Code:

const int NWNX_EFFECTS_EVENT_APPLY        = 0;
const int NWNX_EFFECTS_EVENT_REMOVE       = 1;

// This is a replacement for EffectModifyAttacks.  It is handled in the
// plugin.  If you use nwnx_effects you'd have to replace all occurances
// of EffectModifyAttacks with EffectAdditionalAttacks
// - nAmount: (0, 5]
effect EffectAdditionalAttacks(int nAmount);

// Returns whatever integer was used to identify the effect being applied/removed.
// Only applicable in a script set with SetCustomEffectHandler
int GetCustomEffectType();

// Returns NWNX_EFFECTS_EVENT_* depending on whether the effect is being
// applied or removed.
// Only applicable in a script set with SetCustomEffectHandler
int GetCustomEffectEventType();

// See nwnx_structs GetEffectInteger this function is identical save that it
// can return integers only from the effect currently being applied/removed.
// Only applicable in a script set with SetCustomEffectHandler
int GetCustomEffectInteger(int nInteger);

// Sets sScript to be called when a custom effect of type nEffectType is applied or removed.
// @return -1 signals an error that the handler was not set.
int SetCustomEffectHandler(int nEffectType, string sScript);

// This function only needs to be called when an effect fails, for whatever reason,
// to be applicable.  nwnx_effects assumes success.
// Only applicable in a script set with SetCustomEffectHandler
// NOTE: you'd only ever need to call this in a script applying an effect.
// bSuccess : if FALSE signals to the plugin that the effect was not applicable so the effect will just be deleted,
//      if TRUE that it was.
void SetCustomEffectSuccess(int bSuccess = TRUE);
Back to top
View user's profile Send private message
Nob



Joined: 16 Apr 2005
Posts: 21

PostPosted: Wed Oct 26, 2011 17:52    Post subject: Reply with quote

Very nice!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux 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