/*
    PROJECT Q IV v4.00
    (c) 2022 by Pstemarie

    Shrieker OnSpawn Event Script

        Prevents the shrieker from attacking

    Version: 1.0
    Created: 5 Oct 2002
    Author:  Lathspell
    v1.1:    6 Jun 2022 Pstemarie - added check for PC associates as they should trigger the alarm too

*/

void main()
{
    int nUser = GetUserDefinedEventNumber();

    if(nUser == EVENT_PERCEIVE)
    {
        object oCreature = GetLastPerceived();
        {
            if (GetLastPerceptionSeen() &&
                (GetIsPC(oCreature) || GetIsPC(GetMaster(oCreature))) )
            {
                ClearAllActions();
                SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_SHOUT);
                SetLocalObject(OBJECT_SELF,"NW_L_TargetOfAttack",oCreature);
                PlaySound("sdr_mindhit");
                PlaySound("sdr_mindhit");
            }
            else
            {
                ClearAllActions();
            }
        }
    }
}
