I am trying to make a Item Gossip that opens a codebox and you type a players name into it and it teleports you to that player. I need:
Command for If player is in Party
Gossip Script Template for Item
If i run into any problems ill post here
I am trying to make a Item Gossip that opens a codebox and you type a players name into it and it teleports you to that player. I need:
Command for If player is in Party
Gossip Script Template for Item
If i run into any problems ill post here
I won't write the code for you. But I'll point you in the right direction.
First off. It's called Function, not command.. C++ isn't commands. It's functions.
There is a way of checking if the player is in a Group. Not a command.
Code:if(_player->GetGroup() != NULL) { //Player hasn't any group } else { //Player has a group }
For the item issue, just register it as an item instead for an npc.
Code:mgr->register_item_gossip_script(/*ITEM ID*/, /*Gossip Class. */);
Or just use TheSpideys. I have no idea if it works still. It's pretty old
Freind Porter by TheSpidey
Last edited by Link_S; 10-25-2009 at 02:01 PM. Reason: Misspell
Why do I need a signature?
I need it setup up in a specific manor, like You open the item goto the option choose it, if the player is a (Insert Gm Level) it opens a menu and when they select the Teleport option a Codebox pops up so they can type in the players name and if the player isnt in a party and isnt themself then it executes the teleport. Im No good at C++ been fiddling with this for a week and no results. So Link_S or anyone could you make this script? And then explain to me how to put it into the server. I have no C++ knowledge and since i cant even make the script i havent gotten to the point of trying to put it in. If possible and anyone wants to tackle some more C++ Scripts i need i will +Rep Big time, the scripts i need areCode:C++ Global channel *type /o C++ Haste system ( Haste isnt capped at 1.0 seconds per hit
these are used in the Fusion Reborn Repack at AC-Web if anyone knows how to... Ripp them outta the repack thats great but i would like to have these Scripts if possible.
No answers?? Whats up guys?
I actually made this one. The FriendPorter:
http://www.mmowned.com/forums/emulat...nd-porter.html
Yea i know i fail @ C++ so i cant do it. I need some help lol
He already made it..
I live in a shoe
Hello, is this thing on?
I said I already made it, you don't need to write it again >>
Laughting @ Spidey
That comment were awesome xP
[/COLOR]
I dont want the exact one you made, i want it setup so it costs nothing, it opens a Codebox where you input a name.
Based off of Spidey's Friend Porter, all credit should go to him if anything. I just modified it to fit your request.
Code:#include "StdAfx.h" #include "Setup.h" #ifdef WIN32 #pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float' #endif #define ITEM_ID 123456 #define GM_LEVEL 'a' class SCRIPT_DECL GMPorter : 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 GMPorter::GossipHello(Object* pObject, Player* Plr, bool AutoSend) { GossipMenu* Menu; objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr); //Check to see if the player has the appropriate GM level if(Plr->GetSession()->CanUseCommand(GM_LEVEL)) Menu->AddItem(0, "Port To Player", 1, 1); Menu->AddItem(0, "[Exit]", 0); if(AutoSend) Menu->SendTo(Plr); } void GMPorter::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char* Code) { GossipMenu* Menu; switch(IntId) { case 0: //End Gossip Plr->Gossip_Complete(); break; case 1: //Port to Player { //No name entered if(!Code) { Plr->BroadcastMessage("%sYou have not entered a name to port to!", MSG_COLOR_RED); Plr->Gossip_Complete(); } Player* pPlayer = objmgr.GetPlayer(Code, false); //Can't find the player entered if(!pPlayer) { Plr->BroadcastMessage("%sPlayer is not online or could not be found.", MSG_COLOR_RED); Plr->Gossip_Complete(); } //If player has a group if(pPlayer->GetGroup() != NULL) { Plr->BroadcastMessage("%sPlayer has a group, thus you cannot teleport to him.", MSG_COLOR_RED); Plr->Gossip_Complete(); } else { float XLoc = pPlayer->GetPositionX(); float YLoc = pPlayer->GetPositionY(); float ZLoc = pPlayer->GetPositionZ(); float OLoc = pPlayer->GetOrientation(); uint32 Map = pPlayer->GetMapId(); Plr->EventTeleport(Map, XLoc, YLoc, ZLoc); Plr->SetOrientation(OLoc); Plr->BroadcastMessage("%sYou have been successfully teleported to %s .", MSG_COLOR_RED, pPlayer->GetName()); Plr->Gossip_Complete(); } }break; } }; void GMPorter::GossipEnd(Object* pObject, Player* Plr) { GossipScript::GossipEnd(pObject, Plr); }; void SetupGMPorter(ScriptMgr* mgr) { GossipScript* gs = (GossipScript*) new GMPorter(); mgr->register_item_gossip_script(ITEM_ID, gs); };
Okay i read through it, looks like itll do exactly what i want. But now the main problem how do i implement it? Do i add it under like Optional when compiling err what?
I usually just add it with the rest of my gossip scripts are, and then in the Setup.h of that project add:
Then navigate to that projects Setup.cpp and add:Code:void SetupGMPorter(ScriptMgr* mgr);
You should see where the rest of your gossip scripts are added into your Setup's so you shouldn't have trouble finding the right place to add that into your Setup.cpp.Code:SetupGMPorter(mgr);
As for the item query to get the item into your database, the query would vary depending on your database structure for your core..
I know the whole item thing, Still fuzzy on the whole adding into server part. Can you do a step by step like Tell me what folder it should be in, Cause i use Arcemu
Read the ArcEmu wiki, it has information on how to compile custom scripts. http://www.arcemu.info/wiki/index.ph...C%2B%2B_Addons