• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Creature Kill Count System

gigastar

Member
Joined
Jan 25, 2009
Messages
253
Reaction score
15
-Updated-

Usage: !kills monstername

Talkaction:
LUA:
function onSay(cid, words, param)
if (param == "") then
return false
end
 
t = string.explode(param, ",")
t[1] = monster
 
 
if (isCreature(monster)) then
if getPlayerStorageValue(monster) > 0 then
local amount = getPlayerStorageValue(param)
local text = "You have killed " .. amount .. " " .. param .."!"
 
doShowTextDialog(cid, 2175, text)
else
	doPlayerSendCancel(cid, "You have not killed any of these monsters.")
	return false
end
 
 
end
else
	doPlayerSendCancel(cid, "You need to type a monster name.")
return false
end
end


Creaturescript:
LUA:
function onKill(cid, target)
if (isCreature(target)) then
			setPlayerStorageValue(cid, getCreatureByName(target) + 1)
		end
	return true
	end



For anyone that doesn't get it....

1) gets storage of creature name + 1
so the storage IS the creatures NAME....
2) Everytime he killes a monster, it sets the storage +1 of that monsters name.
3) They use the talkaction to check there storage for each monster name.
4) YES THIS MAKES THE TALKACTION CAP LOCKED

!kills Orc Worrior
 
Last edited:
Storage can be corrupted the way this is written, you'll want to do the math before setting the storage.
 
creature uid as storage key?
 
That won't work at all, it needs to look something like this:

LUA:
function onKill(cid, target)
	if (isCreature(target)) then
		local counter = getPlayerStorageValue(cid, getCreatureByName(target)) +1
		setPlayerStorageValue(cid, getCreatureByName(target), count)
	end
return true
end
 
Talkaction:
LUA:
function onSay(cid, words, param)
if (param == "") then
return false
end

t = string.explode(param, ",")
t[1] = monster


if (isCreature(monster)) then
if getPlayerStorageValue(monster) > 0 then
local amount = getPlayerStorageValue(param)
local text = "You have killed " .. amount .. " " .. param .."!"
 
doShowTextDialog(cid, 2175, text)
else
	doPlayerSendCancel(cid, "You have not killed any of these monsters.")
	return false
end
 
 
end
else
	doPlayerSendCancel(cid, "You need to type a monster name.")
return false
end
end

Creaturescript:
LUA:
function onKill(cid, target)
if (isCreature(target)) then
			setPlayerStorageValue(cid, getCreatureByName(target) + 1)
		end
	return true
	end

- - - Updated - - -

Storage can be corrupted the way this is written, you'll want to do the math before setting the storage.

You will want to do the math before posting...

- - - Updated - - -

That won't work at all, it needs to look something like this:

LUA:
function onKill(cid, target)
	if (isCreature(target)) then
		local counter = getPlayerStorageValue(cid, getCreatureByName(target)) +1
		setPlayerStorageValue(cid, getCreatureByName(target), count)
	end
return true
end

Do you know what scripting is?
 
Back
Top