/*
    PROJECT Q IV
    (c) 2022 by Pstemarie

    Mimic OnSpawn Event Script

        Activates the OnPhysicallyAttacked and OnSpellCastAt user defined
        events.

    Version: 1.0
    Created: 10 Oct 2021
    Author:  Pstemarie
    v1.1:    6 Jun 2022 Pstemarie - added OnDamaged event

*/

#include "x0_i0_anims"
#include "x0_i0_treasure"

void main()
{
    SetSpawnInCondition(NW_FLAG_ATTACK_EVENT);
    SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT);
    SetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT);

// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************

    SetListeningPatterns();     //* Goes through and sets up which shouts the NPC will listen to.
    WalkWayPoints();            //* Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
                                //  1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
                                //  2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
                                //     combat.

    //* Create a small amount of treasure on the creature
    if ((GetLocalInt(GetModule(), "X2_L_NOTREASURE") == FALSE)  &&
        (GetLocalInt(OBJECT_SELF, "X2_L_NOTREASURE") == FALSE)   )
    {
        CTG_GenerateNPCTreasure(TREASURE_TYPE_MONSTER, OBJECT_SELF);
    }

    // ***** ADD ANY CUSTOM ON-SPAWN CODE HERE ***** //

}
