Here's a script that will do what you want. Just name it for the tag of the item. It assumes only that you aren't using the module as an effect creator for any other effects on the immortals; I did it this way for the sake of simplicity. A better way is to use a specific object as an effect creator, and check it instead of the module, but that requires placing a nonstatic place in an area (preferably plot), and giving it a unique tag you can use GetObjectByTag to find it with. It's better because sometimes other systems will use mod as an effect creator (a particular subrace system comes to mind), but this is simpler, and doesn't require any modifications outside of the script.
#include "x2_inc_switches"
void DoDMInvis(object oPC)
{
effect eEffect = EffectCutsceneGhost();
effect eEffect2 = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
effect eLink = SupernaturalEffect(EffectLinkEffects(eEffect, eEffect2));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPC);
}
void main() {
object oPC, oItem, oMod;
SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
return;
oPC = GetItemActivator();
oItem = GetItemActivated();
oMod = GetModule();
effect eEffect = GetFirstEffect(oPC);
int nAlreadyInvis = FALSE;
while (GetIsEffectValid(eEffect)) {
if (GetEffectCreator(eEffect) == oMod) {
DelayCommand(0.1, RemoveEffect(oPC, eEffect));
nAlreadyInvis = TRUE;
}
eEffect = GetNextEffect(oPC);
}
if (!nAlreadyInvis)
AssignCommand(oMod, DoDMInvis(oPC));
}
Funky
Modifié par FunkySwerve, 01 septembre 2013 - 06:33 .