GetEffectCreator(effect)
Gets the object that created eEffect.
object GetEffectCreator( effect eEffect );
Parameters
eEffect
An existing effect already applied in game.
Description
Returns the object that created eEffect.
Returns OBJECT_INVALID if eEffect is not a valid effect.
Must be used on eEffect which has been got by GetFirst/NextEffect().
The creator is always the object the script which applied the effect runs from. Spell scripts are always executed upon the spell caster (and so effects applied from them spells get the caster as the effect creator). Area-of-effects that create the effect return the caster of it, so basically the caster created it, never the AOE.
Traps cannot be returned, unless they are not one-shot, because they are removed from the game (thus made OBJECT_INVALID) if they are one shot only.
Doors, placeables and the like can create effects and the creator is the placeable and door.
Additional to this, Area's might, or might not, be valid creators - send an e-mail if you know. Modules cannot be valid creators.
Remarks
You must first create and place the effect you wish to examine into a variable before calling this function. This is useful when you want to specify only effects that were applied by specific creatures or objects. An example may be a trap that causes a strength decrease each round if the player is in its area of effect. If the player leaves that area of effect, the trap will loop through the effects on the player looking for only the effects it created, and remove them.
Known Bugs
Returns OBJECT_INVALID if the effect creator was the module.
Version
1.22
Example
// Lever: 2 things happen. If used once, it applies a strength decrease. // Secondly, if used again, it will remove all effects from the target // which were created by this lever. void main() { // Get ourselves and the user object oSelf = OBJECT_SELF; object oUser = GetLastUsedBy(); // If used once, we apply an effect if(GetLocalInt(oSelf, "DO_ONCE") == FALSE) { // Done something once SetLocalInt(oSelf, "DO_ONCE", TRUE); // Apply a strength effect, and a visual effect eStr = EffectAbilityDecrease(ABILITY_STRENGTH, 2); effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oUser); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStr, oUser); } else { // Remove all effects created by us - IE, the permament strength decrease. effect eCheck = GetFirstEffect(oUser); while(GetIsEffectValid(eCheck)) { // Check creator if(GetEffectCreator(eCheck) == oSelf) { // Remove the effect as it was created by us. RemoveEffect(oUser, eCheck); } eCheck = GetNextEffect(oUser); } } }
See Also
functions: | GetAreaOfEffectCreator | GetEffectDurationType | GetEffectSpellId | GetEffectSubType | GetEffectType |
categories: | Effects Functions |
author: John Shuell, editor: Jasperre
Send comments on this topic.