How to create a warp NPC in C++ menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    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)

    How to create a warp NPC in C++

    well this is fully done in notepad for me cause the computer i do my programming and stuff is broken and i gotta buy a new copy of windows
    for it but hey alteast im trying here
    ok




    type this into your notepad or visual c++ or what ever your gonna use

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305)
    #endif


    that is your opening text


    Next type this under that


    Code:
    
    class SCRIPT_DECL GlobalNPC : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
        void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
        void GossipEnd(Object * pObject, Player* Plr);
    	void Destroy()
    	{
    		delete this;
    	}
    };
    
    
    ok now we will make the opening menu that you see when you speak to the warpNPC


    Code:
    
    void GlobalNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
        {
            GossipMenu *Menu;
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    
    now here is where we divide the horde and ally warps

    "i got bored of old color so i went to red"
    Code:
    
    		if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
    ok that divided them so now under that put

    Code:
    
    		{Menu->AddItem(0, "Horde Cities", 1);}else{Menu->AddItem(1, "Alliance Cities", 2);}
    
    that will make it where if alliance they cant port to horde and if horde they cant port to alliance


    Code:
    
    		Menu->AddItem(2, "Global Locations", 80);		
    

    look at taht study it clearly stare stare stare BAM!!! you got hit with knowledge

    lets break it down

    Menu- its stating that its part of the menu obvious right

    ->pointing to the command i guess lol thats my easy description

    AddItem - This is what will add this to be selectable on the menu as a port or another menu with more ports

    the 2 is just a number for the icon that will be next to it i usually put 0 for it cuase im cool like that

    "Global Locations" - that is the name of the menu or port

    then 80 - that is the case that that menu links to

    ok lets create our own little custom one here just so we understand it

    now do what ever you want for yours dont scroll down past the line below til you finish your menu peice



    _

    ok for my creation i got


    Menu->AddItem(4, "ZOMG this guide is awesome", 20);

    weird eh,

    but if your menu is kind like mine then Good job

    now before we go any further let me mention the case thing i said earlier

    on my example i put the case as 20

    so somewhere in my script will be


    Code:
    
    		case 20: //Magers guide		
    
    now if you have a slight C++ knowledge you know what that means
    but if you dont well then your screwed lol j/k
    the case is what the link will send you to
    if the case is a teleport it will port you to where its supposed to
    if its a menu you get to go to another menu again


    do you kinda understand??

    anyway after you made all the menu items you want for the first thing

    (btw dont make the Case the same as others or else it will do the same thing)

    after your done with your main menu type

    Code:
    
    		if(AutoSend)
                Menu->SendTo(Plr);
        }
    
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
    	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    	if(pCreature==NULL)
    		return;
    
            GossipMenu * Menu;
            switch(IntId)
            {		
    
    it should somewhat look like this

    Code:
    		if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
    		{Menu->AddItem(0, "Horde Cities", 1);}else{Menu->AddItem(1, "Alliance Cities", 2);}			
    		Menu->AddItem(3, "Azeroth Instances", 30);
    		Menu->AddItem(4, "Outland Instances", 50);
    		Menu->AddItem(5, "Shattrath", 20);
    		Menu->AddItem(6, "Gurubashi Arena", 21);
    		Menu->AddItem(8, "Buff me up, baby!", 96);
    		Menu->AddItem(7, "Make This Place Your Home", 95);		
    		Menu->AddItem(9, "Remove Resurrection Sickness", 97);
    
    		if(AutoSend)
                Menu->SendTo(Plr);
        }
    
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
    	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    	if(pCreature==NULL)
    		return;
    
            GossipMenu * Menu;
            switch(IntId)
            {
    great now we got that set up
    time for Case 0:

    Code:
    case 0: 
    		GossipHello(pObject, Plr, true);
            break;
    that goes directly under the little "{" mark from the code above

    now we go to case 1

    now one of your menu items that you made should have started with case 1 if not change it or just do a different case its all the same thing

    now if you want the case to send you to another menu just make it look like this a bit

    Code:
    case 1: 
                    {
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    				Menu->AddItem(5, "Silvermoon", 4);
                    Menu->AddItem(5, "Orgrimmar", 5);
                    Menu->AddItem(5, "Thunder Bluff", 6);
                    Menu->AddItem(5, "Undercity", 7);
    
                    Menu->SendTo(Plr);
    				}
            break;
    that goes directly under the little "{" mark from the code above

    I taught the Menu items so i dont need to describe that again
    and the Menu->SendTo(Plr);
    just make it to where it shows up

    all you need to know now is to make it port

    that would be a simple command

    so lets base off of Menu->AddItem(5, "Thunder Bluff", 6);


    so now we will put

    Code:
            case 6://ThunderBluff
                {
                    Plr->EventTeleport(1, -1304.569946, 205.285004, 68.681396);
                }
    			break;
    the //thunderbluff is just a comment that reminds you that, that one is the one that ports you to Thunder bluff

    Plr->EventTeleport - that is innitiating that the Plr or Player is going have the event teleport used on him/her

    then the coords are where you end up at


    now just type this at the bottom of this and your done



    Code:
    void GlobalNPC::GossipEnd(Object * pObject, Player* Plr)
    {
        GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupGlobalNPC(ScriptMgr * mgr)
    {
    	GossipScript * gs = (GossipScript*) new GlobalNPC();
        mgr->register_gossip_script(NPC ID)
    }
    replace the NPC ID with your NPCs ID and compile

    if you need help compiling look to another guide please


    Well Guys i hoped you liked it and please leave feed back

    i wanna know what you guys think
    Last edited by mager1794; 06-25-2008 at 06:27 PM.
    Lunar Gaming - Reaching For The Stars

    How to create a warp NPC in C++
  2. #2
    joestyle2's Avatar Member
    Reputation
    5
    Join Date
    Jan 2008
    Posts
    58
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice guide +rep if work !

  3. #3
    juaking2's Avatar Member
    Reputation
    1
    Join Date
    Dec 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mager1794 plz help me

    I need compile my warper in spanish, please u can compile my warper? Only 1 min to compile please to the last rev of ascent (4552).

    This is my warper

    I compile all good, but when I run with the ascent say: versions functions not found.

    I compile with the latest rev of ascent and also run with the latest

    Plz help me

    Nobody wants to help me and is only one minute

    What I do wrong?

    Sry my english is not very good i'm spanish

  4. #4
    uberkiid's Avatar Member
    Reputation
    5
    Join Date
    Nov 2007
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, total newb with C++ but, I think I know how to compile but I was just wondering where to put the code after it is compiled, script_bin folder? Any help would be great and this guide was awesome.

  5. #5
    xaverz's Avatar Banned
    Reputation
    8
    Join Date
    May 2008
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NIce will try it!!+rep

  6. #6
    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)
    Originally Posted by uberkiid View Post
    Ok, total newb with C++ but, I think I know how to compile but I was just wondering where to put the code after it is compiled, script_bin folder? Any help would be great and this guide was awesome.
    yes bro in the script bin folder
    Lunar Gaming - Reaching For The Stars

  7. #7
    ripcat3000's Avatar Member
    Reputation
    1
    Join Date
    Jan 2008
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can any one give me a link that will tell me how to compile it in to a .dll file and make it the latest rev?

  8. #8
    gopfa's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there are many "create teleport with c++" guides but not a single one explains how to compile it

  9. #9
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice +rep

    Could you add how the setup.h and setup.cpp would look like? As I think it's needed to compile

    And there is alot of guides that learn you how to compile (to the guy over me)

  10. #10
    glurpie123321's Avatar Member
    Reputation
    12
    Join Date
    May 2008
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice guid

  11. #11
    c0ddingt0n's Avatar Banned
    Reputation
    117
    Join Date
    Feb 2008
    Posts
    641
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +rep!! Thanks man hope this works

  12. #12
    Mango Jerry's Avatar Banned
    Reputation
    192
    Join Date
    Jan 2008
    Posts
    1,244
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great Guide.. Also im a Professional with C++ :]

  13. #13
    scopederr's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, so when i go to put in my npc, what will be the npc id? or do i have to create that somehow

  14. #14
    The Dragon Lord's Avatar Member
    Reputation
    2
    Join Date
    Jun 2008
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool ill try it to c if its like my guide
    if u dont +rep people when u say u will it means ur gay so no questions here

  15. #15
    antid2's Avatar Member
    Reputation
    2
    Join Date
    Mar 2008
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    id rather do in LUA or sql

Page 1 of 2 12 LastLast

Similar Threads

  1. [Trinity] How to create a custom npc in either Navicat or HeidiSQL
    By stubbsy27993 in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 04-30-2020, 07:46 PM
  2. [Guide] [Trinity] How to Create SQL Teleport NPC (2013)
    By 123shadowraider123 in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 09-21-2015, 08:38 AM
  3. How to create a heal NPC
    By ziPlet in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 03-10-2009, 02:10 PM
  4. How to make a Warp NPC/Teleporter NPC
    By Krunkage in forum WoW EMU Guides & Tutorials
    Replies: 19
    Last Post: 10-01-2008, 07:32 AM
  5. [Guide] How to create a Warp-NPC (Teleporter)
    By nikey_007 in forum WoW EMU Guides & Tutorials
    Replies: 19
    Last Post: 06-26-2008, 08:30 AM
All times are GMT -5. The time now is 09:01 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search