• 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 pickaxe on floor tile, changes the tile

heley

New Member
Joined
Mar 14, 2011
Messages
96
Reaction score
1
Hi im in need of a simple script, when you use an item on a floor tile, it changes the floor tile and outputs a message to the player, and then after 5 mins the tile changes back again to the tile there previously. This can be done as many times as the player wishes, but only on the tiles with the same actionid.

Many thanks.
 
Last edited:
Sorry, but i having trouble on recreate the item with actionid :/ So dont use this script until i figure out away to recreate item with actionid or someone else does it.

Go to actions/actions.xml and paste this line:
XML:
<action itemid="2400" event="script" value="pick.lua" allowfaruse="1" blockwalls="1"/>

Now in actions/scripts create new lua and name it "pick" and paste the code below:
Lua:
local Cyko = {
	actionid = 9999, --Actionid of the floors
	newflooritemid = 100, --New floor id
	transformback_itemid = 101, --Old floor id
	transformback_time = 300 -- 60 seconds -- 1 min
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local pos = getThingPos(itemEx.uid)
	if itemEx.actionid == Cyko.actionid then
		doRemoveItem(itemEx.uid,1)
		doItemSetAttribute(doCreateItem(Cyko.newflooritemid,1,toPosition), "aid", Cyko.actionid)
		doSendMagicEffect(toPosition, 1, CONST_ME_BLOCKHIT)
		addEvent(doCreateItem, Cyko.transformback_time * 1000, Cyko.transformback_itemid,1, pos)
                doPlayerSendTextMessage(cid,27, "You have successfully, transformed a tile")
	else
		doPlayerSendCancel(cid, "Sorry, but you can only use this axe, on speical ground tiles.")
		end
	return true
end
 
Last edited:
Ty :p, but i reli need it re add the action id, other wise the person wont be able to do it again. So if anyone can fix it :p REP++
 
Lua:
local config = {
	actionid = 3012,
	oldid = 100,
	newid = 200,
	time = 300
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

	local function onChangeBack()
		local thing = getThingfromPos(toPosition)
		doTransformItem(thing.uid, config.oldid)
	end

	if itemEx.actionid == config.actionid and itemEx.itemid == config.oldid then
		doTransformItem(itemEx.uid, config.newid)
    		addEvent(onChangeBack,config.time*1000)
                return true
	end
	return false
end

Or remove the function onUse, the return false and the end if you want to add it to an other file (pick.lua). Be sure you keep the end and return false of that script at the end then.
Lua:
local config = {
	actionid = 3012,
	oldid = 100,
	newid = 200,
	time = 300
}

	local function onChangeBack()
		local thing = getThingfromPos(toPosition)
		doTransformItem(thing.uid, config.oldid)
	end

	if itemEx.actionid == config.actionid and itemEx.itemid == config.oldid then
		doTransformItem(itemEx.uid, config.newid)
    		addEvent(onChangeBack,config.time*1000)
                return true
	end
 
Last edited:
Back
Top