Simplified script. Try this please and let me know if it works for you...
//:://////////////////////////////////////////////
//:: Created By: Pstemarie
//:: Created On: 5/9/2014
//:://////////////////////////////////////////////
void main()
{
object oPC = GetItemActivator();
int iSex = GetGender(oPC);
int iRace = GetAppearanceType(oPC);
int nEffect;
if(GetLocalInt(oPC,"USEDQITMASK") == 1)
{
SetLocalInt(oPC,"USEDQITMASK",0);
effect eEff = GetFirstEffect(oPC);
while(GetIsEffectValid(eEff) == TRUE)
{
if(GetEffectType(eEff) == EFFECT_TYPE_VISUALEFFECT)
{
RemoveEffect(oPC,eEff);
}
eEff = GetNextEffect(oPC);
}
return;
}
SetLocalInt(oPC,"USEDQITMASK",1);
switch (iSex)
{
case GENDER_MALE:
{
switch (iRace)
{
case APPEARANCE_TYPE_HALFLING: nEffect = 738; break;
case APPEARANCE_TYPE_DWARF: nEffect = 740; break;
case APPEARANCE_TYPE_ELF: nEffect = 742; break;
case APPEARANCE_TYPE_HUMAN:
case APPEARANCE_TYPE_HALF_ELF: nEffect = 744; break;
case APPEARANCE_TYPE_HALF_ORC: nEffect = 746; break;
}
}
break;
case GENDER_FEMALE:
{
switch (iRace)
{
case APPEARANCE_TYPE_HALFLING: nEffect = 739; break;
case APPEARANCE_TYPE_DWARF: nEffect = 741; break;
case APPEARANCE_TYPE_ELF: nEffect = 743; break;
case APPEARANCE_TYPE_HUMAN:
case APPEARANCE_TYPE_HALF_ELF: nEffect = 745; break;
case APPEARANCE_TYPE_HALF_ORC: nEffect = 747; break;
}
}
break;
}
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(nEffect),oPC);
return;
}
Tried out the script. Didn't work very well. Glanced over it and noticed a few typos. Numbers not pointing to the correct vfx for several, no gnomes at all (poor short guys), and no eEff number for the human cases.
I fixed up the sex/racial appearance cases part of the script:
case GENDER_MALE:
{
switch (iRace)
{
case APPEARANCE_TYPE_HALFLING: nEffect = 738; break;
case APPEARANCE_TYPE_DWARF: nEffect = 740; break;
case APPEARANCE_TYPE_ELF: nEffect = 742; break;
case APPEARANCE_TYPE_GNOME: nEffect = 744; break;
case APPEARANCE_TYPE_HUMAN: nEffect = 746; break;
case APPEARANCE_TYPE_HALF_ELF: nEffect = 746; break;
case APPEARANCE_TYPE_HALF_ORC: nEffect = 748; break;
}
}
break;
case GENDER_FEMALE:
{
switch (iRace)
{
case APPEARANCE_TYPE_HALFLING: nEffect = 739; break;
case APPEARANCE_TYPE_DWARF: nEffect = 741; break;
case APPEARANCE_TYPE_ELF: nEffect = 743; break;
case APPEARANCE_TYPE_GNOME: nEffect = 745; break;
case APPEARANCE_TYPE_HUMAN: nEffect = 747; break;
case APPEARANCE_TYPE_HALF_ELF: nEffect = 747; break;
case APPEARANCE_TYPE_HALF_ORC: nEffect = 749; break;
}
}
break;
I also noticed that the effect removal section has the side effect of removing *all* effects. Granted the mask could be seen as just a demo-piece and this script not so important, but would probably be nice for module builders who toss the mask in somewhere their module to not have it muck up players who had just buffed with all their spells and such and shortly after decided they didn't wanna oogabooga the gobbies anymore.
Perhaps set the mask effect to a 24 game hour duration and skip the whole removing of all effects from the PC? Or is there a way to remove a specific non-spell vfx?
Thinking about it for a moment more, maybe setup defining the constants for the mask vfx, TAD's tiki mask vfx, and whatever other VFX's builders may add into their own modules? Could even be useful for a seamless intergration of the community vfx package, allowing effects to be quickly added in, allow applying/removing them without disturbing regular spell vfx's and such? I could put together something for that if you are interested.