• 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!

Teleport item (other) need full script.

DVEagle

New Member
Joined
Aug 29, 2009
Messages
95
Reaction score
3
Location
PoLand
Hello i need TP item but not the same as i saw similiar here like tp scroll book.
I can't write scripts and i don't have similiar one on my pc to edit so i made this request and wrote in title 'full script'.
What i want? Example:
Item id 2125 on use teleports me to x:6 y:6 z:6 if im standing in Protection Zone (thats the new thing ;d), but it takes 5 seconds to tp done and from using the item to tp done there is 'CONST_ME_BIGCLOUDS' <- effect on player and it obviously disappears after tp. (that's new too).

I would be very grateful if anyone would be able to write this script for me and other users.
If part with PZone is hard to do please paste your script without it (or without big clouds.. or even without tp .. ;D).

K that's all i'm waiting for generous scripter :D.
 
Try, I don't test.
Lua:
local t = {
	newPos = {x = 1000, y = 1000, z = 7},
	castTime = 5, -- in sec
	effectWhileCasting = CONST_ME_BIGCLOUDS
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
	local countdownEvent = {}
	local pos = getCreaturePosition(cid)
 
	if(getTileInfo(pos).protection) then
		if(countdownEvent[cid] == nil or countdownEvent[cid] == 0) then
			function finalCountdown(cid, countLeft, playerPos)
				if(countLeft == 0) then
					if(isPlayer(cid)) then
						doTeleportThing(cid, t.newPos)
						doSendMagicEffect(t.newPos, CONST_ME_TELEPORT)
						doSendMagicEffect(pos, CONST_ME_POFF)
					end
 
					countdownEvent[cid] = 0
					return
				end
 
				local tmpPos = getCreaturePosition(cid)
				if((tmpPos.x == playerPos.x) and (tmpPos.y == playerPos.y)) then
					doSendAnimatedText(playerPos, 'Cast: '.. countLeft ..'', 11)
					doSendMagicEffect(playerPos, t.effectWhileCasting)
					local eventId = addEvent(finalCountdown, 1000, cid, countLeft - 1, playerPos)
					countdownEvent[cid] = eventId
				else
					doSendAnimatedText(getCreaturePosition(cid), 'Cancelled', TEXTCOLOR_RED)
					doPlayerSendCancel(cid, 'You moved. You have stopped casting.')
					countdownEvent[cid] = 0
				end
			end
 
			local eventId = addEvent(finalCountdown, 0, cid, t.castTime, getCreaturePosition(cid))
			countdownEvent[cid] = eventId
		else
			doPlayerSendCancel(cid, 'You are already teleporting!!')
			return true
		end
	else
		doPlayerSendCancel(cid, 'You are not in protection zone.')
	end
	return true
end

XML:
<action itemid="ITEMID" event="script" value="NAME.lua"/>
 
Last edited:
Still some errors, maybe i have to update some libraries in my ot?

Code:
[30/12/2010 21:56:12] [Error - Action Interface] 
[30/12/2010 21:56:12] data/actions/scripts/pandemoniumtp.lua:onUse
[30/12/2010 21:56:12] Description: 
[30/12/2010 21:56:12] data/actions/scripts/pandemoniumtp.lua:10: attempt to index global 'countdownEvent' (a nil value)
[30/12/2010 21:56:12] stack traceback:
[30/12/2010 21:56:12] 	data/actions/scripts/pandemoniumtp.lua:10: in function <data/actions/scripts/pandemoniumtp.lua:7>
 
Thanks VirrageS, it works better than i expected ! :* You are my boss bro. This can be very useful for others too.
castbz.jpg

You must spread some Reputation around before giving it to VirrageS again.
I gave you rep earlier on this topic xd.
 
Last edited:
Back
Top