Postado Fevereiro 9, 2018 7 anos Pessoal, estou atrás de um NPC que promova o personagem da vocação x para vocação y e que resete o char para level 8 com 185 de vida e 35 de mana! Alguém sabe fazer?
Postado Fevereiro 13, 2018 7 anos 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 x = 2 -- Id da vocação necessaria pra promote local y = 3 -- Id da voc de promote local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 then if getPlayerVocation(cid) == x then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the vocation', cid) end else selfSay('You have already been promoted', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Fevereiro 13, 2018 7 anos Autor 2 minutos atrás, Sttorm disse: 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 x = 2 -- Id da vocação necessaria pra promote local y = 3 -- Id da voc de promote local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 then if getPlayerVocation(cid) == x then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the vocation', cid) end else selfSay('You have already been promoted', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Vou testar e já respondo! OBS: como eu faço para adicionar mais vocações? ex: vocs: 5,6,7,8 para as promotes:9,10,11 e 12? a Vocation 5 vai pra 9, 6 para a 10 e assim por diante
Postado Fevereiro 13, 2018 7 anos 2 minutos atrás, Yamborghini disse: Vou testar e já respondo! OBS: como eu faço para adicionar mais vocações? ex: vocs: 5,6,7,8 para as promotes:9,10,11 e 12? a Vocation 5 vai pra 9, 6 para a 10 e assim por diante Criando um npc para cada promote.
Postado Fevereiro 13, 2018 7 anos 2 horas atrás, Yamborghini disse: Vou testar e já respondo! OBS: como eu faço para adicionar mais vocações? ex: vocs: 5,6,7,8 para as promotes:9,10,11 e 12? a Vocation 5 vai pra 9, 6 para a 10 e assim por diante voce pode fazer dessa forma: 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 x = {1,2} -- Ids das vocaçoes necessarias pra promote. para adicionar mais, basta por uma virgula dps do ultimo numero e adicionar a id da voc local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar local v = getVocationInfo(getPlayerVocation(cid)) if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 then if isInArray(x, getPlayerVocation(cid)) then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setPlayerPromotionLevel(cid, v.id + 4) -- aqui o sistema pega a vocação atual e adicona a proxima (v.id + 4). assim, basta adicionar a voc base na variavel x. setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 4200 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the required vocation', cid) end else selfSay('You have already been promoted', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) no outro codigo, nao havia a função para promover o jogador e seriam necessarios npcs diferentes pra cada voc. com esse, um unico npc pode promover qlqr personagem desde que a vocação dele seja guardada na variavel x.
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.