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

[Event] Item

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
743
Solutions
5
Reaction score
200
Location
Pr0land
GitHub
Erexo
Hello,
i looking for script, from all monsters can loot item with id 1234, 1% chance to loot.

I need this to a nice event...

Someone can help?
 
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end

function onKill(cid, target, damage, flags)
	if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
		local a = getCreatureMaster(target)
		if not a or a == target then
			local b = getMonsterInfo(getCreatureName(target))
			if b and b.lookCorpse ~= 0 then
				local c = getItemInfo(b.lookCorpse)
				if c and c.type == ITEM_TYPE_CONTAINER then
					addEvent(f, 0, getThingPos(target), b.lookCorpse)
				end
			end
		end
	end
	return true
end
 
This event may be specified from time to time such as every 1 month but the duration is for 7 days?
sorry for my bad english i use traductor of google.
 
creaturescripts.xml
LUA:
<event type="death" name="SaturdayLoot" event="script" value="SaturdayLoot.lua"/>

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

SaturdayLoot.lua
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end

local function isSaturday
 	local Saturday = Saturday 
end

	

 
function onKill(cid, target, damage, flags)

if isSaturday then
	if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
		local a = getCreatureMaster(target)
		if not a or a == target then
			local b = getMonsterInfo(getCreatureName(target))
			if b and b.lookCorpse ~= 0 then
				local c = getItemInfo(b.lookCorpse)
				if c and c.type == ITEM_TYPE_CONTAINER then
					addEvent(f, 0, getThingPos(target), b.lookCorpse)
				end
			end
		end
	end
	return true
end
end

Help
 
Last edited:
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 and true or false
end
 
function onKill(cid, target, damage, flags)
	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				if b and b.lookCorpse ~= 0 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end
 
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 and true or false
end
 
function onKill(cid, target, damage, flags)
	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				if b and b.lookCorpse ~= 0 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end

o.0!
work in tfs 0.4?
 
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 
end

local HardMonter = {"dragon", "dragon lord", "grin rapper", "frost dragon"}

function onKill(cid, target, damage, flags)

	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) and getCreatureName(getCreatureTarget(cid)) == HardMonter then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				if b and b.lookCorpse ~= 0 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end


I need help so that only the monsters on the list have the chance to drop loot.
Or everyone will run to cave of rat because it is very easy to kill.
 
Last edited:
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 
end


function onKill(cid, target, damage, flags)

 	local HardMonter = {'dragon', 'dragon lord', 'grin rapper', 'frost dragon'}

	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				if b and b.lookCorpse ~= 0 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end


add if monster is hard for life or other
or chose monsters {dragon, dragon lord, demon}


which means it, that the harder the monster loot item?
 
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 
end


function onKill(cid, target, damage, flags)

 	local HardMonter = {'dragon', 'dragon lord', 'grin rapper', 'frost dragon'}

	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				if b and b.lookCorpse ~= 0 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end


I need help so that only the monsters on the list have the chance to drop loot.
Or everyone will run to cave of rat because it is very easy to kill.
just check the maxhealth?
 
Yes, is good maxhealth dragon or more hard, dragon is 1.000 max health. For add REP for you is in this link? http://otland.net/reputation.php?do=addreputation&p=1255045 ok?


For install i add:

creaturescripts.xml
LUA:
<event type="kill" name="SaturdayLoot" event="script" value="SaturdayLoot.lua"/>

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

SaturdayLoot.lua
LUA:
local function f(pos, b)
	local j = getTileItemById(pos, b).uid
	if j ~= 0 then
		doAddContainerItem(j, 1234)
	end
end
 
local function isSaturday()
 	return os.date("%w") == 6 
end
 
 
function onKill(cid, target, damage, flags)
 
	if isSaturday() then
		if math.random(100) == 1 and (damage == true or flags == 3) and isMonster(target) then
			local a = getCreatureMaster(target)
			if not a or a == target then
				local b = getMonsterInfo(getCreatureName(target))
				local e = getMonsterInfo(getCreatureMaxHealth(target))
				if b and b.lookCorpse ~= 0 and e >= 1000 then
					local c = getItemInfo(b.lookCorpse)
					if c and c.type == ITEM_TYPE_CONTAINER then
						addEvent(f, 0, getThingPos(target), b.lookCorpse)
					end
				end
			end
		end
	end
	return true
end
?

HELP!




EDIT: Kill the monster and he stands up. Besides never give any item even if it helped increase the odds.
 
Last edited:
Back
Top