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

Solved Acient Helmet

Natan Beckman

Well-Known Member
Joined
Aug 1, 2010
Messages
548
Reaction score
54
Location
Teresina-PI/Br
please my script not works.

HTML:
        <movevent type="StepIn" uniqueid="47512" event="script" value="ancienthelmo.lua"/>

LUA:
local pos = {x=33198, y=32876, z=11, stackpos=2} 
local pieces = {2354, 2348, 2350, 2352, 2349, 2353, 2351}
function onStepIn(cid, item, position) 
    if isPlayer(cid) == TRUE then 
        local it = {} 
        for i = 1,#pieces do 
            local items = getTileItemById(pos, pieces[i]).uid 
            if items > 0 then
				table.insert(it,items)
			end
        end 
		if #it < #pieces then
			doPlayerSendCancel(cid,"Seem you dont have the two pieces.")
			it = {}
		else
			for _, v in ipairs(it) do		
				doRemoveItem(v) 
			end 
			doCreateItem(2342, 1, pos) 
			doSendMagicEffect(pos, CONST_ME_FIREAREA) 
			it={}
		end
	end
return true
end

Help rep++
 
Last edited:
I'm using this.
Remember: You can simplify this script.
LUA:
function onStepIn(cid, item, pos)

queststatus = getPlayerStorageValue(cid,2341)
if queststatus == -1 then

if (getPlayerItemCount(cid, 2335) >= 1) and
   (getPlayerItemCount(cid, 2336) >= 1) and
   (getPlayerItemCount(cid, 2337) >= 1) and
   (getPlayerItemCount(cid, 2338) >= 1) and
   (getPlayerItemCount(cid, 2339) >= 1) and
   (getPlayerItemCount(cid, 2340) >= 1) and
   (getPlayerItemCount(cid, 2341) >= 1) then

 doPlayerRemoveItem(cid, 2335, 1)
 doPlayerRemoveItem(cid, 2336, 1)
 doPlayerRemoveItem(cid, 2337, 1)
 doPlayerRemoveItem(cid, 2338, 1)
 doPlayerRemoveItem(cid, 2339, 1)
 doPlayerRemoveItem(cid, 2340, 1)
 doPlayerRemoveItem(cid, 2341, 1)

doPlayerAddItem(cid,2342,1)
setPlayerStorageValue(cid,2341,1)
doSendMagicEffect({x=33198, y=32876, z=11}, 6)

 else
				doPlayerSendCancel(cid,"You do not have all necessary items.")
			end
		else
			doPlayerSendCancel(cid,"You already done this quest.")
		end
return 1
end

Nathan, I don't think you remember me. I was hosting Gameria. PVT me with your msn if possible.
 
Try this...

ancienthelmet.lua:
LUA:
local pos = {x = 33198, y = 32876, z = 11, stackpos = STACKPOS_TOP_CREATURE}
local pieces = {2354, 2348, 2350, 2352, 2349, 2353, 2351}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(isPlayer(cid)) then
		local thing = {}
		for i = 1, #pieces do
			local items = getTileItemById(pos, pieces[i])
			if(items.uid > 0) then
				table.insert(thing, items.itemid)
			end
		end

		if(#thing < #pieces) then
			doPlayerSendCancel(cid, "It seems you do not have the two required pieces.")
			thing = {}
		elseif(#thing == #pieces) then
			for i = 1, #pieces do
				doRemoveItem(pieces[i].uid, 1)
			end

			doCreateItem(2342, 1, pos)
			doSendMagicEffect(pos, CONST_ME_FIREAREA)
			thing = {}
		end
	end

	return true
end
 
LUA:
function onAddItem(moveItem, tileItem, position)
	if moveItem.itemid >= 2335 and moveItem.itemid <= 2341 then
		local t = {}
		for i = 2335, 2341 do
			if moveItem.itemid ~= i then
				local v = getTileItemById(position, i).uid
				if v == 0 then
					return
				end
				table.insert(t, v)
			end
		end
		doRemoveItem(moveItem.uid)
		for i = 1, #t do
			doRemoveItem(t[i])
		end
		doCreateItem(2342, 1, position)
		doSendMagicEffect(position, CONST_ME_FIREAREA)
	end
end
XML:
<movevent type="AddItem" tileitem="1" uniqueid="47512" event="script" value="ancienthelmo.lua"/>
& unique id goes on the altar, not on ground tile where player can step in
 
I'll be replacing Cykotitan by the next month since Cykotitan finished taking LUA/PHP lessons by me and I told Cykotitan to take a break off for a while.


Kind Regards, Kanakashy
 
How to properly replace Cyko:
  1. Put a mudkip as your signature
  2. Read "How to troll hard for Dummies"
  3. Spam threads with noobity and stuff
  4. ????
  5. PROFIT!

@OP: Any errors in console?
 
Can someone simplify or make this script better?
LUA:
function onStepIn(cid, item, pos)

queststatus = getPlayerStorageValue(cid,2341)
if queststatus == -1 then

if (getPlayerItemCount(cid, 2335) >= 1) and
   (getPlayerItemCount(cid, 2336) >= 1) and
   (getPlayerItemCount(cid, 2337) >= 1) and
   (getPlayerItemCount(cid, 2338) >= 1) and
   (getPlayerItemCount(cid, 2339) >= 1) and
   (getPlayerItemCount(cid, 2340) >= 1) and
   (getPlayerItemCount(cid, 2341) >= 1) then

 doPlayerRemoveItem(cid, 2335, 1)
 doPlayerRemoveItem(cid, 2336, 1)
 doPlayerRemoveItem(cid, 2337, 1)
 doPlayerRemoveItem(cid, 2338, 1)
 doPlayerRemoveItem(cid, 2339, 1)
 doPlayerRemoveItem(cid, 2340, 1)
 doPlayerRemoveItem(cid, 2341, 1)

doPlayerAddItem(cid,2342,1)
setPlayerStorageValue(cid,2341,1)
doSendMagicEffect({x=33198, y=32876, z=11}, 6)

 else
				doPlayerSendCancel(cid,"You do not have all necessary items.")
			end
		else
			doPlayerSendCancel(cid,"You already done this quest.")
		end
return 1
end
 
Back
Top