What you need before we get started:
- any text editor
- some experience in compiling .dlls
- Microsoft Visual Studios
- A working private server
First, you start with the basic script:
Code:#include "StdAfx.h" #include "Setup.h" #ifdef WIN32 #pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float' #endif //Defining Pwarper class SCRIPT_DECL Pwarper : 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; } }; void Pwarper::GossipHello(Object* pObject, Player * Plr, bool AutoSend) { if(Plr->CombatStatus.IsInCombat()) { Plr->BroadcastMessage("You are in combat!"); } if(!Plr->CombatStatus.IsInCombat()) { GossipMenu *Menu; objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr); 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);} if(AutoSend) Menu->SendTo(Plr); } }; void Pwarper::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code) { GossipMenu*Menu; switch(IntId) { case 0: GossipHello(pObject, Plr, true); break; case 1: // Horde Cities { 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; case 2: // Alliance Cities { objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr); Menu->AddItem(5, "The Exodar", 8); Menu->AddItem(5, "Stormwind", 9); Menu->AddItem(5, "Ironforge", 10); Menu->AddItem(5, "Darnassus", 11); Menu->SendTo(Plr); } break; case 4://Silvermoon { Plr->EventTeleport(530, 9400.486328, -7278.376953, 14.206780); }break; case 5://Orgrimmar { Plr->EventTeleport(1, 1371.068970, -4370.801758, 26.052483); }break; case 6://ThunderBluff { Plr->EventTeleport(1, -1304.569946, 205.285004, 68.681396); } break; case 7://Undercity { Plr->EventTeleport(0, 2050.203125, 285.650604, 56.994549); } break; case 8: //Exodar { Plr->EventTeleport(530, -4072.202393, -12014.337891, -1.277277); } break; case 9: //Stormwind { Plr->EventTeleport(0, -9100.480469, 406.950745, 92.594185); } break; case 10: //Ironforge { Plr->EventTeleport(0, -5028.265137, -825.976563, 495.301575); } break; case 11: //Darnassus { Plr->EventTeleport(1, 9985.907227, 1971.155640, 1326.815674); } break; case 99: //main menu { objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr); 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->SendTo(Plr); }break; } }; void Pwarper::GossipEnd(Object * pObject, Player* Plr) { GossipScript::GossipEnd(pObject, Plr); } void SetupPwarper(ScriptMgr * mgr) { GossipScript * gs = (GossipScript*) new Pwarper(); mgr->register_item_gossip_script(60001,gs); }
Copy and paste that into you text editor. Now we get to the customizing, to add custom locations what you do is first do .gps at the exact location you want to teleport to. Then, you take that information and complete this:
For case # you can put in what ever number you want that hasn't been used yet. Then for the map, x, y, and z numbers, use your .gps info to fill that in.Code:case "#": { Plr->EventTeleport(map #, x #, y #, z#); }break;
When you are finished with that, you add this to the menus:
Replace case # with the case number you chose above and replace Teleport Name with the name of the location you are teleporting to. Finally, save your script and compile. To make the item ingame execute this query:Code:Menu->AddItem(5, "Teleport Name", "case #");
The script was made by Aldaus and updated by Spartansp. So this should work with the latest rev.Code:INSERT INTO `items` VALUES ('60001', '8', '-1', '-1', 'Portable Teleporter', 'Portable Teleporter', 'Portable Teleporter', 'Portable Teleporter', '42629', '1', '0', '0', '0', '0', '1503', '1791', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '33208', '0', '579', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'Don't lose yourself now!', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', null, '0', null, '0', '0', '0', '0', '0', '0', '0', null, null, '0', '-1', '0');
Have Fun!