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

Help with storage value monster

Here you can use this script to make it fit your needs.

How it looks in game:
killed_monsters.JPG



1. data/creaturescripts/scripts/monster_counter.lua
Code:
local monsters = {
	--name = storage
	["rat"] = 35001,
	["troll"] = 35002,
	["rotworm"] = 35003,
	["dragon"] = 35004,
	["dragon lord"] = 35005,
	["demon"] = 35006,
}

function onKill(cid, target)
	if(isPlayer(target) ~= TRUE) then
		local name = getCreatureName(target)
		local monster = monsters[string.lower(name)]
		if(monster) then
			local killedMonsters = getPlayerStorageValue(cid, monster)
			if(killedMonsters == -1) then
				killedMonsters = 1
			end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " " .. name .. "'s.")
			setPlayerStorageValue(cid, monster, killedMonsters + 1)
		end
	end
	return TRUE
end

2. data/creaturescripts/creaturescripts.xml
* TFS 0.2
Code:
<event type="kill" name="KilledMonstersCounter" script="monster_counter.lua"/>
* TFS 0.3 (RC2+)
Code:
<event type="kill" name="KilledMonstersCounter" event="script" value="monster_counter.lua"/>

3. Add this at bottom of your login.lua (before return TRUE)
Code:
registerCreatureEvent(cid, "KilledMonstersCounter")
 
Back
Top