Spraypaint 14 Postado Junho 30, 2012 Share Postado Junho 30, 2012 (editado) Funcional em: TFS 8.6 DEV 0.4 (REV3884)Esse npc não foi criando somente por mim eu apenas aperfeiçoei e coloquei novas funções tirando também diversos bugs que atrapalhavam seu funcionamento. Em data/npc coloque: <?xml version="1.0"?><npc name="Resetador" script="data/npc/scripts/reseter.lua" walkinterval="0" floorchange="0"><health now="100" max="100"/><look type="133" head="10" body="122" legs="19" feet="10"/><parameters><parameter key="message_greet" value="Ola, |PLAYERNAME|. Eu posso {resetar} seu level. "/></parameters></npc> Crie um arquivo .lua em data\npc\scripts e coloque -- configlocal minlevel = 50 -- level inical para resetarlocal price = 1000 -- preço inicial para resetarlocal newlevel = 8 -- level após resetlocal newexp = 4200 -- nova experiencia após resetlocal lvlByReset = 50 -- level acrescentado por resetlocal priceByReset = 100 -- preço acrescentado por resetlocal maxResets = 100 -- máximo de resets-- end configfunction addReset(cid)resets = getResets(cid)setPlayerStorageValue(cid,1020,resets+1)return trueendfunction getResets(cid)resets = getPlayerStorageValue(cid,1020)if resets < 0 thenresets = 0endreturn resetsendlocal keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cidlocal needlvl = minlevel + (getResets(cid) * lvlByReset)local newPrice = price + (getResets(cid) * priceByReset)if msgcontains(msg, 'resetar') thenif getResets(cid) < maxResets thenselfSay('Voce deseja reset seu char? Isto custará '..newPrice..' gp\'s!', cid)talkState[talkUser] = 1elseselfSay('Você ja alcançou seu limite de resets!', cid)endelseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) thenif getPlayerMoney(cid) < newPrice thenselfSay('É Necessario ter '..newPrice..' gp\'s para resetar!', cid)elseif getPlayerLevel(cid) < needlvl thenselfSay('O level minimo para reset é '..needlvl..'!', cid)elsedoPlayerRemoveMoney(cid,newPrice)if isInArray(vocs, getPlayerVocation(cid)) thendoPlayerSetVocation(cid, getPlayerVocation(cid)+4)endaddReset(cid)playerid = getPlayerGUID(cid)doRemoveCreature(cid)db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")endtalkState[talkUser] = 0elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) thentalkState[talkUser] = 0selfSay('Ok.', cid)elseif msgcontains(msg, 'quant') thenselfSay('Voce tem um total de '..getResets(cid)..' reset(s).', cid)endreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Creditos pelo npc base:@nubinhoQualquer duvida postem ai abaixo! Editado Agosto 4, 2012 por Spraypaint Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/ Compartilhar em outros sites More sharing options...
Vinc 101 Postado Junho 30, 2012 Share Postado Junho 30, 2012 deu bug na formatação,algums sinais como "<",">" e outros bugaram,arrume Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1286529 Compartilhar em outros sites More sharing options...
Spraypaint 14 Postado Junho 30, 2012 Autor Share Postado Junho 30, 2012 Tente agora ! Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1286544 Compartilhar em outros sites More sharing options...
Vinc 101 Postado Junho 30, 2012 Share Postado Junho 30, 2012 eu n testei.eu apenas avisei, por que estava visivel. e nem testarei Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1286747 Compartilhar em outros sites More sharing options...
LuncV 0 Postado Julho 23, 2012 Share Postado Julho 23, 2012 'then' expected near '&' error Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1298716 Compartilhar em outros sites More sharing options...
lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 Aqui está -- SCRIPT FEITO POR YUNIE -- config minlevel = 400 -- level para resetar price = 0 newlevel = 10 -- level após reset newexp = 9300 -- nova experiencia após reset -- end config function addReset(cid) resets = getResets(cid) setPlayerStorageValue(cid,36874,resets+1) return true end function getResets(cid) resets = getPlayerStorageValue(cid,36874) if resets < 0 then resets = 0 end return resets end 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, 'reset') then selfSay('Do you want to reset your character level? Your character will be logged off if you confirm. You must pay '..price..' gold coins to reset.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerMoney(cid) < price then selfSay('You must pay '..price..' gold coins to reset.', cid) elseif getPlayerLevel(cid) < minlevel then selfSay('You must be at least level '.. minlevel ..' to reset.', cid) else doPlayerRemoveMoney(cid,price) addReset(cid) playerid = getPlayerGUID(cid) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) elseif msgcontains(msg, 'quant') then selfSay('You have '..getResets(cid)..' reset(s).', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1300528 Compartilhar em outros sites More sharing options...
gab3690 0 Postado Julho 28, 2012 Share Postado Julho 28, 2012 Tem como colocar quando resetar muda a vocaçao Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1303010 Compartilhar em outros sites More sharing options...
Plfmoura 6 Postado Julho 31, 2012 Share Postado Julho 31, 2012 Ta dando erro aqui -' / fexa o Ot quando o player vai falar com o NPC Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1306310 Compartilhar em outros sites More sharing options...
Spraypaint 14 Postado Julho 31, 2012 Autor Share Postado Julho 31, 2012 Eu acho que em tfs não roda eu estava testando ele em Forgu~ Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1306321 Compartilhar em outros sites More sharing options...
Spraypaint 14 Postado Agosto 4, 2012 Autor Share Postado Agosto 4, 2012 (editado) Eu refiz alguns testes aqui o script ta funcionando em TFS 8.6 DEV 0.4 (REV3884)+ ...100% @up Refiz o topico!Agora ficara mais facil abrçs Editado Agosto 4, 2012 por Spraypaint Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1308712 Compartilhar em outros sites More sharing options...
DavyziinC 1 Postado Agosto 13, 2013 Share Postado Agosto 13, 2013 Como faz pra reseta o magic level também? Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1550610 Compartilhar em outros sites More sharing options...
gustavo3754 55 Postado Novembro 12, 2013 Share Postado Novembro 12, 2013 Teria como colocar para trocar a vocação? E não só com um personagem mais com varios. Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1581417 Compartilhar em outros sites More sharing options...
DBWBrasil 0 Postado Novembro 12, 2013 Share Postado Novembro 12, 2013 CrazzyMaster 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 local config = { --[Vocation] = ( Nova Vocation, New Outfit ) [8] = { 9, 137}, [19] = { 20, 198}, [30] = { 31, 565}, [41] = { 42, 565} } 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, 'reborn') and getPlayerStorageValue(cid,30025) == 4 then selfSay('You are reborn.', cid) focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then selfSay('Hmm, Desculpe. Você não tem level 250.', cid) elseif msgcontains(msg, 'reborn') then selfSay('Are you sure? {yes}', cid) talkState[talkUser] = 2 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 and getPlayerLevel(cid) >= 250 then local voc = config[getPlayerVocation(cid)] doPlayerSetVocation(cid, voc[1]) local outfit = {lookType = voc[2]} doCreatureChangeOutfit(cid, outfit) doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1))) setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+20000) setCreatureMaxMana(cid, getCreatureMaxMana(cid)+30000) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) setPlayerStorageValue(cid,30025,4) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Voce precisa reverter ou transformar para rebornar.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye.', cid) focus = 0 talk_start = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) <npc name="Reborn" script="data/npc/scripts/reborn.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1"> <health now="100" max="100"/> <look type="118" head="57" body="59" legs="40" feet="76" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. Reborn!" /> </parameters> </npc> Espero que isso ajude. Link para o comentário https://xtibia.com/forum/topic/188968-npc-resetador/#findComment-1581421 Compartilhar em outros sites More sharing options...
Posts Recomendados