Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
- *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
- *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
- *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
- * EmuDevs - (http://emudevs.com)
- */
- class npc_tut_ai : public CreatureScript // npc_tut_ai - Class constructor, name this anything that doesn't conflict with another name
- {
- public:
- npc_tut_ai() : CreatureScript("npc_tut_ai") { } // npc_tut_ai, should be the same as class npc_tut_ai -- CreatureScript("npc_tut_ai") - This is your 'ScriptName' that you will assign in your database
- struct npc_tutAI : public ScriptedAI // npc_tutAI - Structure name. This can be anything that doesn't conflict with your class constructor. 'public ScriptedAI', We're using ScriptedAI, so we call it
- {
- npc_tutAI(Creature* creature) : ScriptedAI(creature) { } // Setting up
- void Reset() // This will be called once the npc resets. (OnSpawn, OnCombatLeave, etc)
- {
- }
- void UpdateAI(uint32 diff) // This function updates every 100 or 1000 (I believe) and is used for the timers, etc
- {
- }
- void EnterCombat(Unit* /*target*/) // This calls when the npc enters combat
- {
- }
- void JustDied(Unit* /*killer*/) // This calls when the npc dies
- {
- }
- void KilledUnit(Unit* /*victim*/) // This calls when the npc kills a unit
- {
- }
- };
- CreatureAI* GetAI(Creature* creature) const // We then return new 'npc_tutAI' so the script will load and work ingame
- {
- return new npc_tutAI(creature);
- }
- };
- void AddSC_ai_tutorial() // This is your ScriptLoader.cpp setup function
- {
- new npc_tut_ai(); // Call any new classes here as 'new classname();'
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement