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

CreatureEvent Monsters have multiple lives

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Reaction score
38
Location
Sweden
Hello everyone.

I made this script based on the idea form http://otland.net/f82/cats-should-have-7-lifes-d-52856/ .

Script:
Lua:
function onKill(cid, target)
local monsters = {
	["Cat"] = {
		text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
		emotes = {"MjaaaUUU1!!", "LoL sucker"},
		effect = 49,
		lives = 7
		},
	["Trainer"] = {
		text = {}, -- No message after death needed, the Trainer can't die.
		emotes = {"You can't kill me!!!??", "I'm a training monk!"},
		effect = 0, -- 0 for no effects.
		lives = 0 -- 0 for imortality
		}
}

	local select = monsters[getCreatureName(target)]
	
	if select then
		local id = getGlobalStorageValue(target)
		if id >= select.lives and select.lives ~= 0 then
			if select.text[1] then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, select.text[math.random(1, #select.text)])
			end
		else
			setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
			doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
			doSendMagicEffect(getCreaturePosition(target), select.effect)
			if select.emotes[1] then
				doPlayerSendTextMessage(target, select.emotes[math.random(1, #select.emotes)], TALKTYPE_ORANGE_1)
			end
			return false
		end
	end
	return true
end

Pretty simple and configurable. :)

If you have any question about the script, don't be shy to ask.
 
Last edited:
:) pretty good
good for custom bosses, +5
credits for the 7 lives'cat owner too xD
 
Here i get a bug, console saying is because "," on line 23...
Sorry for sux english, and can help? xD
 
Maybe you can do it with delay also? Like monster turns to corpse and few seconds later it changes to monster again, will look good for undeads I think ;d
EDIT: well, dunno why but monsters die normally ; o
No errors when loading or killing, just don't work

EDIT: Ok, works now, forgot to register creatureevent, lol
 
Last edited:
Back
Top