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

[Request] when monster die.

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
Hi,

i tryed many times to fix this script i think its easy but failed it should work like this when monster die 2 tiles will be created in pos
x,y,z for 10seconds. then they will get removed.
 
Code:
local m = {
 ["mob1"] = {
tile1 = {x=x,y=y,z=z},
tileid1 = id,
 }
 ["mob2"] = {
tile2 = {x=x,y=y,z=z},
tileid2 = id,
 }
 }

function onKill(cid, target)
 if isPlayer(target) then
 return true
 end
 local monster = m[getCreatureName(target)]
 if monster then
doCreateItem(m.tileid1,m.tile1)
doCreateItem(m.tileid2,m.tile2)
addEvent(removetile, 10*1000)
 end
 return true
 end
function removetile()
doRemoveItem(m.tile1,m.tileid1)
doRemoveItem(m.tile2,m.tileid2)
end
I don't test it, and I am beginner xD
Maybe it no work...
But check!
 
Just a slight mistake:
Switch
Code:
local m = {
to
local monster = {
respectively
Code:
local monster = m[...
to
local m = monster[...
also
LUA:
addEvent(removetile, 10*1000, m) --add your value "m" to the function
This way the function removetile will be able to resolve "m" as "m[getCreatureName(target)]".

Corrected script:
LUA:
local monster = {
	["mob1"] = {
		tile1 = {x=x,y=y,z=z},
		tileid1 = id,
	}
	["mob2"] = {
		tile2 = {x=x,y=y,z=z},
		tileid2 = id,
	}
}

function onKill(cid, target)
	if isPlayer(target) then
		return true
	end
	local m = monster[getCreatureName(target)]
	if m then
		doCreateItem(m.tileid1,m.tile1)
		doCreateItem(m.tileid2,m.tile2)
		addEvent(removetile, 10*1000, m)
	end
return true
end
function removetile(m)
	doRemoveItem(m.tile1,m.tileid1)
	doRemoveItem(m.tile2,m.tileid2)
end

Should work like a charm.
@up Nicely done!
 
Last edited:
OH!
Erased my Private Messag Inbox xD
I recieved pretty much mails lately ...
Mind sending me the script again, or the thread title?
I've got a really bad memory ^_^

Edit: You're script is not evil or bad, you deserve some credit for trying stuff yourself! Noone is perfect right from the start ;)
 
Back
Top