
Results 1 to 6 of 6
Thread: C++ Portal
Threaded View
-
25-07-08, 12:44 PM #1
C++ Portal
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:
Code:#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
Code:class tele_Org: public GameObjectAIScript // Org portal
Code:{ 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 change #define GAME_OBJECT_ID 20000000 to whatever the GO ID is.
It should now look like:
Code:#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); }