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

[Action] Change item to item count with LEVER

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hi all!
I got request!

It's possible to make change item to item count ?
I mean:

ID: 2500
ID: 2540
ID: 2537

Can change to: [RANDOM] 1-2 (1 or 2) ID: 6541

44887344096222879944.png


BLUE:
Position of changed 1 or 2 ID: 6541

RED:
Position to keep items (ID: 2500;2540;2537)

WHITE:
Lever who changing ID: 2500;2540;2537 to 1-2x ID: 6541


Rep++
:(
 
Code:
local t = {
	pos = {
		{x = 100, y = 100, z = 7}, -- red pos
		{x = 100, y = 100, z = 7} -- blue pos
	},
	items = {2500, 2540, 2537},
	create = 6541,
	countmax = 2
}		
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1946 then return doTransformItem(item.uid, 1945) end
	local k = nil
	for _, v in ipairs(t.items) do
		local get = getTileItemById(t.pos[1], v).uid
		if get > 0 then
			k = get
			break
		end
	end
	if k then
		doRemoveItem(k)
		doCreateItem(t.create, math.random(t.countmax), t.pos[2])
		doSendMagicEffect(t.pos[1], CONST_ME_MAGIC_RED)
		doSendMagicEffect(t.pos[2], CONST_ME_MAGIC_GREEN)
	end
	return k and doTransformItem(item.uid, 1946) or doPlayerSendCancel(cid, "Item not found.")
end
 
doSendMagicEffect(t.pos[1], CONST_ME_MAGIC_RED)
doSendMagicEffect(t.pos[2], CONST_ME_MAGIC_GREEN)

In that part, how you can send a distanceshoteffetc? to the pos2? please help me :)
 
doSendMagicEffect(t.pos[1], CONST_ME_MAGIC_RED)
doSendMagicEffect(t.pos[2], CONST_ME_MAGIC_GREEN)

In that part, how you can send a distanceshoteffetc? to the pos2? please help me :)
Code:
doSendDistanceShoot(fromPos, toPos, type[, player])
Example:
Code:
doSendDistanceShoot(t.pos[1], t.pos[2], CONST_ANI_ENERGY)
 
Back
Top