• 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 onRemoveItem// OnAddItem

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
838
Reaction score
28
Location
Poland/ Wroclaw
Nobody is perfect and knows everything, so my questtion is, how does those functions:

onRemoveItem
OnAddItem

works.

I searched forum for this, and found something. But i exactly don't know few things. Get an example:

Lua:
local cos = {
[1] = {x=3,y=4,z=5},
[2]  = {x=5,y=3,z=3}
}
local poss = {
[1] = {x=1,y=2,z=3},
[2] = {x=2, y=3, z= 4}
}

onAddItem(moveitem, tileitem, pos, cid)
local o
for i = 1,2 do if pos  = cos[i] then o = i; end end

if moveitem = scrabcoin then --(so if the item that i put for example somewhere is scrab coin then)

doTeleportThing(cid,poss[o])
end
end

Okay it can be (if i do really something wrond msg it).

but what add to movements.xml?

PHP:
<movevent event="AddItem" tileitem="1" /*<<< That is it. What is Tile Item?? */ uniqueid="UUU" /* uid of item on what is dropped scrab coin? */ script="NAMEOFSCRIPT.lua" />

Answer this questions pleas.e..
 
here is an example :

PHP:
<movevent type="AddItem" tileitem="1" uniqueid="15064" event="script" value="water.lua"/>
Explantation: a tile got uid 15064, if I drop water(from flask), to that tile, teleport will be created.

Here is the script:

Lua:
function onAddItem(moveitem, tileitem, position, cid)
	if moveitem.itemid == 2016 then <!--Checking, if item.id of that item == water splash from flask-->
		doCreateTeleport(1387, {x=311, y=274, z=5, stackpos=1}, {x=316, y=275, z=6, stackpos=255})
	end
end

So yeah, moveitem it's item which you drop, tileitem, it's item which got uid.
 
tileitem is the ground you put stuff on, it's like item and itemEx

moveitem is itemEx (the object you've dropped)
and tileitem is item (the object you've used the itemEx on)

I think I'm right but if not please correct me ;>
 
Back
Top