Hi! First of all I don’t really know what I’m doing.
I’m trying to make a custom “polymorph” spell using SetCreatureAppearanceType instead of a polymorph effect cause the latter changes the appearance only as far as I understand. So I took warlock’s Word of Changing script and I’m trying my best to change it somehow into SetCreatureAppearanceType using int nAppearanceType but nothing seems to work. I was able to somehow change the duration time and add it properly to spells.2da… but that’s it.
I’m not a scripter so my knowledge is pretty minimal to say it lightly. It’s for roleplaying reasons only, I’m trying my best to give my drow wizard an illusion spell to pass as a sun elf but… well nothing works.
Here’s my script (I’m really sorry, I know it’s a total mess), would you be so king and help me with it? I would be grateful for any help.
#include "x2_inc_spellhook"
#include "nwn2_inc_metmag"
void main()
{
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
//Declare major variables
int nSpell = GetSpellId();
int nCasterLvl = GetTotalLevels(OBJECT_SELF, 1) * 20; //GetCasterLevel(OBJECT_SELF);
if(nCasterLvl < 3)
{
nCasterLvl = 20;
}
object oTarget = GetSpellTargetObject();
effect eVis = EffectVisualEffect(VFX_HIT_SPELL_DISPLACEMENT);
effect ePoly;
int nAppearanceType;
int nMetaMagic = GetMetaMagicFeat();
//Enter Metamagic conditions
float fDuration = TurnsToSeconds(nCasterLvl * 90);
fDuration = ApplyMetamagicDurationMods( fDuration );
//Determine Polymorph subradial type
{
nAppearanceType = Elf,Sun;
}
ePoly = EffectPolymorph(nAppearanceType);
ePoly = EffectLinkEffects(ePoly, eVis);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpell, FALSE));
//Apply the VFX impact and effects
//ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget));
DelayCommand(0.4, AssignCommand(oTarget, ClearAllActions())); // prevents an exploit
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ePoly, oTarget, fDuration));
}