Hello all! In this small tutorial I'll teach you how to make a portal using Lua.
First, we'll need a Gameobject to serve as a portal. You can use the folowing SQL querry as a base.
Now, lets make a new Lua script. Since we're making a portal to Gurubashi Arena, lets call it "arenaportal.lua". The name doesn't realy matter, just as long it's a .lua file.Code:INSERT INTO gameobject_names_copy (`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 (2, 1, 4396, 'Gurubashi Arena Portal', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Copy and paste the folowing piece of Lua code in the file. You might want to adjust the information to correspond to your Gameobject, and ofcourse your location (type .gps ingame for the coordinates).
If you're taking the coordinates from the recall table in your Ascent world database be SURE to replace their commas by dots. If not, this'll cause function overflow.
Code Breakdown time!Code:function gurubashiarena(pGameObject, event, pMisc) pMisc:Teleport(0, -13228.470703, 227.919037, 32.869213) end RegisterUnitEvent(2, 2, "gurubashiarena")
RegisterUnitEvent(2, 2, "gurubashiarena") :: This is the "Reigsterevent". Replace the FIRST '2' by your Gameobject Id.
function gurubashiarena(pGameObject, event, pMisc) :: This defines the function. It's the header that tells Ascent the function named "gurubashiarena" starts here.
pMisc:Teleport(0, -13228.470703, 227.919037, 32.869213) :: Teleports in this order: mapid, x, y, z, orientation.
end :: Tells Ascent the function "gurubashiarena" stops here.
Thats all! I hope you've enjoyed my tutorial. And learned something with it. If you have any questions or problems, feel free to ask!