Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- EmuDevs - (http://emudevs.com)
- Use this as your template. Make sure to point credits towards ED.
- */
- class npc_tut : public CreatureScript // npc_tut - Class constructor, name this anything that doesn't conflict with another class name
- {
- public:
- npc_tut() : CreatureScript("npc_tut") { } // npc_tut, should be the same as class npc_tut so you don't have many different names scattered everywhere; CreatureScript("npc_tut") - This is your 'ScriptName' that you will assign in your database.
- // This will show first when a player clicks on a gossip npc
- // override since it is a virtual function
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, "First Menu", GOSSIP_SENDER_MAIN, 1); // 1. Once the player clicks this menu,
- SendGossipMenuFor(player, 1, creature->GetGUID()); // This sends the menu to the player
- return true;
- }
- // This will handle actions based on the menu clicked
- // override since it is a virtual function
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions) override
- {
- ClearGossipMenuFor(player);
- if (actions == 1) // 2. This is the action that will be called when player clicks our "First Menu"
- {
- player->GetSession()->SendAreaTriggerMessage("Hello World");
- CloseGossipMenuFor(player);
- }
- return true;
- }
- };
- void AddSC_tutorial() // This is your ScriptLoader.cpp setup function
- {
- new npc_tut; // Call any new classes here as 'new classname;'
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement