[
How to make a Portal In C++
by Mager1794
Table of Contents
1. SQL File
2. Finding the Scripts Folder
3. Finding the Coordinates
4. Editing Portals.cpp
5. Compile it

1. SQL File
Open up your Navicat/HeidiSQL/SQLYog
which ever one you use and enter this into the Query Box

Code:
INSERT INTO gameobject_names
(entry, Type, DisplayID, Name, spellfocus, sound1, sound2, sound3, sound4, sound5, sound6, sound7, sound8, sound9, unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7, unknown8, unknown9, unknown10, unknown11, unknown12, unknown13, unknown14)
VALUES
(ENTRY, 4, DISPLAYID, "NAME", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Make Sure you Edit your ENtry DisplayID and Name to your specific likings
remember keep track of that entry ID cause we need it

2. Finding the Portals Folder
Navigate to here
C:\Documents and Settings\Guest\Desktop\Ascent\Trunk\src\scripts\sr c\ExtraScripts
if using arc emu if not your Portals script is probably somewhere closely similar
to it atleast Please Note that where you see Ascent if you didn't name the folder
for your ascent source Ascent you must edit that as well if its not on your desktop
but if yours is like that then simply do Start->Run
and enter
C:\Documents and Settings\Guest\Desktop\Ascent\Trunk\src\scripts\sr c\ExtraScripts\

3. Find the Coordinates

in order to find the coords go into your server logon and type .gps
it will tell you mapid zoneid x y z o
write it all down for it is needed for the person to port
4. Editing Portals.cpp
Ok in your ExtraScripts folder you should find Portals.cpp open it up
go to the very end where you see
Code:
class tele_Ironforge_to_Stormwind: public GameObjectAIScript // Auberdine to Teldrassil
{
public:
tele_Ironforge_to_Stormwind(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(369, 0, 15.849360, 8.222371, -4.296173, 1);
}
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Ironforge_to_Stormwind(GO); }
};
GameObjectAIScript * create_go20000017(GameObject * GO) { return new tele_Ironforge_to_Stormwind(GO); }
Click Enter Once here <--
void SetupPortals(ScriptMgr * mgr)
{
mgr->register_gameobject_script(20000000, &tele_Orgrimarr_to_Undercity::Create);
mgr->register_gameobject_script(20000001, &tele_Undercity_to_Orgrimarr::Create);
mgr->register_gameobject_script(20000002, &tele_Orgrimarr_to_Gromgol::Create);
mgr->register_gameobject_script(20000003, &tele_Gromgol_to_Orgrimarr::Create);
mgr->register_gameobject_script(20000004, &tele_Undercity_to_Gromgol::Create);
mgr->register_gameobject_script(20000005, &tele_Gromgol_to_Undercity::Create);
mgr->register_gameobject_script(20000006, &tele_Ratchet_to_BootyBay::Create);
mgr->register_gameobject_script(20000007, &tele_BootyBay_to_Ratchet::Create);
mgr->register_gameobject_script(20000008, &tele_Auberdine_to_Menathil::Create);
mgr->register_gameobject_script(20000009, &tele_Menathil_to_Auberdine::Create);
mgr->register_gameobject_script(20000010, &tele_Menathil_to_Theramore::Create);
mgr->register_gameobject_script(20000011, &tele_Theramore_to_Menathil::Create);
mgr->register_gameobject_script(20000012, &tele_Auberdine_to_Azuremyst::Create);
mgr->register_gameobject_script(20000013, &tele_Azuremyst_to_Auberdine::Create);
mgr->register_gameobject_script(20000014, &tele_Teldrassil_to_Auberdine::Create);
mgr->register_gameobject_script(20000015, &tele_Auberdine_to_Teldrassil::Create);
mgr->register_gameobject_script(20000017, &tele_Stormwind_to_Ironforge::Create);
mgr->register_gameobject_script(20000016, &tele_Ironforge_to_Stormwind::Create);
}
in that spot type this (Replace whats in Blue)
Code:
class tele_Start_to_Finish: public GameObjectAIScript // Auberdine to Teldrassil
{
public:
tele_Start_to_Finish(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * pPlayer)
{
pPlayer->SafeTeleport(MapID, ZoneID, x, y, z, o);
 }
static GameObjectAIScript *Create(GameObject * GO) { return new tele_Start_to_Finish(GO); }
};
GameObjectAIScript * create_goEntry(GameObject * GO) { return new tele_Start_to_Finish(GO); }
now we have to register it
paste this at the very bottem (above the "}" though)
Code:
 mgr->register_gameobject_script(Entry, &tele_Start_to_Finish::Create);
5. Compile it

Now go to
C:\Documents and Settings\Guest\Desktop\Ascent\Trunk\src\scripts
Look for Scripts2008.sln if you have Visual C++ Express Edition 2008
scripts2005.sln if you have 2005
scripts2004.sln if you have 2003
open it and at the top find teh tab Build it will dropdown some options and click
Build Solution it should end Errorless
Now just logon and do
.go spawn EntryID
There ya go XD





› See More: [C++] Create Portal In C++