Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Tema: 

NPC de Promotion que funciona assim (TFS 0.4): 
 
• O player vai no NPC de Promotion que promove por task, fala com ele, dai ele vai cobrar 25kk para dar a task ao player.

• Após ele ter pago os 25kk, ele receberá a seguinte missão, exemplo matar 500 demon, 500 hydra, a cada criatura morta vai mostrando por exemplo "Você matou 10/500 demons".

• Após a task ser completada, ele será promovido automaticamente ou indo ao NPC, a vocação X, com a seguinte mensagem "Parabéns, você agora é um |VOCATIONNAME|."

Obrigado aos desafiantes que participaram ... bora para o duelo!

São 4 scripts, lembrando que ao votar é preciso citar uma justificativa.


Script 1:

LIB: 

_NPC_TASK_PROMOTION_ = {
	taskPrice = 500000,     -- *(500k)
	vocationReward = 5,     -- *(vocationId que ira se tornar)
	automaticReward = "yes", -- *(ao completar a task recompensar imediatamente? (sem retorno ao NPC))
	task = {creatureName = "Dragon Lord", taskStorage = 50000, count = 200}
}

_NPC_TASK_PROMOTION_.automaticReward = getBooleanFromString(_NPC_TASK_PROMOTION_.automaticReward)

_NPC_TASK_PROMOTION_.check = function(cid)
	return getPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage) ~= -1
end

_NPC_TASK_PROMOTION_.get = function(cid)
	return getPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage) < 0 and 0 or getPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage)
end

CREATURESCRIPT: 

--[[ TAGs:
	<event type="login" name="taskPromotionL" event="script" value="taskPromotion.lua"/>
	<event type="kill" name="taskPromotion" event="script" value="taskPromotion.lua"/>
]]--

function onLogin(cid)
	registerCreatureEvent(cid, "taskPromotion")
	return true
end

function onKill(cid, target, lastHit)
	if(_NPC_TASK_PROMOTION_.check(cid)) then
		if(isMonster(target) and getCreatureName(target):lower() == _NPC_TASK_PROMOTION_.task.creatureName:lower()) then
			if(_NPC_TASK_PROMOTION_.get(cid) < _NPC_TASK_PROMOTION_.task.count) then
				setPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage, _NPC_TASK_PROMOTION_.get(cid) + 1)
				
				local count, countMax = _NPC_TASK_PROMOTION_.get(cid), _NPC_TASK_PROMOTION_.task.count
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..(count == countMax and "Você completou a missão. " or "").."Total ["..count.."/"..countMax.."] ".._NPC_TASK_PROMOTION_.task.creatureName..(countMax and "'s" or "").."."..(count == countMax and (_NPC_TASK_PROMOTION_.automaticReward and "" or " Volte e fale com o NPC para receber a recompensa.") or "").."")
				
				if(count == countMax and _NPC_TASK_PROMOTION_.automaticReward) then
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Task completada. Agora você é um"..(getPlayerSex(cid) ~= 1 and "a" or "").." "..getVocationInfo(_NPC_TASK_PROMOTION_.vocationReward).name..".")
					doPlayerSetVocation(cid, _NPC_TASK_PROMOTION_.vocationReward)
					setPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage, count + 1)
				end
			end
		end
	end
	return true
end

NPC: 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local task = _NPC_TASK_PROMOTION_
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 onCreatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	
	if(not npcHandler:isFocused(cid)) then
		if(isInArray({"hi", "hello", "hey"}, msg:lower())) then
			npcHandler:addFocus(cid)
			if(getPlayerVocation(cid) == _NPC_TASK_PROMOTION_.vocationReward) then -- *(Se já for a vocação da recompensa)
				npcHandler:say("Desculpe, não tenho mais nada a lhe oferecer.", cid)
				return true
			end
			
			if(_NPC_TASK_PROMOTION_.check(cid)) then -- *(Checa se esta fazendo a task)
				if(_NPC_TASK_PROMOTION_.get(cid) == _NPC_TASK_PROMOTION_.task.count) then -- *(Se já ter matado todos os monstros)
					npcHandler:say("Muito bem "..getCreatureName(cid)..", como prometido, agora você é um"..(getPlayerSex(cid) ~= 1 and "a" or "").." guerreir"..(getPlayerSex(cid) ~= 1 and "a" or "o").." renovad"..(getPlayerSex(cid) ~= 1 and "a" or "o")..".", cid)
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Task completada. Agora você é um"..(getPlayerSex(cid) ~= 1 and "a" or "").." "..getVocationInfo(_NPC_TASK_PROMOTION_.vocationReward).name..".")
					doPlayerSetVocation(cid, _NPC_TASK_PROMOTION_.vocationReward)
					setPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage, _NPC_TASK_PROMOTION_.get(cid) + 1)
					
				elseif(_NPC_TASK_PROMOTION_.get(cid) < _NPC_TASK_PROMOTION_.task.count) then -- *(Se não tiver matado todos os monstros)
					npcHandler:say("Você conseguira. Tenho plena fé em você.", cid)
					
				elseif(_NPC_TASK_PROMOTION_.get(cid) > _NPC_TASK_PROMOTION_.task.count) then -- *(Se já ter feito a task)
					npcHandler:say("Não tenho mais nada a lhe oferecer.", cid)
				end
			else
				npcHandler:say("Olá "..getCreatureName(cid)..", tenho uma missão importante para você. Se você conseguir matar ".._NPC_TASK_PROMOTION_.task.count.." ".._NPC_TASK_PROMOTION_.task.creatureName..""..(_NPC_TASK_PROMOTION_.task.count > 1 and "'s" or "").." posso torna-l"..(getPlayerSex(cid) ~= 1 and "a" or "o").." um"..(getPlayerSex(cid) ~= 1 and "a" or "").." "..getVocationInfo(_NPC_TASK_PROMOTION_.vocationReward).name..".", cid)
				npcHandler:say("Aceitaras tal destino?", cid)
				talkState[talkUser] = 1
			end
		else
			return false
		end
	end
	
	if(isInArray({"yes"}, msg:lower()) and talkState[talkUser] == 1) then
		npcHandler:say("Decidido. Que Deus esteja com você.", cid)
		setPlayerStorageValue(cid, _NPC_TASK_PROMOTION_.task.taskStorage, _NPC_TASK_PROMOTION_.get(cid))
		talkState[talkUser] = 0
	elseif(isInArray({"no"}, msg:lower()) and talkState[talkUser] == 1) then
		npcHandler:say("Entendo. Ainda não está preparado.", cid)
		talkState[talkUser] = 0
		
		
	elseif(isInArray({"bye", "farewell", "cya"}, msg:lower())) then
		npcHandler:say("Adeus, "..getCreatureName(cid)..".", cid)
		npcHandler:releaseFocus(cid)
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)

NPC XML: 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Task Promotion" script="data/npc/scripts/task_promotion.lua" walkinterval="2000" speed="0" floorchange="0">
	<health now="100" max="100"/>
	<look type="128" head="0" body="104" legs="0" feet="0"/>
</npc>




Script 2:

 

LIB: 

taskConfig = {
    price = 25000000,
    vocation = 9,
    task = {
        ["Demon"] = {count = 500, storage = 9812},
        ["Hydra"] = {count = 500, storage = 9813},
        ["Rat"] = {count = 1000, storage = 9814},
    },
    storage = 9810,
}
function pointNumber(n)
    if not n or not tonumber(n) then
        return false
    end
    local d = tostring(n):reverse()
    local z = {}
    for i = 1, d:len(), 3 do
        z[#z + 1] =  d:sub(i, i + 2)
    end
    return table.concat(z, "."):reverse()
end
function isTaskCompleted(cid)
    if not isPlayer(cid) or getPlayerStorageValue(cid, taskConfig.storage) < 1 then
        return false
    end
    for _, info in pairs(taskConfig.task) do
        if getPlayerStorageValue(cid, info.storage) < info.count then
            return false
        end
    end
    return true
end
function isInTask(cid)
    return getPlayerStorageValue(cid, taskConfig.storage) > -1
end
function taskPopup(cid, inTask)
    local str = "*** Task: ***"
    for name, info in pairs(taskConfig.task) do
        if getPlayerStorageValue(cid, info.storage) < info.count then
            local value = info.count - (inTask and getPlayerStorageValue(cid, info.storage) or 0)
            str = str.."\n"..value.."x "..name..(value > 1 and "s" or "")
        end
    end
    doPlayerPopupFYI(cid, str)
end

CREATURESCRIPT: 

--<event type="kill" name="taskKill" script="taskKill.lua"/>
function onKill(cid, target)
    if isPlayer(cid) and isMonster(target) and isInTask(cid) and not isTaskCompleted(cid) and taskConfig.task[getCreatureName(target)] then
        local monster = taskConfig.task[getCreatureName(target)]
        local playerCount = getPlayerStorageValue(cid, monster.storage)
        if playerCount < monster.count then
            setPlayerStorageValue(cid, monster.storage, playerCount + 1)
            playerCount = getPlayerStorageValue(cid, monster.storage)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed ["..playerCount.."/"..monster.count.."] "..getCreatureName(target)..(playerCount > 1 and "s" or "")..".")
            if isTaskCompleted(cid) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You completed the task! Go to NPC John to take your reward.")
            end
        end
    end
    return true
end

NPC: 

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)
    msg = msg:lower()
    if not npcHandler:isFocused(cid) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if msgcontains(msg, "promoted") then
        local message
        if isInTask(cid) then
            if getPlayerStorageValue(cid, taskConfig.storage) > 1 then
                selfSay("You already completed my task.", cid)
                return true
            end
            message = "Did you complete my task?"
        else
            message = "To evolve to "..getVocationInfo(taskConfig.vocation).name..", you need kill the following monsters and pay me {"..pointNumber(taskConfig.price).." gold}. Are you sure?"
            taskPopup(cid, false)
        end
        selfSay(message, cid)
        talkState[talkUser] = 1
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then    
        if isInTask(cid) then
            if isTaskCompleted(cid) then
                selfSay("Congratulations! Now you belong to the vocation "..getVocationInfo(taskConfig.vocation).name..".", cid)
                setPlayerStorageValue(cid, taskConfig.storage, 2)
                doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                doPlayerSetVocation(cid, taskConfig.vocation)
            else
                selfSay("You didn't complete my task. Left:", cid)
                taskPopup(cid, true)
            end
        else
            if doPlayerRemoveMoney(cid, taskConfig.price) then
                selfSay("Good luck! Come back when you finish the task.", cid)
                setPlayerStorageValue(cid, taskConfig.storage, 1)
                for _, info in pairs(taskConfig.task) do
                    setPlayerStorageValue(cid, info.storage, 0)
                end
            else
                selfSay("You do not have enough money. Come back when you do.", cid)
            end
        end
        talkState[talkUser] = 0
    elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
        selfSay("OK, bye!", cid)
        talkState[talkUser] = 0
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())             

NPC XML: 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="John" script="taskNpc.lua" walkinterval="350000" floorchange="0" speed="0">
    <health now="150" max="150"/>
    <look type="134" head="39" body="113" legs="38" feet="0" addons="3" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|, what about being {promoted}?"/>
    </parameters>
</npc>

TALKACTIONS: 

--<talkaction words="/check" event="script" value="taskCheck.lua"/>
--Opcional!
function onSay(cid)
    if not isInTask(cid) then
        return doPlayerSendCancel(cid, "You aren't in task.")
    elseif isTaskCompleted(cid) then
        return doPlayerSendCancel(cid, "You have completed the task.")
    end
    taskPopup(cid, true)
    return true
end




Script 3:


LIB: 
task_promotion = {
    --{tem que matar 50, nome do bicho, storage numero dela segue a ordem}
    {have_to_kill = 2, name = "demon",storage = 16850}, -- letras minusculas
    {have_to_kill = 6, name = "dragon",storage = 16851},-- letras minusculas
	{have_to_kill = 4, name = "hydra",storage = 16852}, -- se quiser mais bicho adiciona uma linha assim <--
}

task_reward = {
  --[id da vocation que play é] = {msg que vai receber,promotion q vai ser}
    [1] = {msg = "Parabéns, você agora é um |x|.",my_promotion = 6},
    [2] = {msg = "Parabéns, você agora é um |xx|.",my_promotion = 7},
}

task_storage_npc = 16849 -- storage do npc

-- verificando se não é summon
function isSummon(sid)
      for i, pid in ipairs(getPlayersOnline()) do
            for c, cid in pairs(getCreatureSummons(pid)) do
                  if (cid == sid) then
                        return true
                  end
            end
      end
      return false
end

CREATURESCRIPT: 

--<event type="kill" name="nome_do_arquivo" event="script" value="nome_do_arquivo.lua"/>

function onKill(cid, target, lastHit)
      if getCreatureStorage(cid,task_storage_npc) == -1 then
            return true
      end

      for i = 1,#task_promotion do
            if getCreatureStorage(cid,task_promotion[i].storage) <= task_promotion[i].have_to_kill then
                  if task_promotion[i].name == string.lower(getCreatureName(target)) and isMonster(target)and not isSummon(target) then
                        doCreatureSetStorage(cid,task_promotion[i].storage,getCreatureStorage(cid,task_promotion[i].storage)== -1 and 0 or getCreatureStorage(cid,task_promotion[i].storage))
                        doCreatureSetStorage(cid,task_promotion[i].storage,getCreatureStorage(cid,task_promotion[i].storage)+1)
                              if getCreatureStorage(cid,task_promotion[i].storage) == task_promotion[i].have_to_kill then
                                    doPlayerSendTextMessage(cid,19,"Você Matou ["..getCreatureStorage(cid,task_promotion[i].storage).."/"..task_promotion[i].have_to_kill.."] "..getCreatureName(target).." Parabéns")
                                    doCreatureSetStorage(cid,task_promotion[i].storage,getCreatureStorage(cid,task_promotion[i].storage)+1)
                                    onReward (cid,target)
                                    return true
                              end
                        doPlayerSendTextMessage(cid,19,"Você Matou ["..getCreatureStorage(cid,task_promotion[i].storage).."/"..task_promotion[i].have_to_kill.."] "..getCreatureName(target).."")
                  end
            end
      end
      return true
end

function onReward (cid,target)
local check_kill = 0
      for i = 1,#task_promotion do
            if getCreatureStorage(cid,task_promotion[i].storage) > task_promotion[i].have_to_kill then
                  check_kill = check_kill+1
                  if check_kill == #task_promotion then
                  local promo = task_reward[getPlayerVocation(cid)]
                        doPlayerSetPromotionLevel(cid,1) -- tem ot q não precisa no meu preciso se tiver erro retire
                        doPlayerSetVocation(cid,promo.my_promotion)
						doCreatureSetStorage(cid,task_storage_npc,1)
                        doPlayerSendTextMessage(cid,22,promo.msg)
                  end
            end
      end
      return true
end

NPC: 

local npc_task = {
    coin = {2160,2500},  -- id do dinheiro quantidade 25kk 2500
    msg_promo = "eu te dou uma tarefa agora por 25kk [yes] ou [no]", -- pode editar msg menos [yes] ou [no]
    msg_promo2 = "você tem que matar 2 demon 6 dragon 4 hydras eu irei te promover", -- aqui é misão
    msg_promo3 = "você não sabe oq esta perdendo", -- aqui coloca msg se dizer no
}

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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

      if (msgcontains(msg, 'promotion')and getCreatureStorage(cid,task_storage_npc) == 1) then
            return selfSay("você já fez essa tarefa", cid) and true
      end

      if (msgcontains(msg, 'promotion')and getCreatureStorage(cid,task_storage_npc) == 0) then
            return selfSay("ainda falta matar uns", cid) and true
      end

      if(msgcontains(msg, 'promotion') and getCreatureStorage(cid,task_storage_npc) == -1) then
            selfSay(npc_task.msg_promo, cid)
            talkState[talkUser] = 1
      elseif (msgcontains(msg,'no') and talkState[talkUser] == 1) then
            selfSay(npc_task.msg_promo3, cid)
            talkState[talkUser] = 0
      elseif (msgcontains(msg,'yes') and talkState[talkUser] == 1) then
            if doPlayerRemoveItem(cid,npc_task.coin[1],npc_task.coin[2]) == true then
                  doCreatureSetStorage(cid,task_storage_npc,0)
                  selfSay(npc_task.msg_promo2, cid)
                  talkState[talkUser] = 0
            else
                  talkState[talkUser] = 0
                  selfSay("você não tem dinheiro o suficiente", cid)
            end
      end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC XML: 

<npc name="promotion task" script="data/npc/scripts/task.lua" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="128" head="0" body="87" legs="39" feet="0"/>
	<parameters>
      <parameter key="module_travel" value="1"/>
	<parameter key="message_greet" value="Olá |PLAYERNAME|. Eu Posso Promover Você Com Uma Tarefa Saiba Mais Diga {promotion} ?" />
	</parameters>
</npc>

TALKACTION: 

--<talkaction words="!task" event="script" value="task.lua"/>

function onSay(cid, words, param, channel)
      if getCreatureStorage(cid,task_storage_npc) == 0 then
            for i = 1,#task_promotion do
                  doPlayerSendTextMessage(cid,19,"lintando "..i.." ["..getCreatureStorage(cid,task_promotion[i].storage).."/"..task_promotion[i].have_to_kill.."] "..task_promotion[i].name)
            end
      end
      return true
end




Script 4:


CREATURESCRIPT: 
--[[

	<event type="login" name="verf_taskNpc" event="script" value="arquivo.lua"/>
	<event type="kill" name="taskNpc" event="script" value="arquivo.lua"/>

]]

local Config = {
    Monsters = {
      -- ["Name"] = {amount = quantidade}
      ["Demon"] = {amount = 30},
      ["Hydra"] = {amount = 10},
    },
    StoragePro = 54661, -- Não mexer se não souber editar
    Money = 100 -- Dinheiro
}
function onKill(cid, target)
	if not isMonster(target) and getPlayerStorageValue(cid, Config.StoragePro) >= (2 + #Config.StoragePro) then
		return false
	end
	local monster = Config.Monsters[getCreatureName(target):lower]
	if monster then
		local sto = getPlayerStorageValue(cid, monster)
		if sto < (monster.amount - 1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task message: ["  .. (sto + 1) ..  "/" .. monster.amount .. "] of " .. getCreatureName(target) .. ".")
			setPlayerStorageValue(cid, monster, (sto + 1))
		elseif sto == (monster.amount - 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations!! you have killed"  .. (sto + 1) ..  "/" .. monster.amount .. "] of " .. getCreatureName(target) .. "s ands and completed the task.")
			setPlayerStorageValue(cid, monster, (sto + 1)) 
			setPlayerStorageValue(cid, Config.StoragePro, (getPlayerStorageValue(cid, Config.StoragePro) + 1))
		end
	end
	return true
end
function onLogin(cid)
	registerCreatureEvent('taskNpc')
	return true
end

NPC: 

local Config = {
    Monsters = {
      -- ["Name"] = {amount = quantidade}
      ["Demon"] = {amount = 30},
      ["Hydra"] = {amount = 10},
    },
    StoragePro = 54661, -- Não mexer se não souber editar
    Money = 100 -- Dinheiro
}

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 talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
    local msg = msg:lower()
    local release = talkState[talkUser]
    if msgcontains(msg, "mission") then
      if getPlayerStorageValue(cid, Config.StoragePro) < 1 then
        selfSay("A missão para promovido custa " .. Config.Money .. " você aceita fazer ?", cid)
        release = 1
      elseif getPlayerStorageValue(cid, Config.StoragePro) == (2 + #Config.Monsters) then
        selfSay("Você já cumpriu a missão peça pra ser {promovido}.", cid)
        release = 2 
      elseif getPlayerStorageValue(cid, Config.StoragePro) == (3 + #Config.Monsters) then
      	selfSay("Voce já terminou as missões, pode ir em embora!", cid)
      	release = 0
      end
    elseif msgcontains(msg, "yes") and release == 1 then
      if doPlayerRemoveMoney(cid, Config.Money) then
        local text = ""
        for monsters, v in pairs(Config.Monsters) do
          txt = txt .. ", "
          txt = txt .. v.amount .. " {" .. monsters .. "}"
        end
        npcHandler:say("A missão é matar esses monstros para mim" .. text .. ".", cid)
        for i, _ in pairs(Config.Monsters) do
          setPlayerStorageValue(cid, i, 0)
        end
        setPlayerStorageValue(cid, Config.StoragePro, 1)
        release = 0
      else
        selfSay("Você não tem money suficiente!", cid)
        release = 0
      end
    elseif msgcontains(msg, "no") and release == 2 then
      selfSay("Até logo!", cid)
      release = 0  
    end
    if msgcontains(msg, "lista") and getPlayerStorageValue(cid, Config.StoragePro) < (#Config.Monster + 3) then
      local text, n = "", 0
      for monsters, v in pairs(Config.Monsters) do
      	local sto = getPlayerStorageValue(cid, monsters)
      	if  sto < v.amount then
          n = n + 1
          text = text .. ", "
          text = text .. (tostring(sto) < tostring(1) and v.amount or (tostring(v.amount) - tostring(sto))) .. " {" .. monsters .. "}"
        end
      end
      text = text:sub(3)
      if n > 1 then
        selfSay("Para terminar sua missão você ainda tem que matar esses monstros : " .. text, cid)
        release = 0
      elseif n == 1 then
        selfSay("Você só tem mais um monstro à matar : " .. text, cid)
        release = 0
      else
        selfSay("Você já terminou de matar os monstro que lhe pedi, agora sim tu é digno de ser {promovido}.", cid)
        release = 2
      end
    elseif msgcontains(msg, "promovido") and release == 2 then
      selfSay("Aqui está sua promoção jovem soldado!!", cid)
      setPlayerVocation(cid, (getPlayerVocation(cid) + 4))
      setPlayerStorageValue(cid, Config.StoragePro, (#Config.Monsters + 3))
      -- Para deixar em utilizavel a storage para outras coisas
      for monsters, _ in pairs(Config.Monsters) do
      	setPlayerStorageValue(cid, monsters, -1)
      end
      release = 0
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC XML: 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aldo" script="arquivo.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
	<parameters>
		<parameter key="message_greet" value="Olá |PLAYERNAME|, para você ser promoivido precisa passar por uma {mission}, para de uma olhada no que fazer diga {lista} ."/>
	</parameters>
</npc>




É isso pessoal, 15 votos finaliza, boa sorte aos desafiantes.

Link para o post
Compartilhar em outros sites

Meu voto, vai no segundo, porque, para mim, ele apresenta uma boa estrutura e configuração, foi bom ter feito uma talkaction, assim podendo informar o player quantos kills ele já tem.

 

Só acho que poderia mudar isso:

taskConfig = {
    price = 25000000,
    vocation = 9,
    task = {
        ["Demon"] = {count = 500, storage = 9812},
        ["Hydra"] = {count = 500, storage = 9813},
        ["Rat"] = {count = 1000, storage = 9814},
    },
    storage = 9810,
}

Para isso:
 

taskConfig = {
    price = 25000000,
    vocation = 9,
    storage = 9810,
    task = {
        ["Demon"] = {count = 500, storage = 9812},
        ["Hydra"] = {count = 500, storage = 9813},
        ["Rat"] = {count = 1000, storage = 9814},
    },
}

Acho que listas deveriam vir no final de uma configuração.

 

Além disso, acho que só um atendeu o que eu pensei que deveria ter sido feito, o terceiro script, que é setar uma nova vocação de acordo com a vocação atual do jogador, mesmo assim, meu voto continua no segundo.

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Link para o post
Compartilhar em outros sites

O segundo mostrou que sabe muito de Lua mas o jeito que ele fez isso foi fazendo cálculos desnecessários pro sistema e cometendo alguns erros bobos, o terceiro pra descobrir se o monstro era summon, pegou todos os players online e percorreu as tabelas de summons deles, o primeiro usou variáveis gigantes e em letra maiscula, kde as boas práticas de programação? Fora que você invocou o npc handler system e simplesmente não usou ele via xml porque todos os comandos estão em .lua; Com isso sobra o quarto que não checou se os monstros eram summon e não tem conhecimento de que é só formatar a codificação e escrever normal com acentos, não precisava fazer esse rolê todo.

Voto final: terceiro, embora ele tenha cometido alguns erros, ainda ficou melhor que os outros colocados

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites

eu gostei bastante do primeiro script pelo fato de seu código estar bem divido e de fácil configuração.

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Mesmo sem entender muito do assunto, deu pra notar que o 3º alem de bem explicado, seguiu todos os critérios. 
Meu voto, 3º :D

                                                                                                230x230.jpg

 

Link para o post
Compartilhar em outros sites
  • 4 weeks later...

Não sei se o evento ainda está rolando, mas como o tópico está aberto, vou assumir que sim...

 

Voto no script 3 pela organização do código.

 

ps: editei meu post pois, por algum motivo, eu não conseguia ver todos os posts do tópico nas paginas 1 e 2, e por isso, não vi que a primeira votação já tinha acabado... mesmo assim, o voto vai para o 3 mesmo.

Editado por Demonbholder (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Eu acho que não era necessário ter criado uma lib para algo assim.

Mesmo assim voto no 3º. Está bem tranquilo de entender o código.

E essa parte foi foda!

-- verificando se não é summon

Depois, lendo e analisando os comentários fui reparar no código..

por que diabos puxou os summons de todos online? '-'

Ninguém pensa em como postar algo anti-ratos! ushauhsua

 

Meu voto é no 3º.

Editado por Milbradt (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Meu voto vai para o 3º código, por estar bem comentado e de fácil entendimento para uma pessoa leiga.

Scripter: |||||||||| 10%

 

 

Te ajudei?? REP + e ficamos quites...  ;D

 

Atenciosamente,

                   Lucas.

Abraços!

Link para o post
Compartilhar em outros sites

Script1 de MaTTch = 1 votos
Script2 de zipter98 = 4 votos
Script3 de elton123 = 8 votos
Script4 de Flavio S = 0 votos
Total 13 votos.

 

Obrigado aos desafiantes, aos que votaram e parabéns ao novo rei elton123.

 

Você tem o prazo de 48 horas para escolher o novo tema. :bleh:

Link para o post
Compartilhar em outros sites
obrigado todos que participaram e os que votaram
eu não vou fazer q nem os antecessor
o novo tema eu msm tive a ideia vai ser assim
 
evento 1x1 com aposta
funciona assim:

entre dois player
o player 1 diz aposta diz um valor x
e o player 2 diz aposta diz um valor y
se os valor x e y for iguis um deles puxa alavanca
e vai para arena qual vencer ganhar oque foi apostado
com msg etc TFS 0.4
todos tem 72 horas para enviar o script para: [email protected] (scripts fora do tema serão desclassificados e cada membro só pode enviar um script).
 
TFS 0.4
Editado por elton123 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Mathwsz
      Bom galera, estou trazendo um script de fusão que funciona assim:
      Explicação: É necessário de 7 itens, na qual você coloca em tal coordenada e aperte a alavanca, sendo assim formando um item na qual você deseja em tal lugar configurado.
      Exemplo: Você pode fazer 7 bosses na qual dropa tals itens "Parecidos" e formando um item raro de sua escolha, ou como preferir.. Vamos ao script!
       
      Em Data/Actions/Scripts crie um arquivo chamado fusaoitens.lua e adicione isto dentro:
       
       
      Agora, em Data/Actions.xml adicione o seguinte:
       
      <action uniqueid="9900" script="fusaoitens.lua" /> E no seu RemeresMapEditor , pegue sua alavanca, vai em Propriedades e adicione o UniqueID 9900 nele! 
      PRONTO! Agora configure e divirta-se! Obs: Caso lhe ajudei, da um REP+ Aí !
    • Por Wend
      Olá Pessoal  
       
      Sou novo no fórum e queria sabe Onde tem as Funções das scripts.lua? 
      se For possivel explicando Cada uma *--* 
       
      Vallew e Rep+ para quem mim passa
    • Por jhonfreitas
      Olá, estou com a seguinte problema.
      como sou um noob inutil em mexer com scripts sempre faço erros desse tipo.   

      E é assim que esta o script.


       
      Eu peguei esse Outfits com Attributes de um post do Kimoszin. Ja que o ultimo post la foi de 2012, evitei de reviver um topico   
      Se quiser checar lá.    http://www.tibiaking.com/forum/topic/9273-outfits-com-attributes/
       
      Por fim se alguém puder me ajudar é Rep+   
       
      Se quiser baixar pra conferir e encontrar o problema > outfits.xml
    • Por pabloxp
      gostaria que alguem me ajuda-se!! queria 1 sistema ou script que o trenó (Sled) se movimentase qnd o char fica-se em cima dele e ele controlase o trenó para as direçoes segurando CTRL + a direção desejada
      +rep pra qm ajudar
    • Por Jose Peterson
      Queria um script para o meu New Slayer Yurots 8.60.
      Um Script onde eu poderia adicionar vocação nas outfits, como no NaruTibia e outros server do tipo.
      Exemplo: Player Knight só pode usar a outfit Knight e mais nenhuma outra, e tambem nemhuma outra vocação pode usar a outfit knight além dó própio
      Eu procurei pelo TibiaKing e achei tópicos onde eles falavam de Storages, Quest="xxxx" ... Só que nemhum deles deu certo, se alguem tiver uma ajuda e poder explicar sobre essesStorages e Quests ... Ajuda ae galera
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo