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

Kill monster

pasibun

New Member
Joined
Nov 7, 2011
Messages
147
Reaction score
1
Hello there,

I've searched a few days on the forum, but I could not find it.

Can some one help me little bit with my idea.

I want to create a boss(this part is ofcourse done)
But i got a question about the loot.

I want that this boss have a change to drop 1 of the 8 items.
So he always drop 1 item.. But never 2 item.

Can some one help me with this?
I know i need to have the function onkill, but i just need a little help:)

Thanks,

Pasibun
 
LUA:
function onDeath(cid, corpse, deathList)
	local reward = { -- Choose your 8 items
		{2160, 1}, -- Item, count
		{2173, 3}
	}
 
	if(isMonster(cid)) then
		local c = math.random(#reward)
		doAddContainerItem(corpse.uid, reward[c][1], reward[c][2])
	end
 
	return true
end

Register it in login.lua and also in the chosen monster.

login.lua:
LUA:
	registerCreatureEvent(cid, "KillMonster")

for example, dragon.xml, add this under defenses:
XML:
	<script>
		<event name ="KillMonster"/>
	</script>
Use the request board next time.
 
Last edited:
testing it now

sorry for putting this in the wrong topic.
next time will try and judge better what topic to use
 
Last edited:
just for the record
LUA:
local reward = { -- Choose your 8 items
	{2160, 1}, -- Item, count
	{2173, 3}
}

function onDeath(cid, corpse, deathList)
	doAddContainerItem(corpse.uid, unpack(reward[math.random(#reward)]))
	return true
end
with my script, you must not register it for players, as it's not even needed (remove the login.lua line)
 
Back
Top