Allow ApplyEffectToObject to apply internal duration types; simply give the new constants as described below to the function.
To correctly read and iterate these functions, you need to use:
The builtin functions (GetFirstEffect, GetNextEffect, GetIsEffectValid) do not expose internal effect types.
This effect gets automatically removed when the item that created it gets unequipped.
For this to work, the effect creator needs to be a valid equipped item; you can set this either by spawning the effect from the item handler, or by using SetEffectCreator().
Behaviour without a equipped item in the effect creator slot is undefined.
This is used by the game to represent things like racial and feat effects, as well as movement speed adjustments.
Files | |
file | nwnx_effect.nss |
Classes | |
struct | NWNX_EffectUnpacked |
An unpacked effect. More... | |
Functions | |
struct NWNX_EffectUnpacked | NWNX_Effect_UnpackEffect (effect e) |
Convert native effect type to unpacked structure. More... | |
effect | NWNX_Effect_PackEffect (struct NWNX_EffectUnpacked e) |
Convert unpacked effect structure to native type. More... | |
int | NWNX_Effect_ReplaceEffect (object obj, effect eOld, effect eNew) |
replace an already applied effect on an object Only duration, subtype, tag and spell related fields can be overwritten. More... | |
int | NWNX_Effect_GetTrueEffectCount (object oObject) |
Gets the true effect count. More... | |
struct NWNX_EffectUnpacked | NWNX_Effect_GetTrueEffect (object oObject, int nIndex) |
Gets a specific effect on an object. This can grab effects normally hidden from developers, such as item properties. More... | |
void | NWNX_Effect_ReplaceEffectByIndex (object oObject, int nIndex, struct NWNX_EffectUnpacked e) |
Replaces an already applied effect with another. More... | |
int | NWNX_Effect_RemoveEffectById (object oObject, string sID) |
Removes effect by ID. More... | |
void | NWNX_Effect_Apply (effect eEffect, object oObject) |
Applys an effect, bypassing any processing done by ApplyEffectToObject. More... | |
effect | NWNX_Effect_SetEffectCreator (effect eEffect, object oObject) |
Sets an effect creator. More... | |
int | NWNX_Effect_GetIsEffectValid (effect eEffect) |
Checks if the given effect is valid. Unlike the game builtin, this call considers internal types too. More... | |
int | NWNX_Effect_GetAppliedEffectCount (object oObject) |
Returns the number of applied effects on the given object. More... | |
effect | NWNX_Effect_GetAppliedEffect (object oObject, int nNth) |
Returns the nNth applied effect on a object. More... | |
Variables | |
const int | DURATION_TYPE_EQUIPPED = 3 |
const int | DURATION_TYPE_INNATE = 4 |
struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect | ( | effect | e | ) |
Convert native effect type to unpacked structure.
e | The effect to convert. |
Definition at line 278 of file nwnx_effect.nss.
effect NWNX_Effect_PackEffect | ( | struct NWNX_EffectUnpacked | e | ) |
Convert unpacked effect structure to native type.
e | The NWNX_EffectUnpacked structure to convert. |
Definition at line 287 of file nwnx_effect.nss.
int NWNX_Effect_ReplaceEffect | ( | object | obj, |
effect | eOld, | ||
effect | eNew | ||
) |
replace an already applied effect on an object Only duration, subtype, tag and spell related fields can be overwritten.
Definition at line 297 of file nwnx_effect.nss.
int NWNX_Effect_GetTrueEffectCount | ( | object | oObject | ) |
Gets the true effect count.
oObject | The object to get the count of. |
Definition at line 310 of file nwnx_effect.nss.
struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect | ( | object | oObject, |
int | nIndex | ||
) |
Gets a specific effect on an object. This can grab effects normally hidden from developers, such as item properties.
oObject | The object with the effect |
nIndex | The point in the array to retrieve (0 to GetTrueEffectCount()) |
Definition at line 319 of file nwnx_effect.nss.
void NWNX_Effect_ReplaceEffectByIndex | ( | object | oObject, |
int | nIndex, | ||
struct NWNX_EffectUnpacked | e | ||
) |
Replaces an already applied effect with another.
oObject | The object with the effect to replace |
nIndex | The array element to be replaced |
e | The unpacked effect to replace it with. |
Definition at line 329 of file nwnx_effect.nss.
int NWNX_Effect_RemoveEffectById | ( | object | oObject, |
string | sID | ||
) |
Removes effect by ID.
oObject | The object to remove the effect from |
sID | The id of the effect, can be retrieved by unpacking effects. |
Definition at line 340 of file nwnx_effect.nss.
void NWNX_Effect_Apply | ( | effect | eEffect, |
object | oObject | ||
) |
Applys an effect, bypassing any processing done by ApplyEffectToObject.
eEffect | The effect to be applied. |
oObject | The object to apply it to. |
Definition at line 350 of file nwnx_effect.nss.
effect NWNX_Effect_SetEffectCreator | ( | effect | eEffect, |
object | oObject | ||
) |
Sets an effect creator.
eEffect | The effect to be modified. |
oObject | The effect creator. |
Definition at line 358 of file nwnx_effect.nss.
int NWNX_Effect_GetIsEffectValid | ( | effect | eEffect | ) |
Checks if the given effect is valid. Unlike the game builtin, this call considers internal types too.
eEffect | The effect to check |
Definition at line 370 of file nwnx_effect.nss.
int NWNX_Effect_GetAppliedEffectCount | ( | object | oObject | ) |
Returns the number of applied effects on the given object.
oObject | The object to get the applied effect count for. |
Definition at line 381 of file nwnx_effect.nss.
effect NWNX_Effect_GetAppliedEffect | ( | object | oObject, |
int | nNth | ||
) |
Returns the nNth applied effect on a object.
oObject | The object to get the applied effect copy for. |
nNth | The effect index to get. |
Definition at line 392 of file nwnx_effect.nss.
const int DURATION_TYPE_EQUIPPED = 3 |
EQUIPPED effects are always associated with a slotted item: Setting this duration type requires the effect creator to be set to the (already equipped) item that should remove this effect when unequipped. Removal behaviour for effects where the creator is NOT a equipped item is undefined. They are not removed by resting, cannot be dispelled, etc.
Definition at line 16 of file nwnx_effect.nss.
const int DURATION_TYPE_INNATE = 4 |
These are feat/racial effects used internally by the game to implement things like movement speed changes and darkvision. They cannot be removed by resting, dispelling, etc.
Definition at line 21 of file nwnx_effect.nss.