#include "x0_i0_anims" #include "x0_i0_treasure" #include "x2_inc_switches" void main() { // ***** CUSTOM USER DEFINED EVENTS ***** / /* If you uncomment any of these conditions, the creature will fire a specific user-defined event number on each event. That will then allow you to write custom code in the "OnUserDefinedEvent" handler script to go on top of the default NPC behaviors for that event. Example: I want to add some custom behavior to my NPC when they are damaged. I uncomment the "NW_FLAG_DAMAGED_EVENT", then create a new user-defined script that has something like this in it: if (GetUserDefinedEventNumber() == 1006) { // Custom code for my NPC to execute when it's damaged } These user-defined events are in the range 1001-1007. */ // * Fire User Defined Event 1001 in the OnHeartbeat // * SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT); // * Fire User Defined Event 1002 // * // SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT); // * Fire User Defined Event 1005 // * // SetSpawnInCondition(NW_FLAG_ATTACK_EVENT); // * Fire User Defined Event 1006 // * SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT); // * Fire User Defined Event 1008 // * // SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT); // * Fire User Defined Event 1003 // * // SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT); // * Fire User Defined Event 1004 // * // SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT); SetSpawnInCondition(NW_FLAG_DEATH_EVENT); // ***** DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ***** // // * Goes through and sets up which shouts the NPC will listen to. // * SetListeningPatterns(); // * Walk among a set of waypoints. // * 1. Find waypoints with the tag "WP_" + NPC TAG + "_##" and walk // * among them in order. // * 2. If the tag of the Way Point is "POST_" + NPC TAG, stay there // * and return to it after combat. // // * Optional Parameters: // * void WalkWayPoints(int nRun = FALSE, float fPause = 1.0) // // * If "NW_FLAG_DAY_NIGHT_POSTING" is set above, you can also // * create waypoints with the tags "WN_" + NPC Tag + "_##" // * and those will be walked at night. (The standard waypoints // * will be walked during the day.) // * The night "posting" waypoint tag is simply "NIGHT_" + NPC tag. WalkWayPoints(); //* 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 SPECIAL ON-SPAWN CODE HERE ***** // // * If Incorporeal, apply changes if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) == TRUE) { effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL); eConceal = ExtraordinaryEffect(eConceal); effect eGhost = EffectCutsceneGhost(); eGhost = ExtraordinaryEffect(eGhost); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF); } SetIsDestroyable(FALSE, TRUE); }