• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua script to auto teleport char to X coords at x lvl

puhefihi

New Member
Joined
Sep 28, 2011
Messages
84
Reaction score
0
hey everyone basicly i need to teleport a character when they hit 55 to coords x32028, y32272, z6.. no matter where they are. Basicly i have my server and rook and your in rook till lvl 50.. BUT i want players to leave by themselves.. but if they dont leave when they hit lvl 55 i want to auto teleport them to those coords.. is it possible ?.

so when it says "congratulation you reached lvl 55" or what ever it says.. you go Pooof and end up at x32028, 32272, z6 :D. Thnx guys will rep of course.
 
Omfg man. D:
I thought I replied but something deleted my post or smth? I don't know.

Anyway .. As far as I see , I'm certain this should work , I'm using a very similar script at my server and it works , I just changed and switched some functions. Make sure that the destination is properly inputted, if you put invalid coordinates or an unwalkable spot, you won't be tp-ed. I'm really not an expert in scripting, but it is rather simple. You could also try putting that return TRUE inside the function with teleport, idk if it will make any difference.
 
darn yeah it says true, no idea why it wont work. :\ hopefully i can get it fixed my server kinda depends on it.. is there a way to make it so a certain area gets no exp after a certain lvl ?. lol or at a certain lvl you get no exp. until you go through X portal then exp gets back to normal.. or i guess at lvl 50 make it so stamina goes to 0. then when u walk through X portal you get stamina again ?!? or something to that .. i basicly dont want people staying in rook after 55... reason being is one no pvping in rook.. LOl and 2 i dont want someone to train there and then bam come to main area start pvping... and stuff like that..
 
I'm not giving up on this, try this one [this goes inside creaturescripts/scripts/teleportlevel.lua]:

Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	local tpPos = {x=32028, y=32272, z=6} -- Where player will be teleported to.

				if getPlayerSkillLevel(cid, 8) == 55 then
				doPlayerSendTextMessage(cid,22,"Congratulations, you reached level 55.") --- Change the message.
				doTeleportThing(cid, tpPos)
				doPlayerSetTown(cid, XXX) --- Change XXX with number ID of the desired town.
				end
	return true
end

Now I think it should work. (Also, I added a new function to change player's residence, since I believe you don't want them dying in main then being transferred to rook again.)
 
[20/10/2011 20:00:09] Lua Script Error: [CreatureScript Interface]
[20/10/2011 20:00:09] data/creaturescripts/scripts/teleportlevel.lua:eek:nAdvance
[20/10/2011 20:00:09] data/creaturescripts/scripts/teleportlevel.lua:4: attempt to call global 'getPlayerSkillLevel' (a nil value)
[20/10/2011 20:00:09] stack traceback:
[20/10/2011 20:00:09] [C]: in function 'getPlayerSkillLevel'
[20/10/2011 20:00:09] data/creaturescripts/scripts/teleportlevel.lua:4: in function <data/creaturescripts/scripts/teleportlevel.lua:1>

got that error. when i hit 55
 
oh i dont need to go through the town id because i changed it so when u go through a portal it makes you home town say thais... just need to teleport at 55 to those co ords.
 
what if he got uber rare loot exactly on advance or lets say he got his advance while killing a demon in poi, inq, anni or whatever? :D

ALL YOU NOOBS WITHOUT BRAINS SHOULD RETIRE MWAHAHHAAHA
 
what if he got uber rare loot exactly on advance or lets say he got his advance while killing a demon in poi, inq, anni or whatever? :D

ALL YOU NOOBS WITHOUT BRAINS SHOULD RETIRE MWAHAHHAAHA

hey idiot. stop flamming.. read the post..... ROOK........ ROOK..... maybe he should have left willingly at lvl 50 instead of staying till 55 ?.

if he does.. to bad for him... its 1 item.... and not amazingly good item on my rook... please dont bother putting you 2 sense in, how about you help me fix my problem.. :D. instea dof worrying about problems with it and calling people noobs
 
Colandus is right :p
try this one
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	local cfg = {
		p_level = 55,
		p_pos = {x = 32028, y = 32272, z = 6},
		p_time = 10, --time in second ,make it less then battle time
		p_msg = "congratulation you reached lvl 55, you will be teleported to ~",
		p_storage = 999
	}
function teleport(cid)
	doTeleportThing(cid, cfg.p_pos)	
end
if getPlayerStorageValue(cid, cfg.p_storage) < 1 then
	if (skill == 8 and getPlayerLevel(cid) >= cfg.p_level) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "".. cfg.p_msg .."")
			addEvent(teleport, cfg.p_time * 1000, cid)
	end
end
return true
end
 
Colandus is right :p
try this one
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	local cfg = {
		p_level = 55,
		p_pos = {x = 32028, y = 32272, z = 6},
		p_time = 10, --time in second ,make it less then battle time
		p_msg = "congratulation you reached lvl 55, you will be teleported to ~",
		p_storage = 999
	}
function teleport(cid)
	doTeleportThing(cid, cfg.p_pos)	
end
if getPlayerStorageValue(cid, cfg.p_storage) < 1 then
	if (skill == 8 and getPlayerLevel(cid) >= cfg.p_level) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "".. cfg.p_msg .."")
			addEvent(teleport, cfg.p_time * 1000, cid)
	end
end
return true
end
[/QUOTE

Lol You Da Man.. And i guess and Ty for adding in a little after for "looting" make nubs happy. Lol.. Works like A Dream.. Ty everyone for the help and opinions <3 (colandus).

For those who have same problem use Spider Ot Script and follow what cucurbito says to do. :d
 
Lua:
local t = {
	level = 50,
	storage = 12345,
	new = {x = 100, y = 100, z = 7} -- Where they are teleported.
}

function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL then
		if newLevel >= t.level then
			local players = {}
			for i = 1, 15 do
				local pos = {
					from = {x = 100, y = 100, z = i}, -- Top left corner of rookgaard.
					to = {x = 100, y = 100, z = i} -- Bottom right corner of rookgaard.
				}
				if isInRange(getCreaturePosition(cid), pos.from, pos.to) then
					table.insert(players, cid)
				end
			end
			if #players > 0 then
				for _, pid in ipairs(players) do
					if getCreatureStorage(pid, t.storage) < 0 then
						doTeleportThing(pid, t.new, false)
						doSetCreatureStorage(pid, t.storage, 1)
					end
				end
			end
		end
	end
	
	return true
end
 
so idiot me.. only tested the script at lvl 55 worked... but what i didnt do was etst at every lvl above lvl 55..... it tps YOu At every lvl above 55 help plx.
 
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
local tpPos = {x=????, y=????, z=?} -- Enter your desired coordinates here.

if(skill == SKILL__LEVEL and newLevel >= 55 and oldLevel <= 55)then
doTeleportThing(cid, tpPos, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations.") -- Edit this message however you want.
end
return true
end

This should work ^.- slightly edit of Shiva's script ;P
 
thnx milice although it didnt work.. didnt tp me at all.. Lol. and tibiawr wont work, because there premy island that are not able to be in the co ords.
 
Back
Top