• 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 player when using pick?

Status
Not open for further replies.

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
I'm trying to make an script that, when the player uses pick in an item, he get teleported to somewhere else, but I have no idea how can I set it to the script runs based on the pick use, u know? just know how to do it by "use" <_<

what code should I use to the script be activated with pick use, and not "Use" u know? *-*

thanks :thumbup:
 
Add this to your pick.lua.

Code:
	if itemEx.actionid == [COLOR="red"]XXXX[/COLOR] then -- ACTION ID OF THE GROUND
		local new = {x = 100, y = 100, z = 7}
		doTeleportThing(cid, new, true)
		doSendMagicEffect(new, CONST_ME_TELEPORT)
	end
 
LUA:
function onUse(cid, pos, topos)
if item.itemid == 2553 then
	if item2.actionid == uni/aID then
	destination = {x=666, y=666, z=6}
	doteleportthing(cid, destination)
	doSendMagicEffect(destination, 10)
	end
end
end

"uni/aID" = the action or unique ID of the item that you want the player to use the pick on to be teleported.

Ps, you better give rep or I rap.. e.. you..

Ps2, if you have no idea how to insert this script to your own pick script, then either PM me your script or post it here and I make it for you.
 
lol

thanks for answers, I'll try the script and close the topic for now to avoid problems, then I'll open and say if it works :]

thanks again
 
Hmm, can't make it work

Don't know if I'm doing something wrong, take a look:

with the code JDB posted, my pick.lua got like this:

LUA:
local items = {
	[2146] = {
		1285, 1357, 3608, 3632, 3666, 6999, 7003
	},
	[2147] = {
		1290, 1358, 3609, 3633, 3667, 7000
	},
	[2149] = {
		1335, 1359, 3615,3534, 3668, 7001
	},
	[2150] = {
		1356, 3607, 3616, 3635, 3670, 7002
	}
}
 
function onUse(cid, item, frompos, item2, topos)
	if math.random(1, 20) > 15 then
		for item, itemList in pairs(items) do
			if isInArray(itemList, item2.itemid) == TRUE then
				doSendMagicEffect(topos,34)
				doTransformItem(item2.uid,4997)
				doPlayerAddItem(cid, item, 1)
				doDecayItem(item2.uid)
				return 1
			end
					if itemEx.uniqueid == 60001 then -- ACTION ID OF THE GROUND
		local new = {x=328, y=772, z=10}
		doTeleportThing(cid, new, true)
		doSendMagicEffect(new, CONST_ME_TELEPORT)
	end
	end
	else
		doSendMagicEffect(topos,2)
	end
	return 1
end

And with RealSoft's:

actions/scripts/cracks.lua

LUA:
function onUse(cid, pos, topos)
if item.itemid == 2553 then
	if item2.uniqueid == 60001 then
	destination = {x=328, y=772, z=10}
	doteleportthing(cid, destination)
	doSendMagicEffect(destination, 10)
	end
end
end

Added <action uniqueid="60001" event="script" value="quests/cracks.lua"/> at actions.xml

both didn't work

Did I do something wrong?

ps: in both it simply don't work, act like I didn't add those lines, just smoke appears
 
Last edited:
try that if not work then try uid instead of uniqueid.
LUA:
local items = {
	[2146] = {
		1285, 1357, 3608, 3632, 3666, 6999, 7003
	},
	[2147] = {
		1290, 1358, 3609, 3633, 3667, 7000
	},
	[2149] = {
		1335, 1359, 3615,3534, 3668, 7001
	},
	[2150] = {
		1356, 3607, 3616, 3635, 3670, 7002
	}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uniqueid == 60001 then -- ACTION ID OF THE GROUND
		local new = {x=328, y=772, z=10}
		doTeleportThing(cid, new, true)
		doSendMagicEffect(new, CONST_ME_TELEPORT)
	end
	if math.random(1, 20) > 15 then
		for item, itemList in pairs(items) do
			if isInArray(itemList, itemEx.itemid) == TRUE then
				doSendMagicEffect(topos,34)
				doTransformItem(itemEx.uid,4997)
				doPlayerAddItem(cid, item, 1)
				doDecayItem(itemEx.uid)
				return 1
			end
 
		end
	else
		doSendMagicEffect(topos,2)
	end
	return 1
end




Dont add anything in action.xml
 
Last edited:
Status
Not open for further replies.
Back
Top