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

CreatureEvent Something like task!

D. Kielb

/home
Joined
Jan 12, 2010
Messages
387
Reaction score
5
Location
nisko
Hihio!

This script is to count the number of monsters killed, write them on the items and when they are killed like 1,000 demons gets reward.

PART Creaturescript
First go to Creaturescript.xml

Code:
<event type="kill" name="countKill" event="script" value="count.lua"/>

Second open Login lua

Code:
	registerCreatureEvent(cid, "countKill")

Next create count.lua

Code:
local monsters =  {
        ["demon"] = 9545,
}
function onKill(cid, target)
        if(isPlayer(target) ~= true and isPlayer(cid)) then
                local name = getCreatureName(target)
                local monster = monsters[string.lower(name)]
                if(monster) then
                        local killedMonsters = getPlayerStorageValue(cid, monster)
                        if(killedMonsters < 1000) then
                                killedMonsters = 1
                        end
               end
   return true
end

PART ACTIONS

First go to actions.xml

Code:
   <action actionid="XXXX" event="script" value="countitem.lua"/>

Second go to actions/scripts/ create countitem.lua

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
                local monster = monsters[string.lower(name)]
                if(monster) then
                local killedMonsters = getPlayerStorageValue(cid, monster)
		if item.itemid == xxxx then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " " .. name .. "'s.")
			elseif(killedMonsters == 1000) then 
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Gratulacje zabiles 1000 " .. name .. "'s.")
				doPlayerAddMoney(cid, 20000) == TRUE then
				doPlayerSendTextMessage(cid, 19,"Dostales nagrode!")
				doSendMagicEffect(getPlayerPosition(cid), 27)

                end
        end
        return true
end

Sorry for my bad English :)

Repp+
 
Where do i put the " registerCreatureEvent(cid, "countKill")" on login.lua`?
 
Back
Top