PDA

View Full Version : [Lua]How to create an easy portal in Lua



^_^ Electrify
20-07-11, 04:06 PM
function TELENAME1_onUse (pUnit, Event, pMisc)
pMisc:Teleport (MAPID, X, Y, Z)
end

RegisterGameObjectEvent (ID1 , 4, "TELENAME1_onUse")

TELENAME1 - You don't have to change it
Now go in-game and type .gps at the location your portal want teleport.
Now fill MAPID, X , Y, Z to look like it is in-game.
ID1 - Put the entry of the Portal.

Copy the code to your notepad and save it as a .lua, and copy it to your scripts folder.

Now all you have to do is to add the portal in-game.Make a new notepad and copy this modifyed code and save it as .sql and insert it in DB.

INSERT INTO `gameobject_names` VALUES (ID1,22,Displayid,'Name1',0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0)

ID1 - Entry you've written in the lua script.
22 - Must remain 22 or the portal won't work
Displayid - Choose 8196, is a good one.
Name1 - Name what will show after you click on it.

Restart the server and you'r done!

shumi
28-07-11, 03:33 PM
Nice tutorial. Very useful.
Thanks.