• 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 StackPos - doRemoveItem ~ doAddItem

Gabriel Tibiano

New Member
Joined
Nov 21, 2009
Messages
420
Reaction score
4


I'm created this script but i've tested with all StackPos possible...
but the "crucible[10041]", dont remove :|
PS: under the Crucible has nothing only the ground tile.


Any idea? another function?
how can i fix that?

LUA:
local words = {
[1] = {x=117, y=36, z=8},
[2] = {x=114, y=38, z=8},
[3] = {x=114, y=39, z=8},
}
function onUse(cid, item, fromPosition, itemEx, toPosition, position)
local t = words[math.random(1,3)]
	if(item.uid == 53241) and getTopCreature({x=117, y=37, z=6}).uid >= 1 then
		doTeleportThing(getTopCreature({x=117, y=37, z=6}).uid, {x = 116, y = 39, z = 8})
		doSendMagicEffect(getCreaturePosition(cid),11)
			doSendMagicEffect(fromPosition, CONST_ME_POFF)
				doSendMagicEffect({x = 116, y = 38, z = 6}, 67)
			doSendMagicEffect({x = 115, y = 37, z = 8}, 47)
        doSendMagicEffect({x=113, y=38, z=8}, CONST_ME_SMOKE)
			doSendDistanceShoot({x=115, y=39, z=8}, {x=115, y=37, z=8}, 4)
				doRemoveItem(getTileThingByPos({x=117, y=37, z=8, stackpos=0}).uid, 1)
			doCreateItem(10042, 1, {x=117, y=37, z=8})
		addEvent(doChangeBack, 5 * 1000)
	doSendAnimatedText(t, "Criinkchiii!", 193)
		doRemoveItem(getTileThingByPos({x=117, y=38, z=8, stackpos=1}).uid, 1)
			doCreateItem(10039, 1, {x=117, y=38, z=8})
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		doSendMagicEffect(getCreaturePosition(cid),2)
	end

	if (item.uid == 53243) and getTopCreature({x=116,y=39,z=8}).uid >= 1 then
	doTeleportThing(getTopCreature({x=116,y=39,z=8}).uid, {x = 117, y = 37, z = 6})
			doSendMagicEffect(getCreaturePosition(cid),9)
				doSendMagicEffect(fromPosition, CONST_ME_POFF)
			doSendMagicEffect({x = 115, y = 37, z = 8}, 48)
		doSendMagicEffect({x = 115, y = 37, z = 8}, 47)
	doRemoveItem(getTileThingByPos({x=117, y=36, z=6, stackpos=0}).uid, 1)
		doCreateItem(10042, 1, {x=117, y=36, z=6})
	addEvent(doChangeFrom, 6 * 1000)
	doSendMagicEffect({x=117, y=36, z=6}, 5)
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		doSendMagicEffect(getCreaturePosition(cid),2)
	end

	return TRUE
end


function doChangeBack()
local t = words[math.random(1,3)]
local machinePos = {x=117, y=37, z=8, stackpos=1} -- Position of Machine
local machine = getTileItemById(machinePos, 10042)
    if machine.uid > 0 then
		doRemoveItem(machine.uid, 1)
			doCreateItem(10041, 1, machinePos)
				doSendMagicEffect(machinePos, CONST_ME_SMOKE)
        doSendMagicEffect({x = 115, y = 37, z = 8}, 48)
			doSendMagicEffect({x=113, y=38, z=8}, CONST_ME_SMOKE)
	doSendAnimatedText(t, "Craachink!", 193)
		doRemoveItem(getTileThingByPos({x=117, y=38, z=8, stackpos=1}).uid, 1)
			doCreateItem(10040, 1, {x=117, y=38, z=8})
	end
end


function doChangeFrom()
local machinePos = {x=117, y=36, z=6, stackpos=0} -- Position of Machine
local machine = getTileItemById(machinePos, 10042)
    if machine.uid > 0 then
		doRemoveItem(machine.uid, 1)
			doCreateItem(10041, 1, machinePos)
				doSendMagicEffect(machinePos, CONST_ME_SMOKE)
	doSendMagicEffect({x=115, y=38, z=6}, CONST_ME_POFF)
	end
end

bugcn.png
 
Last edited:
Back
Top