Modcraft - The community dedicated to quality WoW modding!
Wrath of the Lich King Modding => Serverside Modding => Tutorials => Topic started by: Kian on March 12, 2010, 09:00:57 pm
-
Hey guys, today I´ll show you how to make portals in c++ for better performance. It won´t take as much ram as lua. Thanks for mager for showing me.
So Let´s start.
1. Writing Sql Entry
First open your sql editor, like Navicat.
then add this
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
(ENTRYID, 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); unknown9, unknown10, unknown11, unknown12, unknown13, unknown14)
VALUES
Change the parts written in Capslock,
2. Finding Portal Folder
Open up your Arcemu Folder and navigate to
C:Documents and SettingsUserDesktopArcemutrunksrcscriptssrcExtraScripts
3. Finding Coordinates
Go Ingame to the place where your portal teleports you.
Then type .gps
and write down the mapid, zoneid, x, y, z and the o coordinates.
4. Adding your portal
Open up Portals.cpp and go to the end of the script.
find this part
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); }
EDIT 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);
}
Edit the part where It says EDIT HERE, add
class tele_Start_to_Finish: public GameObjectAIScript
{
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); }
and replace
Start with your portal position
Finish with the place where the portal teleports you to
MapID with the Mapid from the gps command
ZoneID with the ZoneId
X with X coordinates
Y with Y coordinates
Z with Z coordinates
and O with O coordinates,
Now we have to register the portal just like in lua. Write at the bottom of the script where the register functions are:
mgr->register_gameobject_script(Entry, &tele_Start_to_Finish::Create);
Replace
Entry with the Entryid from the sql file
Start with the Name taken above
and Finish with the Name taken above too.
Now Compile it and you´re finished.
Now go ingame and type
.go spawn Id
Replace Id with the Gameobject Id taken in the sql file.
[/color]
Have fun, Kian
-
Kian on C++ ways. What a wondefull day :)
Go on and thanks fpr the Tutorial.