Log in
Most Viewed Topics
Latest topics
2000>
Test
Make your own custom teleport now with advanced options
Page 1 of 1
Make your own custom teleport now with advanced options
<blockquote class="postcontent restore ">
*simple is up , advanced is down.
Here is a little script for beginners
-my first script (lol):-
*first of all lets add this tiny line to your movment.xml in data-->movement-->movement.xml
Code :
<movevent type="StepIn" itemid="9445" event="script" value="tele.lua"/>
just to let the sevrer know that when u stepon this item it do the stuff the script
in the place where it says itemid="9445" this is the id of the item you need to use as a teleport
then
make a new lua file name it tele.lua (to fast edit and saving files as lua and organizing use notepad++
[Only admins are allowed to see this link]
then add this:
what is in it:
1-you can select whatever item u want to act s a teleporter
Code :
local id = 5578 --this is the action id u need to edit to the item in map editor
local place = {x=1000, y=1000, z=7} --location where player will be tped
function onStepIn(cid, item, position, fromPosition)
if item.actionid == id then
doTeleportThing(cid, place)
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid ~= id then
end
end
Code :
local id = 5578
u change this in the map editor by clicking double click on
whatever item u chose and right the number in the action id field so if u
put other item like that u want to act like a tp it doesnt tp ppl
Code :
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
and this if u want a message (orange one) to be sent to player if
u dont delete this line if u want to change color go to your global
file and search for (message) u will find many types if u dont have
global file got to lib>constant
Code :
doSendMagicEffect(getPlayerPosition(cid), 10)
uyou see the part where , 10) is written this makes a teleport
effect when player is teleported u can also change it if u want by going
to same folder i saif before but search for (const_me) [Only admins are allowed to see this image]
A bit advanced if you want:
1-you can config it for if you want like (gm's,cm's,gods) can only enter
and if they dont have the required acess item will auto push them and send a cancel msg
Code :
local id = 5579
local place = {x=1000, y=1000, z=7}
function onStepIn(cid, item, position, fromPosition)
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if item.actionid == id and getPlayerGroupId(cid) >= 4 then
doTeleportThing(cid, place)
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid ~= id and getPlayerGroupId(cid) >= 4 then
else
doPlayerSendCancel(cid, "You Don't Have The Required GroupId!")
doMoveCreature(cid, newdir)
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
in this part
Code :
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
u musn't edit any thing it is the thing that push player accordin to their direction
Code :
if item.actionid == id and getPlayerGroupId(cid) >= 4 then
here in the part of getPlayerGroupId >= 4 , <4> refers to
player group u cn see the player groups in xml>groups so if 4=gm then
gm or more higher acess can use the tp . If u want like only gms can
use u change (>= 4) to (== 4) if u want lesser player acess than gm
use you change (>= 4) to (<=4) and also dont forget to change here
if u have changed the group number or the signs
Code :
elseif item.actionid ~= id and getPlayerGroupId(cid) >= 4 then
Code :
doPlayerSendCancel(cid, "You Don't Have The Required GroupId!")
this what will appear to player if he dont have the required stuff always dont forget to add like that "words here"
Code :
doMoveCreature(cid, newdir)
this make is to make players be pushed back when they donat have the required stuff
Code :
doSendMagicEffect(getPlayerPosition(cid), 2)
this to send a puff(it is the white effect that apear when u cant
use this spell or somthng) effect when player is pushed back ,if u want
to change also go to the same folders as up according to ur server
version and search for (const_me) to change magic effect.
For those who want to put more than on eof the same item but ea to tp diffrnt places(instructions inside): [Only admins are allowed to see this image]
Code :
local teleports = {
-- uid = {position={}, level=x, effect=x}
[1000] = { -- this is the item unique id
position = {x= 94, y=123, z=7}, --- th eplace where the item with this unique id will send players to
level = 30, -- make it 1 if you want like all lvs to eneter
effect = 10, -- remove this line to ignore effect
group = 6 -- set to 1 if you want all kinds of player use the tp ( check groups numbers in group.xml)
},
[2000] = {
position = {x= 101, y=123, z=7},
level = 50,
effect = 10,
group = 3
},
}
function onStepIn(cid, item, position, fromPosition)
-- get table with attributes from 'teleports' table by unique id
local options = teleports[item.uid]
if(not options) then -- check if positions exists (this is not really required - just in case you declare something wrong in movements.xml)
return TRUE -- just exit script, it won't continue executing
end
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if(getPlayerLevel(cid) < options.level) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your level is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
if(getPlayerGroupId(cid) < options.group) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your group is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
doTeleportThing(cid, options.position) -- teleport player to dest
if(options.effect) then -- check if effect is specified
doSendMagicEffect(getCreaturePosition(cid), options.effect)
end
return TRUE
end
what if you want to do more tps:
just cope these lines
Code :
[2000] = { ---- change this
position = {x= 1002, y=1001, z=7}, --- and this
level = 50, --and this
effect = 10, -and this
group = 3 --and this
}
now beginig of script will be like this :
Code :
local teleports = {
-- uid = {position={}, level=x, effect=x}
[1000] = { -- this is the item unique id
position = {x= 94, y=123, z=7}, --- th eplace where the item with this unique id will send players to
level = 30, -- make it 1 if you want like all lvs to eneter
effect = 20, -- remove this line to ignore effect
group = 9 -- set to 1 if you want all kinds of player use the tp ( check groups numbers in group.xml)
},
[2000] = {
position = {x= 1002, y=1001, z=7},
level = 50,
effect = 10,
group = 3
}, --- this comma here is the change
[3000] = {
position = {x= 1062, y=1071, z=8},
level = 90,
effect = 12,
group = 4
}
}
*you must add comma at end of each block after the closing bracket },(if there is another block after it) except the last block its end will be like that } .Hope you got it.
*I know that seems like too long for a noob script like that but i
just wanted to explain every thing for you begginers to know what you
are doin so not be confused.
</blockquote>
*simple is up , advanced is down.
Here is a little script for beginners
-my first script (lol):-
*first of all lets add this tiny line to your movment.xml in data-->movement-->movement.xml
Code :
<movevent type="StepIn" itemid="9445" event="script" value="tele.lua"/>
just to let the sevrer know that when u stepon this item it do the stuff the script
in the place where it says itemid="9445" this is the id of the item you need to use as a teleport
then
make a new lua file name it tele.lua (to fast edit and saving files as lua and organizing use notepad++
[Only admins are allowed to see this link]
then add this:
what is in it:
1-you can select whatever item u want to act s a teleporter
Code :
local id = 5578 --this is the action id u need to edit to the item in map editor
local place = {x=1000, y=1000, z=7} --location where player will be tped
function onStepIn(cid, item, position, fromPosition)
if item.actionid == id then
doTeleportThing(cid, place)
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid ~= id then
end
end
Code :
local id = 5578
u change this in the map editor by clicking double click on
whatever item u chose and right the number in the action id field so if u
put other item like that u want to act like a tp it doesnt tp ppl
Code :
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
and this if u want a message (orange one) to be sent to player if
u dont delete this line if u want to change color go to your global
file and search for (message) u will find many types if u dont have
global file got to lib>constant
Code :
doSendMagicEffect(getPlayerPosition(cid), 10)
uyou see the part where , 10) is written this makes a teleport
effect when player is teleported u can also change it if u want by going
to same folder i saif before but search for (const_me) [Only admins are allowed to see this image]
A bit advanced if you want:
1-you can config it for if you want like (gm's,cm's,gods) can only enter
and if they dont have the required acess item will auto push them and send a cancel msg
Code :
local id = 5579
local place = {x=1000, y=1000, z=7}
function onStepIn(cid, item, position, fromPosition)
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if item.actionid == id and getPlayerGroupId(cid) >= 4 then
doTeleportThing(cid, place)
doPlayerSendTextMessage(cid, TALKTYPE_MONSTER_YELL, "You are teleported to temple!")
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid ~= id and getPlayerGroupId(cid) >= 4 then
else
doPlayerSendCancel(cid, "You Don't Have The Required GroupId!")
doMoveCreature(cid, newdir)
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
in this part
Code :
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
u musn't edit any thing it is the thing that push player accordin to their direction
Code :
if item.actionid == id and getPlayerGroupId(cid) >= 4 then
here in the part of getPlayerGroupId >= 4 , <4> refers to
player group u cn see the player groups in xml>groups so if 4=gm then
gm or more higher acess can use the tp . If u want like only gms can
use u change (>= 4) to (== 4) if u want lesser player acess than gm
use you change (>= 4) to (<=4) and also dont forget to change here
if u have changed the group number or the signs
Code :
elseif item.actionid ~= id and getPlayerGroupId(cid) >= 4 then
Code :
doPlayerSendCancel(cid, "You Don't Have The Required GroupId!")
this what will appear to player if he dont have the required stuff always dont forget to add like that "words here"
Code :
doMoveCreature(cid, newdir)
this make is to make players be pushed back when they donat have the required stuff
Code :
doSendMagicEffect(getPlayerPosition(cid), 2)
this to send a puff(it is the white effect that apear when u cant
use this spell or somthng) effect when player is pushed back ,if u want
to change also go to the same folders as up according to ur server
version and search for (const_me) to change magic effect.
For those who want to put more than on eof the same item but ea to tp diffrnt places(instructions inside): [Only admins are allowed to see this image]
Code :
local teleports = {
-- uid = {position={}, level=x, effect=x}
[1000] = { -- this is the item unique id
position = {x= 94, y=123, z=7}, --- th eplace where the item with this unique id will send players to
level = 30, -- make it 1 if you want like all lvs to eneter
effect = 10, -- remove this line to ignore effect
group = 6 -- set to 1 if you want all kinds of player use the tp ( check groups numbers in group.xml)
},
[2000] = {
position = {x= 101, y=123, z=7},
level = 50,
effect = 10,
group = 3
},
}
function onStepIn(cid, item, position, fromPosition)
-- get table with attributes from 'teleports' table by unique id
local options = teleports[item.uid]
if(not options) then -- check if positions exists (this is not really required - just in case you declare something wrong in movements.xml)
return TRUE -- just exit script, it won't continue executing
end
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if(getPlayerLevel(cid) < options.level) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your level is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
if(getPlayerGroupId(cid) < options.group) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your group is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
doTeleportThing(cid, options.position) -- teleport player to dest
if(options.effect) then -- check if effect is specified
doSendMagicEffect(getCreaturePosition(cid), options.effect)
end
return TRUE
end
what if you want to do more tps:
just cope these lines
Code :
[2000] = { ---- change this
position = {x= 1002, y=1001, z=7}, --- and this
level = 50, --and this
effect = 10, -and this
group = 3 --and this
}
now beginig of script will be like this :
Code :
local teleports = {
-- uid = {position={}, level=x, effect=x}
[1000] = { -- this is the item unique id
position = {x= 94, y=123, z=7}, --- th eplace where the item with this unique id will send players to
level = 30, -- make it 1 if you want like all lvs to eneter
effect = 20, -- remove this line to ignore effect
group = 9 -- set to 1 if you want all kinds of player use the tp ( check groups numbers in group.xml)
},
[2000] = {
position = {x= 1002, y=1001, z=7},
level = 50,
effect = 10,
group = 3
}, --- this comma here is the change
[3000] = {
position = {x= 1062, y=1071, z=8},
level = 90,
effect = 12,
group = 4
}
}
*you must add comma at end of each block after the closing bracket },(if there is another block after it) except the last block its end will be like that } .Hope you got it.
*I know that seems like too long for a noob script like that but i
just wanted to explain every thing for you begginers to know what you
are doin so not be confused.
</blockquote>
- Join date : 1970-01-01
Similar topics
» [How to] Make a custom quest
» [G]Make Custom Quests
» [How to] Make a custom quest
» [NPC] How to make it into a quest giver?
» How to make custom game objects.
» [G]Make Custom Quests
» [How to] Make a custom quest
» [NPC] How to make it into a quest giver?
» How to make custom game objects.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Tue Jan 17, 2017 5:58 am by janpara
» SolidWoW BlizzLike 4.0.6-4.3.0 Repack stable UPDATED
Thu Apr 10, 2014 5:39 pm by ycabrerag
» JZY’s Trinity Blizzlike Repack 3.35a (updated)
Sun Dec 01, 2013 8:38 am by Bottscan
» Hello Everyone Well
Thu Jun 27, 2013 12:56 pm by
» ညီမေလး ဖတ္ဖို႔
Thu Jun 13, 2013 6:27 am by