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

Lua Onkill script

Animera

* * * * *
Joined
Dec 9, 2008
Messages
2,432
Solutions
5
Reaction score
609
Location
ANIMERA.ONLINE
1. I am using an onkill script that gives X storage value on killing the monster, but if someone makes one hit from 5 damage on a monster with like 10k hp it still gets storage how can i fix this?
 
Last edited:
Here.
Lua:
function onKill(cid,target,lastHit)
local config = {
	message = "BOSS +1",
	color = COLOR_WHITE,
	bosses = { -- Monster Name,  Storagevalue,
				["Ra revenge"] = {storage=51001},
				["Warshabaal"] = {storage=51002},
				["Seadevil"] = {storage=51003},
               		["Haunted Dragon"] = {storage=51004},
                		["Thunder dragon"] = {storage=51005},
				["Green-eyes red dragon"] = {storage=51006},
				["Chaos emperor dragon"] = {storage=51007},
				["Vampire genesis"] = {storage=51008},
				["Dark ruler ha des"] = {storage=51009},
				["Amidamaru"] = {storage=51010},
				["Bason"] = {storage=51011},
				["Eliza faust"] = {storage=51012},
				["Fortress Golem"] = {storage=51013},
				["Lucifer the illusionist"] = {storage=51014},
				["Iron maiden jeanne"] = {storage=51015},
				["Kouki"] = {storage=51016},
				["Zenki"] = {storage=51017},
				["Lanancuras"] = {storage=51018},
				["red eyes ultimate dragon"] = {storage=51019},
				["Silva"] = {storage=51020},
				["Zorc necrophadus"] = {storage=51021},
				["King scorpion"] = {storage=51022},
				["Bazir"] = {storage=51023},
				["Apocalypse"] = {storage=51024},
				["Infernatil"] = {storage=51025},
				["Orshabaal"] = {storage=51026},
				["Morgaroth"] = {storage=51027},
				["verminor"] = {storage=51028},
				["Saggi the dark clown"] = {storage=51029},
				["Spirit of light"] = {storage=51030},
				["ghazbaran"] = {storage=51031},
				["fiend"] = {storage=51032},
				["plague"] = {storage=51033},
				["Black luster soldier"] = {storage=51034},
				["Gate guardian"] = {storage=51035},
			},
}
local b = config.bosses[getCreatureName(target)]
	function exp(cid, target)
		setPlayerStorageValue(cid,b.storage,1)
		doSendAnimatedText(getCreaturePosition(cid),config.message, config.color)
	end
	if b then
		addEvent(exp, 1500, cid, target)
	end
	return true
end
 
Lua:
local config = {
	message = "BOSS +1",
	color = COLOR_WHITE,
	bosses = { -- Monster Name,  Storagevalue,
		["Ra revenge"] = 51001,
		["Warshabaal"] = 51002,
		["Seadevil"] = 51003,
		["Haunted Dragon"] = 51004,
		["Thunder dragon"] = 51005,
		["Green-eyes red dragon"] = 51006,
		["Chaos emperor dragon"] = 51007,
		["Vampire genesis"] = 51008,
		["Dark ruler ha des"] = 51009,
		["Amidamaru"] = 51010,
		["Bason"] = 51011,
		["Eliza faust"] = 51012,
		["Fortress Golem"] = 51013,
		["Lucifer the illusionist"] = 51014,
		["Iron maiden jeanne"] = 51015,
		["Kouki"] = 51016,
		["Zenki"] = 51017,
		["Lanancuras"] = 51018,
		["red eyes ultimate dragon"] = 51019,
		["Silva"] = 51020,
		["Zorc necrophadus"] = 51021,
		["King scorpion"] = 51022,
		["Bazir"] = 51023,
		["Apocalypse"] = 51024,
		["Infernatil"] = 51025,
		["Orshabaal"] = 51026,
		["Morgaroth"] = 51027,
		["verminor"] = 51028,
		["Saggi the dark clown"] = 51029,
		["Spirit of light"] = 51030,
		["ghazbaran"] = 51031,
		["fiend"] = 51032,
		["plague"] = 51033,
		["Black luster soldier"] = 51034,
		["Gate guardian"] = 51035,
	}
}

function onKill(cid, target, lastHit)
	if lastHit then
		local b = config.bosses[getCreatureName(target)]
		if b and getCreatureStorage(cid, b) == -1 then
			addEvent(function(cid) if isPlayer(cid) then doCreatureSetStorage(cid, b, 1) doSendAnimatedText(getThingPos(cid), config.message, config.color) end end, 1500, cid)
		end
	end
	return true
end
It'll only set storage for the player who did the last hit now, that's your best bet as long as you're using 0.3.6
 
Back
Top