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

Solved onKill function making creature freeze

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
in login.lua I have this

LUA:
registerCreatureEvent(cid, "Bestiary")

in creaturescripts.xml I have this

LUA:
<event type="kill" name="Bestiary" event="script" value="bestiary.lua"/>

and bestiary.lua looks like this

LUA:
function onKill(cid, target, lastHit)

if getCreatureName(target) == "Chicken" and getPlayerStorageValue(cid, 15001) ~= 2 then

setPlayerStorageValue(cid, 15001, 2)

doPlayerSendTextMessage(cid, 24, "You have added the creature 'Chicken' to your Bestiary")

end

end

I have the storages set to the questlog so that all works, but when I kill a chicken, the chicken just freezes and has no health above it and you cant walk over it, what did I do wrong?


I found a post by Cyko and used his script, which was:

LUA:
function onKill(cid, target)
	if (not isMonster(target)) then
		return false
	end

	if getCreatureName(target) == "Chicken"  and getPlayerStorageValue(cid, 15001) < 2 then
		setPlayerStorageValue(cid, 15001, 2)
 		doCreatureSay(cid, "You have added the creature 'Chicken' to your bestiary.", TALKTYPE_ORANGE_1)
		end
	return true

end
and it works!
 
Last edited:
Back
Top