[C++] Gossip Example Script/Guide menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Gossip Example Script/Guide

    Example C++ Gossip script!

    This is small C++ gossip script example/guide, it will teach you where 2 place most of functions, what 2 u place where and lot more small things that can help starter a lot.

    Script:


    Code:
    /* 
    		C++ Gossip Script Example by Azolex
    */
    #include "StdAfx.h"
    #include "Setup.h"
    
    /*
             Configuration:
    */
    
    #define NPC_ID
    
    // Teleport stuff
    #define MapID
    #define xCoord
    #define yCoord
    #define zCoord
    #define Orientation
    
    // Morph Stuff
    #define ModelID
    
    // Buff Stuff
    #define BuffID
    
    // Learn Spell stuff
    #define Spell1ID
    #define Spell2ID
    
    class GossipExample : public GossipScript
    {
    public:
    	void Destroy()
    	{
    		delete this;
    	};
    
        void GossipHello(ObjectPointer pObject, PlayerPointer Plr, bool AutoSend)
        {
            GossipMenu *Menu;
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 933, Plr);
    
            Menu->AddItem(0, "Teleport", 0);
    	Menu->AddItem(0, "Morph", 1);
    	Menu->AddItem(0, "Buff", 2);
    	Menu->AddItem(0, "Learn", 3);
    
            if(AutoSend)
                Menu->SendTo(Plr);
        };
    
    	void GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
    	{
    
    	GossipMenu * Menu;
            switch(IntId)
            {
    		case 0: // IntId = 0, "Teleport"
    			Plr->SafeTeleport(MapID, InstanceID/*Can be left NULL but i suggest using Plr->GetInstanceID()*/, xCoord, yCoord, zCoord, Orientation);
    			break;
    		case 1: // IntId = 1, "Morph"
    			Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, ModelID);
    			break;
    		case 2: // IntId = 2, "Buff"
    			Plr->CastSpell( Plr, dbcSpell.LookupEntryForced(BuffID), true);
    			break;
    		case 3: // IntId = 3, "Learn"
    			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 0, Plr);
    
    			Menu->AddItem(0, "Spell1", 4);
    			Menu->AddItem(0, "Spell2", 5);
    
    			Menu->SendTo(Plr);
    			break;
    		case 4: // IntId = 4, "Spell1"
    			Plr->addSpell(Spell1ID);
    			break;
    		case 5: // IntId = 5, "Spell2"
    			Plr->addSpell(Spell2ID);
    			break;
    		};
    	};
    };
    
    void SetupGuardGossip(ScriptMgr * mgr)
    {
    	GossipScript * Example = (GossipScript*) new GossipExample();
    	mgr->register_gossip_script(NPC_ID,  Example);	
    }
    IntId - Sets position and unique option id, it helps you 2 fully control selection.

    Menu - Menu pointer, it allows you to control menu.

    IconId - Menu item IconId, for example inkeeper, Bank, auction... i don't know Id's except that this(1) is normal Cloud.

    Now, using this template u can use some advanced functions, 2 modify something more than display id or 2 teach player spells, you can find them here:
    C++ Function Libery - Credits to Gastricpenguin.

    Now, before using this script you should populate configuration stuff, NPC_ID, ModelID and stuff. I hope this script helped you, if you have question ask it !

    Find about scripting, programming and music! My blog: https://worldofsmth.wordpress.com!

    [C++] Gossip Example Script/Guide
  2. #2
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice, though i like my guide better (though it was wrote forever ago) lol

    +Rep x2
    Lunar Gaming - Reaching For The Stars

  3. #3
    samppaa's Avatar Member
    Reputation
    1
    Join Date
    Aug 2007
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice! Thanks

Similar Threads

  1. [Guide] Lua Scripting Guide is here [Updating]
    By Illidan1 in forum WoW EMU Guides & Tutorials
    Replies: 93
    Last Post: 11-04-2008, 06:56 PM
  2. Basic SQL Scripting Guide
    By R0flz0r in forum WoW EMU Guides & Tutorials
    Replies: 7
    Last Post: 04-17-2008, 06:34 PM
  3. LuA SCRIPTING (guide)
    By Dee2001 in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 03-05-2008, 11:43 AM
  4. Gossip scripting guide!
    By Le Froid in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 12-13-2007, 05:06 PM
  5. GM Scripting Guides by me (there is alot of Scripting guides by me in here)
    By Illidan1 in forum WoW EMU Guides & Tutorials
    Replies: 26
    Last Post: 11-27-2007, 04:46 PM
All times are GMT -5. The time now is 07:52 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search