Bom Galera, vou ser direto to tentando postar a meia hora e não ta indo a net ta muito ruim.
É um sistema que quando você arrecada 6 Corações matando players você trocar os corações por double exp no NPC Tobi.
Bom sem mais vamos lá.
Vá na pasta do seu ot creaturescripts/scripts crie um arquivo chamado heart.lua
function onPrepareDeath(cid, deathList) local item = 5943 if isPlayer(cid) and isPlayer(deathList[1]) then local add = doPlayerAddItem(deathList[1],item,1) doItemSetAttribute(add, "description","Esse coração é de "..getPlayerName(cid).." que foi morto no level"..getPlayerLevel(cid).." por "..getPlayerName(deathList[1])..".") doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_ORANGE, "Voce foi Morto " .. getCreatureName(cid) .. ".") doSendMagicEffect(getPlayerPosition(deathList[1]),12) end return true end
Em Creaturescripts.xml
<event type="preparedeath" name="HeartSys" event="script" value="heart.lua"/>
Agora é o NPC,
Vá na pasta do seu servidor data/npc/scripts crie um arquivo chamado tobi npc system.lua e cole isso.
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local experience = 2 -- Experience rates no caso 2x a experiencia do seu servidor. local item = 5943 -- ID do Item que necessita para trocar OBS: Editar no Hearth Tambem no creaturescripts se for mudar. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(msgcontains(msg, 'missao')) then selfSay('Ok, Para começar vamos fazer a {troca}?', cid) end --------------------------------------------------------- if(msgcontains(msg, 'troca')) then selfSay('Traga para min 6 corações para provar a sua força {coracao}', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'coracao') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,2010250) > 0) then selfSay('Voce ja terminou essa missao!!', cid) else if(doPlayerRemoveItem(cid, 5943, 6) == TRUE) then setPlayerStorageValue(cid,2010250,1) doPlayerSetExperienceRate(cid, experience) selfSay('Voce recebeu sua recompensa.', cid) return true end if getPlayerItemCount(cid, item) < 6 then selfSay('Não tente me enganar, voce não tem os 6 corações !', cid) end end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Depois crie um XML Chamado Tobi e Cole isso dentro.
<?xml version="1.0" encoding="UTF-8"?> <npc name="Tobi" script="data/npc/scripts/tobi npc script.lua" walkinterval="2000" speed="0" floorchange="0"> <health now="100" max="100"/> <look type="480" head="0" body="0" legs="0" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Ola vamos comecar a {troca} ?"/> </parameters> </npc>
Bom não testei qualquer bug favor reportar flw.
Créditos:
Vodkart -- Pelo Script do Hearth
Enself -- Pelo Sistema