leo_x
Joined: 25 Aug 2010 Posts: 75
|
Posted: Tue Oct 25, 2011 11:43 Post subject: nwnx_effects |
|
|
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); |
|
|