• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lever and 2 places

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello
I want simple script:

ogien2.png


Red - postion of items id: 4356
Blue - the lever

And I want something like this:
If you put on two places the left one and right one the 2x itemid: 4356 (on left - 2 and on right - 2 items of id 4356) and use Lever, the monster will be summoned on X,Y,Z

And you get 5% chance to get an item.
You can repeat that if you got correct item on corret places :)

Thanks if done.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lpos = {x=1072, y=1009, z=7} ---- pos of the left item
local rpos = {x=1074, y=1009, z=7} --- pos of the right item,
local mon = {x=1074, y=1013, z=7} --- pos of the summoning monster
local saken = 2160 ---- the item id of the item what will be sacraficed.
local mname = "Demon" --- the name of monster
if item.itemid == 1945 and (doRemoveItem(getTileItemById(rpos, saken).uid) == TRUE) and (doRemoveItem(getTileItemById(lpos, saken).uid) == TRUE) then
doSummonCreature(mname, mon)
doPlayerSendTextMessage(cid,21,"You sacraficed your two items and summoned an ".. mname .."!")
doTransformItem(item.uid, item.itemid + 1)
elseif item.itemid == 1946 then
doPlayerSendTextMessage(cid,21,"Pull back the lever in order to make it work!")
doTransformItem(item.uid, item.itemid - 1)
elseif item.itemid == 1945 and (doRemoveItem(getTileItemById(rpos, saken).uid) == FALSE) and (doRemoveItem(getTileItemById(lpos, saken).uid) == FALSE) then
doPlayerSendCancel(cid,"Put the right items in the right spots!")
end
return TRUE
end

rep + if it works
 
Last edited:
Cyko u can make 2 versions (it can be useful for me) - spawn normally next monster and not spawn (send message)

BTW. check your Inbox, cyko.
 
LUA:
local left = {x=1072, y=1009, z=7, stackpos=1}
local right = {x=1074, y=1009, z=7, stackpos=1}

local summon = {x=1074, y=1013, z=7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(left)
		if a.itemid == 4356 and a.type >= 2 then
			local b = getThingfromPos(right)
			if b.itemid == 4356 and b.type >= 2 then
				doRemoveItem(a.uid, 2)
				doRemoveItem(b.uid, 2)
				doCreateMonster('Demon', summon)
				doSendMagicEffect(summon, CONST_ME_ENERGYAREA)
				doCreatureSay(cid, 'You sacrificed your two items and summoned a Demon!')
				return doTransformItem(item.uid, 1946)
			end
		end
		return doPlayerSendCancel(cid,"Put the right items in the right spots!")
	end
	return doTransformItem(item.uid, 1945)
end
for the other version, getStorage&setStorage or getCreatureByName (if it's an unique creature) should be used
 
Back
Top