StickyIcky
25-07-08, 01:44 PM
Made by WigSplitta
In this tutorial I will show you how to make a portal in C++.
I will be using a portal that goes to Orgrimmar for an example
Well first of all we need to start the clean .cpp file with this:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#pragma warning(disable:4018) // warning C4018: '<' : signed/unsigned mismatch
#endif
#define GAME_OBJECT_ID 20000000 //Your Portal GO ID
Then you want to add this a few lines down from that:
class tele_Org: public GameObjectAIScript // Org portal
Then add:
{
public:
tele_Org(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(0, 0, 2066.594727, 284.810089, 97.031319, 1); //Map Id, 0, X, Y, Z, O
}
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Org(GO); }
};
GameObjectAIScript * create_goGAME_OBJECT_ID(GameObject * GO) { return new tele_Org(GO); }
Then you will have to make a game object in your database for it.
Then change #define GAME_OBJECT_ID 20000000 to whatever the GO ID is.
It should now look like:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#pragma warning(disable:4018) // warning C4018: '<' : signed/unsigned mismatch
#endif
#define GAME_OBJECT_ID 20000000 //Your Portal GO ID
class tele_Org: public GameObjectAIScript // Org portal
{
public:
tele_Org(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(0, 0, 2066.594727, 284.810089, 97.031319, 1); //Map Id, 0, X, Y, Z, O
}
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Org(GO); }
};
GameObjectAIScript * create_goGAME_OBJECT_ID(GameObject * GO) { return new tele_Org(GO); }
In this tutorial I will show you how to make a portal in C++.
I will be using a portal that goes to Orgrimmar for an example
Well first of all we need to start the clean .cpp file with this:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#pragma warning(disable:4018) // warning C4018: '<' : signed/unsigned mismatch
#endif
#define GAME_OBJECT_ID 20000000 //Your Portal GO ID
Then you want to add this a few lines down from that:
class tele_Org: public GameObjectAIScript // Org portal
Then add:
{
public:
tele_Org(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(0, 0, 2066.594727, 284.810089, 97.031319, 1); //Map Id, 0, X, Y, Z, O
}
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Org(GO); }
};
GameObjectAIScript * create_goGAME_OBJECT_ID(GameObject * GO) { return new tele_Org(GO); }
Then you will have to make a game object in your database for it.
Then change #define GAME_OBJECT_ID 20000000 to whatever the GO ID is.
It should now look like:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#pragma warning(disable:4018) // warning C4018: '<' : signed/unsigned mismatch
#endif
#define GAME_OBJECT_ID 20000000 //Your Portal GO ID
class tele_Org: public GameObjectAIScript // Org portal
{
public:
tele_Org(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(0, 0, 2066.594727, 284.810089, 97.031319, 1); //Map Id, 0, X, Y, Z, O
}
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Org(GO); }
};
GameObjectAIScript * create_goGAME_OBJECT_ID(GameObject * GO) { return new tele_Org(GO); }