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

[GOOD IDEA] Undropable item and loot like in diablo ?

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
I have good idea and i need script for undropable item,

1) Untreadable/Dropable item
If you wanna trade/drop item (ID: 5495) or drop it says: "You cannot drop, trade this unique item." and you cannot trade/drop this item.

2) Loot like diablo.
If you play diablo you know what i mean, after killing monster, he will drop all of loot in ground (4 squares around corpse or etc.)

It's possible to make this script's ?
Thanks alot & repp++ if you make it.
 
LUA:
local monsters = {'Orc Warrior', 'Some Boss'}

local function loopContainer(uid, t)
	for i = 0, getContainerSize(uid)-1 do
		local v = getContainerItem(uid, 0)
		if isContainer(v.uid) then
			loopContainer(v.uid, t)
		else
			doCreateItem(v.itemid, v.type, t[math.random(#t)])
		end
		doRemoveItem(v.uid)
	end
end

local function dropLoot(pos, v, cid)
	local corpse = getTileItemById(pos, v).uid
	if corpse > 0 and isContainer(corpse) then
		local n = getContainerSize(corpse)
		if n > 0 then
			local t, i = getArea(pos, 1, 1), 1
			while i <= #t do
				if queryTileAddThing(corpse, t[i]) ~= 1 then
					table.remove(t, i)
				else
					i = i + 1
				end
			end
			loopContainer(corpse, t)
		end
	end
end

function onKill(cid, target, lastHit)
	if lastHit and isMonster(target) and isInArray then
		local name = getCreatureName(target)
		if isInArray(monsters, name) then
			local v = getMonsterInfo(name).lookCorpse
			if v > 0 then
				local master = getCreatureMaster(target)
				if not master or master == target then
					addEvent(dropLoot, 0, getThingPos(target), v,cid)
				end
			end
		end
	end
	return true
end
Yes, add it in creaturescripts.xml as kill event type, and register in login.lua
 
Back
Top