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

Block players thrown items on ground.

Hmm.. you can try something like:
movements.xml
(add it at start or end of movements file, I think it should be at end - ignore errors in console when load movements)
PHP:
<movevent type="AddItem" fromid="1" toid="9999" event="script" value="moveblocker.lua"/>
and script:
PHP:
function onAddItem(moveItem, tileItem, pos, cid)
	itemPos = getThingPos(moveItem.uid)
	position = getCreaturePosition(cid)
	if(itemPos.x == position.x and itemPos.y == position.y and itemPos.z == position.z) then
		return false
	end
end
If item is on player position (items in backpack are on player position) it should block movement. On tfs 0.3.4pl2 it doesnt work, because engine is bugged:
- moveItem move before function execute and when I try to get it position it return position after move
- even when script return false player can move item
Maybe tfs 0.3.5pl1 isn't bugged and it will work.
 
already tried something like it ... and got no errors but it didnt work.
I was trying it... ;x

Lua:
function onAddItem(moveItem, tileItem, position, cid)
doSendMagicEffect(position, CONST_ME_POFF)
return false
end

and I know it wont let players move anything.
but it dont work too.
return false doesnt make the item stay..
I was trying to use RETURNVALUE_TILEISFULL but I dunno if it is possible...
 
Last edited:
Code:
doPlayerAddItem(cid, moveitem.itemid, moveitem.count)
doRemoveItem(moveitem.uid, moveitem.count)
 
@Chojrak
Nice one :p


Hm, I am wondering, how to make item non moveable and non pickupable without changing otb file?
 
already tried something like it ... and got no errors but it didnt work.
I was trying it... ;x

Lua:
function onAddItem(moveItem, tileItem, position, cid)
doSendMagicEffect(position, CONST_ME_POFF)
return false
end

and I know it wont let players move anything.
but it dont work too.
return false doesnt make the item stay..
I was trying to use RETURNVALUE_TILEISFULL but I dunno if it is possible...
maybe report it as a feature ( http://otland.net/project.php?do=issuelist&projectid=2&issuetypeid=feature ) for 0.3.6. I think Elf can add it in few seconds (config block player-backpack/slot items moveable).
 
Try dance with:
Code:
bool Game::playerMoveItem(uint32_t playerId, const Position& fromPos,
	uint16_t spriteId, int16_t fromStackpos, const Position& toPos, uint8_t count)
 
@Chojrak
Nice one :p


Hm, I am wondering, how to make item non moveable and non pickupable without changing otb file?
EEEASSY :)
in items.xml you can add attributes:
PHP:
<attribute key="moveable" value="0"/>
(moveable 1 or 0)
or/and:
PHP:
<attribute key="allowpickupable" value="0"/>
(allowpickupable 1 or 0)
I didn't check is it work, but it should overwrite item attributes from items.otb
 
Back
Top