Raidou 16 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 Bom pessoal,estou com uma dúvida,estou criando um WoDBO 8.54,e peguei este NPC que o Beeki,postou aki no XTibia. Reborn.LUA 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) ~= 250 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) Reborn.XML <?xml version="1.0" encoding="UTF-8"?> <npc name="Reborn" script="data/npc/scripts/Reborn.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="143" head="78" body="82" legs="120" feet="94" addons="1"/> </npc> Mas,qual a minha dúvida? Bom,queria que o player so poderá rebornar se for 250 ou maior. Obrigado. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/ Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 Já está configurado para reborn apenas 250 ou maior. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336786 Compartilhar em outros sites More sharing options...
0 Raidou 16 Postado Setembro 11, 2012 Autor Share Postado Setembro 11, 2012 (editado) Tem certeza? Vou tentar aki e ja edito. @Edit Não funfo man,no jogo eu falo assim. hi reborn yes Dai o NPC fala que eu n tenho level 250. Editado Setembro 11, 2012 por Raidou Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336902 Compartilhar em outros sites More sharing options...
0 gustavo3754 55 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 Reborn.lua 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) >= 250 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) to fora uns tempo ate me arrumar.. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336916 Compartilhar em outros sites More sharing options...
0 Raidou 16 Postado Setembro 11, 2012 Autor Share Postado Setembro 11, 2012 Reborn.lua 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) >= 250 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) to fora uns tempo ate me arrumar.. Não funfo amigo. eu to level 300,ele dis que n tenho level 250 Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336931 Compartilhar em outros sites More sharing options...
0 gustavo3754 55 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 Reborn.lua 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) ~= 250 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) to meio em duvida tb.. se o de cima n pegar tenta esse: 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) ~= 250 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336935 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 (editado) Erro no sinal. Tenta assim: 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) <= 249 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) Editado Setembro 11, 2012 por Newtonnotwen Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1336976 Compartilhar em outros sites More sharing options...
0 Raidou 16 Postado Setembro 11, 2012 Autor Share Postado Setembro 11, 2012 Desculpe,amigos.Mais nenhum funcionou. Quando eu falo hi.reborn.yes Nao acontece nada. OBS:Eu sou level 300. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337129 Compartilhar em outros sites More sharing options...
0 LuckOake 400 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 (editado) Testei e funcionou. Tenta ai. 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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') then if getPlayerStorageValue(cid,30025) == 4 then selfSay('You are already reborned.', cid) focus = 0 talk_start = 0 elseif getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then selfSay('Hehe, I say if you are READY. You do not have 250 level.', cid) end selfSay('Are you sure? Say {yes}.', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) < 250 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 end 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) selfSay('You are now reborned.', cid) talkState[talkUser] = 0 end if msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye.', cid) focus = 0 talk_start = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Setembro 11, 2012 por LuckOake Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337136 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 Usa seu script inicial e tenta dar reborn com um level 250, certinho. Se funcionar me fala. Caso contrario acho que o script está errado. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337137 Compartilhar em outros sites More sharing options...
0 Beeki 284 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 esse script ai é mais velho que eu, já fiz outro bem melhor. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337142 Compartilhar em outros sites More sharing options...
0 Raidou 16 Postado Setembro 11, 2012 Autor Share Postado Setembro 11, 2012 Usa seu script inicial e tenta dar reborn com um level 250, certinho. Se funcionar me fala. Caso contrario acho que o script está errado. Amigo,rebornar 250 ele reborna. So que eu quero que ele reborne 250 ou maior.Ou seja se o player for level 400 500,ele pode reborna tbm. esse script ai é mais velho que eu, já fiz outro bem melhor. Poderia me passar? Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337149 Compartilhar em outros sites More sharing options...
0 LuckOake 400 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 (editado) @Raidou Se você não for usar o outro script do Beeki, usa o que eu postei ali em cima, tá funcionando 100%. Testei e funcionou. Tenta ai. 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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') then if getPlayerStorageValue(cid,30025) == 4 then selfSay('You are already reborned.', cid) focus = 0 talk_start = 0 elseif getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then selfSay('Hehe, I say if you are READY. You do not have 250 level.', cid) end selfSay('Are you sure? Say {yes}.', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) < 250 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid) talkState[talkUser] = 0 end 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) selfSay('You are now reborned.', cid) talkState[talkUser] = 0 end if msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye.', cid) focus = 0 talk_start = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Setembro 11, 2012 por LuckOake Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337151 Compartilhar em outros sites More sharing options...
0 theu1995 12 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 (editado) Se não der tente esse ._. >.< 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 ) [21] = { 22, 137}, [254] = { 255, 351}, [36] = { 37, 148}, [51] = { 52, 144}, [65] = { 66, 152}, [378] = { 379, 451}, [80] = { 81, 150}, [93] = { 94, 150}, [107] = { 108, 509}, [118] = { 119, 118}, [131] = { 132, 34}, [144] = { 145, 15}, [155] = { 156, 15}, [167] = { 168, 173}, [179] = { 180, 178}, [191] = { 192, 184}, [205] = { 206, 190}, [217] = { 218, 221}, [229] = { 230, 281}, [242] = { 243, 60}, [254] = { 255, 351}, [265] = { 266, 334}, [275] = { 276, 80}, [286] = { 287, 338}, [296] = { 297, 198}, } 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('Hehe, I say If you READY. You do not have 250 level.', 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('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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()) Editado Setembro 11, 2012 por MaatheeuusYuurii Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337154 Compartilhar em outros sites More sharing options...
0 Raidou 16 Postado Setembro 11, 2012 Autor Share Postado Setembro 11, 2012 Desculpa Lucas,nao funcionou tambem. Eu ponho a vocation 7 para virar a 8. Mais dai no OT,quando falo yes.Nao acontece nada. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337160 Compartilhar em outros sites More sharing options...
0 LuckOake 400 Postado Setembro 11, 2012 Share Postado Setembro 11, 2012 @Raidou Meu nome não é Lucas .-. E eu testei e funfou no meu server, o NPC tirou o level, colocou a outfit e trocou a vocation. Infelizmente, se não funcionou para você, já não posso fazer nada. Link para o comentário https://xtibia.com/forum/topic/193930-854-npc-reborn/#findComment-1337170 Compartilhar em outros sites More sharing options...
Pergunta
Raidou 16
Bom pessoal,estou com uma dúvida,estou criando um WoDBO 8.54,e peguei este NPC que o Beeki,postou aki no XTibia.
Reborn.LUA
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 )
[21] = { 22, 137},
[254] = { 255, 351},
[36] = { 37, 148},
[51] = { 52, 144},
[65] = { 66, 152},
[378] = { 379, 451},
[80] = { 81, 150},
[93] = { 94, 150},
[107] = { 108, 509},
[118] = { 119, 118},
[131] = { 132, 34},
[144] = { 145, 15},
[155] = { 156, 15},
[167] = { 168, 173},
[179] = { 180, 178},
[191] = { 192, 184},
[205] = { 206, 190},
[217] = { 218, 221},
[229] = { 230, 281},
[242] = { 243, 60},
[254] = { 255, 351},
[265] = { 266, 334},
[275] = { 276, 80},
[286] = { 287, 338},
[296] = { 297, 198},
}
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('Hehe, I say If you READY. You do not have 250 level.', 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 getPlayerLevel(cid) ~= 250 then
selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', 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())
Reborn.XML
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reborn" script="data/npc/scripts/Reborn.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="143" head="78" body="82" legs="120" feet="94" addons="1"/>
</npc>
Mas,qual a minha dúvida?
Bom,queria que o player so poderá rebornar se for 250 ou maior.
Obrigado.
Link para o comentário
https://xtibia.com/forum/topic/193930-854-npc-reborn/Compartilhar em outros sites
23 respostass a esta questão
Posts Recomendados