Hi I used this WarpNPC generator to create a teleporter and I got three files.
these are the files:
setup.ccp
Code:
#include "StdAfx.h"
#include "Setup.h"
extern "C" SCRIPT_DECL uint32 _exp_get_version()
{
return MAKE_SCRIPT_VERSION(SCRIPTLIB_VERSION_MAJOR, SCRIPTLIB_VERSION_MINOR);
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupWarpnpc(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif
setup.h
Code:
#ifndef INSTANCE_SCRIPTS_SETUP_H
#define INSTANCE_SCRIPTS_SETUP_H
void SetupWarpNPC(ScriptMgr * mgr);
#endif
WarpNPC.cpp
Code:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
class SCRIPT_DECL WarpNPC : public GossipScript
{
public:
void Destroy()
{
delete this;
}
void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(5,"Teleport random location", 1);
if(AutoSend)
Menu->SendTo(Plr);
}
void 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)
{
case 1: //Teleport random location
{
//Teleport the player.
Plr->EventTeleport( 530, -1960.995361, 5378.362793, -12.428423);
Plr->Gossip_Complete();
}break;
}
}
};
void SetupWarpnpc(ScriptMgr * mgr)
{
GossipScript *warp = (Warpnpc*) new WarpNPC();
mgr->register_gossip_script(100000, warp);
}
any idea how I can add this? +Rep to whoever gives an working answer