This is a script I made that applies an effect to a throne when the person with the correct cd-key will sit on it:
void main()
{
object oPC = GetLastUsedBy();
object oThrone = OBJECT_SELF;
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_YELLOW);
if(GetIsObjectValid(oThrone)&&
!GetIsObjectValid(GetSittingCreature(oThrone)) &&
GetPCPublicCDKey(oPC)== "xxx")
{
AssignCommand(oPC, ActionSit(oThrone));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
SetLocalInt(OBJECT_SELF, "DM_No_Magic", 1);
}
else
{
string NoSit = "You are not allowed to sit on this throne!";
FloatingTextStringOnCreature(NoSit, oPC);
}
}
Now I think it would be more funny when the visual effect is removed again when the person moves out of the throne.
I fear I have to use a loop?? And how?