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

Use pick on uID => createTeleport => if someone enter then remove TP

Michaeel

New Member
Joined
Mar 6, 2009
Messages
272
Reaction score
1
Hi, I need script which makes TP (with destination of course) when someone use pick on item with unique/action ID. also if someone enter to this tp then remove teleport
id of pick - 2253
thanks
(I'll rep of course)
 
Hmm little change.
If someone use pick(id 2253) on item with unique/action ID then create teleport in position x: ~~, y:~~, z~~ (with destination). after one minute teleport should disappear and only one person can enter to TP per 1 minute.
thanks
 
Or other way: pick can be used only one time per 1minute on ithem with unique ID.. but this script has to remove teleport when someone enter
 
OK.I haven't tested it but Think it should work for creating your teleport. The removal it would probably have to be a movement script.

data/actions/scripts/tools/pick.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		return true
	end

	if(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		return true
	end
	
	local _uid = 1200
	local _time = 1 -- time the portal stays open in minutes
	local _to = { x = 1110, y = 503, z = 6 }, -- Where Teleport Goes
	local _tp = { x = 1096, y = 516, z = 3, stackpos=2} -- Where Teleport Creates
	
	local function deleteTeleport()
		local teleport = getTileItemById(_tp, 1387)
		if(teleport.uid > 0) then
			doRemoveItem(teleport.uid)
			doSendMagicEffect(_tp, CONST_ME_POFF)
			doSendAnimatedText(_tp, "Closed", TEXTCOLOR_RED)
		end
		return true
	end
	
	if itemEx.uid == _uid then
		doCreateTeleport(1387, _to, _tp)
		addEvent(deleteTeleport, _time * 1000 * 60)
		doCreatureSay(cid, "You have " .. _time .. " minutes to enter the portal!", TALKTYPE_ORANGE_1)
	end

	return false
end
 
Error:
pick31.png

Code:
17-20 lines:
    local _to = { x = 32368, y = 32220, z = 7 }, -- Where Teleport Goes
    local _tp = { x = 32371, y = 32215, z = 7, stackpos=2 } -- Where Teleport Creates
    
    local function deleteTeleport()

Thanks anyway.
whats wrong?
 
PHP:
	local _uid = 1200
	local _time = 1 -- time the portal stays open in minutes
	local _to = { x = 1110, y = 503, z = 6 }, -- Where Teleport Goes
	local _tp = { x = 1096, y = 516, z = 3, stackpos=2} -- Where Teleport Creates

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		return true
	end

	if(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		return true
	end
	
	local function deleteTeleport()
		local teleport = getTileItemById(_tp, 1387)
		if(teleport.uid > 0) then
			doRemoveItem(teleport.uid)
			doSendMagicEffect(_tp, CONST_ME_POFF)
			doSendAnimatedText(_tp, "Closed", TEXTCOLOR_RED)
		end
		return true
	end
	
	if itemEx.uid == _uid then
		doCreateTeleport(1387, _to, _tp)
		addEvent(deleteTeleport, _time * 1000 * 60)
		doCreatureSay(cid, "You have " .. _time .. " minutes to enter the portal!", TALKTYPE_ORANGE_1)
	end

	return false
end

Well it makes teleport when I use pick, but everyone can enter :(
I need script like that:
if someone enter to TP then remove teleport, set exhaus on item with unique ID - pick can be used only one time per 3 minutes
or create teleport but only one person can enter per 3 minutes
thanks
 
Last edited:
it should be global exhaust for creating teleport
and only one person should be able to enter teleport (so when someone enter to TP then script should remove teleport)
thanks
 
So is it possible to do script.. hmm... only one person can enter per 3 minutes ?
It is used in arena script but i do not understand...
Code:
if getPlayerStorageValue(cid, arena_room+getPlayerStorageValue(cid, 42355)*10-1) == 1 or arena_room+getPlayerStorageValue(cid, 42355)*10-1 == 42299 then
        if getGlobalStorageValue(cid, arena_room) == 0 then
            local monster_uid = getGlobalStorageValue(arena_room+100)
            if monster_uid > 0 then
                if isCreature(monster_uid) == TRUE then
                    doRemoveCreature(monster_uid)
                end
            end
            local spawn_pos = getThingPos(arena_room)
            local monster = doCreateMonster(arena_monsters[arena_room+getPlayerStorageValue(cid, 42355)*10], {x=spawn_pos.x-1,y=spawn_pos.y-1,z=spawn_pos.z})
            setGlobalStorageValue(arena_room+100, monster)
            doTeleportThing(cid, spawn_pos, TRUE)
            setGlobalStorageValue(arena_room, cid)
            setGlobalStorageValue(arena_room-1, 0)
            setPlayerStorageValue(cid, 42350, os.time()+arena_room_max_time)
        else
            doTeleportThing(cid, fromPosition, TRUE)
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(getGlobalStorageValue(cid, arena_room))..' is now in next room. Wait a moment and try again.')
 
Don't make simple things complicated and just use a simple script.
(modify)
Code:
doItemSetAttribute(doCreateTeleport(1387, _to, _tp), "aid", 10000)
Code:
	<movevent type="StepIn" actionid="10000" event="script" value="remove.lua"/>
Code:
function onStepIn(cid, item, position, fromPosition)
	doRemoveItem(item.uid)
end
 
It is my tools/pick.lua file:
Code:
    local _uid = 15479
    local _time = 1 -- time the portal stays open in minutes
    local _to = { x = 333, y = 921, z = 15 } -- Where Teleport Goes
    local _tp = { x = 314, y = 810, z = 15, stackpos=2 } -- Where Teleport Creates


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
        doTransformItem(itemEx.uid, 392)
        doDecayItem(itemEx.uid)
        doSendMagicEffect(toPosition, CONST_ME_POFF)
        return true
    end

    if(itemEx.itemid == 7200) then
        doTransformItem(itemEx.uid, 7236)
        doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
        return true
    end
    
    local function deleteTeleport()
        local teleport = getTileItemById(_tp, 1387)
        if(teleport.uid > 0) then
            doRemoveItem(teleport.uid)
            doSendMagicEffect(_tp, CONST_ME_POFF)
        end
        return true
    end
    
    if itemEx.uid == _uid then
		doItemSetAttribute(doCreateTeleport(1387, _to, _tp), "aid", 31249)
        addEvent(deleteTeleport, _time * 1000 * 60)
        doCreatureSay(cid, "You have " .. _time .. " minutes to enter the portal!", TALKTYPE_ORANGE_1)
    end

    return false
end

I have added remove.lua do movements also and now when i use pick in item with unique ID it makes teleport but when try enter there then teleport disappear and don't teleport me to destination :(
 
Code:
local t = {
	uid = 15479, -- uniqueid of the special tile
	time = 1, -- time the portal stays open in minutes
	createPos = {x=314, y=810, z=15}, -- Where Teleport Creates
	exhaustStorage = 10000,
	exhaustDuration = 3 * 60 -- in seconds
}
local function deleteTeleport()
	local v = getTileItemById(t.createPos, 1387).uid
	return v > 0 and doRemoveItem(v) and doSendMagicEffect(t.createPos, CONST_ME_POFF)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
	elseif(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_HITAREA)
	elseif itemEx.uid == t.uid then
		if os.time() - getGlobalStorageValue(t.exhaustStorage) >= t.exhaustDuration then
			doItemSetAttribute(doCreateItem(1387, 1, t.createPos), "aid", 31249)
			addEvent(deleteTeleport, t.time * 60000)
			doCreatureSay(cid, "You have " .. t.time .. " minute".. (t.time ~= 1 and "s" or "") .." to enter the portal!", TALKTYPE_ORANGE_1)
			setGlobalStorageValue(t.exhaustStorage, os.time())
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is not time yet.")
		end
	else
		return false
	end

	return true
end
Code:
local destination = {x=333, y=921, z=15} -- Where Teleport Goes
function onStepIn(cid, item, position, fromPosition)
	doTeleportThing(cid, destination)
	doSendMagicEffect(destination, CONST_ME_TELEPORT)
	doRemoveItem(item.uid)
end
 
Last edited:
AWESOME!! IT WORKS! I gave you many rep points and can't give more, sorry :(

(i had to remove cedilla
Code:
local destination = {x=333, y=921, z=15}[COLOR="Red"][B],[/B][/COLOR]
and repair this
Code:
doSendMagicEffect(de[COLOR="Red"][B]si[/B][/COLOR]nation

and it works :) thanks so much!
 
Back
Top