My script:
void main()
{
effect eVFX;
effect eEffect;
int nStackSize=1;
object oPC = GetPCSpeaker();
location lLocation = GetLocation(oPC);
int nDuration = GetLevelByclass(class_TYPE_WIZARD, oPC) + GetLevelByclass(class_TYPE_SORCERER, oPC)*1;
CopyObject(oPC,lLocation,oPC,"ILLUSIONARY_GUARD");
object oGuard = GetNearestObjectByTag("ILLUSIONARY_GUARD");
SetName(oGuard,"Illusionary Guard");
CreateItemOnObject("wswgs002",oGuard, nStackSize, "Illusionary_Greatsword");
AssignCommand(oGuard, ActionEquipItem(GetItemPossessedBy(OBJECT_SELF, "Illusionary_Greatsword"), INVENTORY_SLOT_RIGHTHAND));
AddHenchman(oPC, oGuard);
ChangeToStandardFaction(oGuard, STANDARD_FACTION_DEFENDER);
eEffect = EffectDamageShield(0, DAMAGE_BONUS_1d8, DAMAGE_TYPE_MAGICAL);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oGuard, IntToFloat(nDuration));
eEffect = EffectDamageReduction(5, DAMAGE_POWER_PLUS_SIX);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oGuard, IntToFloat(nDuration));
eEffect = EffectHaste();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oGuard, IntToFloat(nDuration));
eVFX = SupernaturalEffect(EffectVisualEffect(VFX_DUR_ETHEREAL_VISAGE));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oGuard, IntToFloat(nDuration));
eVFX = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
DelayCommand(IntToFloat(nDuration), ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oGuard));
DelayCommand(IntToFloat(nDuration), DestroyObject(oGuard, 0.2));
}
Problem: Nothing happens. The copied creature does not get the visual effects, delayed destroy, added to the PCs party as a hench, or anything in the script. I looked up CopyObject on lexicon (
http://www.nwnlexico....php/CopyObject) and under known bugs it states "There are problems with the new tag as well. Calling GetTag with the
copied object as a parameter works, but calling GetObjectByTag won't
return the copy, or at least it won't all the time. Calling
GetTag(GetObjectByTag("")) will also return the tag of the most recently
copied object."
I believe this may be the root of my problems. Can anyone help solve this?