Bom no meu otserv e um seguinte acontece o seguinte problema ,eu crie 4 vocaçoes vip
com npc de segunda promotion . mas só que quando o player que possui a segunda promotion morre ele muda de vocação sozinho , por exemplo sou EK(VIP) , se eu morre passo pra MS , sozim automaticamente tem como arrumar essa bagunça?
espero que me ajudem ...
Meu servidor e mysql , 8.60 , mapa alissow .totalmente reformulado,mexo a 2 anos com otserv!
Vo postar aque tudo oque eu uso pra facilitar a voces para poderem me ajudarem!
data/xml/vocations;
<?xml version="1.0" encoding="UTF-8"?> <vocations> <vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2100" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="20" gainmanaticks="2" gainmanaamount="30" manamultiplier="1.1" attackspeed="400" soulmax="100" gainsoulticks="120" fromvoc="1"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="20" gainmanaticks="2" gainmanaamount="30" manamultiplier="1.1" attackspeed="400" soulmax="100" gainsoulticks="120" fromvoc="2"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="1" gainhpamount="30" gainmanaticks="2" gainmanaamount="30" manamultiplier="1.4" attackspeed="400" soulmax="100" gainsoulticks="120" fromvoc="3"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="30" gainmanaticks="2" gainmanaamount="20" manamultiplier="3.0" attackspeed="400" soulmax="100" gainsoulticks="120" fromvoc="4"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="40" gainmanaticks="2" gainmanaamount="60" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="6" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="40" gainmanaticks="2" gainmanaamount="60" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="1" gainhpamount="50" gainmanaticks="2" gainmanaamount="50" manamultiplier="1.4" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="8" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="60" gainmanaticks="2" gainmanaamount="40" manamultiplier="3.0" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.1" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="9" name="Master Sorcerer Vip" description="a master sorcerer (Vip)" needpremium="1" gaincap="10" gainhp="10" gainmana="50" gainhpticks="1" gainhpamount="80" gainmanaticks="2" gainmanaamount="120" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="6" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="10" name="Elder Druid Vip" description="a elder druid (Vip)" needpremium="1" gaincap="10" gainhp="10" gainmana="50" gainhpticks="1" gainhpamount="80" gainmanaticks="2" gainmanaamount="120" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="7" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/> </vocation> <vocation id="11" name="Royal Paladin Vip" description="a royal paladin (Vip)" needpremium="1" gaincap="20" gainhp="20" gainmana="25" gainhpticks="1" gainhpamount="100" gainmanaticks="2" gainmanaamount="100" manamultiplier="1.4" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="8" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="12" name="Elite Knight Vip" description="a elite knight (Vip)" needpremium="1" gaincap="25" gainhp="30" gainmana="10" gainhpticks="1" gainhpamount="120" gainmanaticks="2" gainmanaamount="80" manamultiplier="3.0" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="9" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/> </vocation> <vocation id="13" name="Elite Kitranda" description="a Kitranda (Vip)" needpremium="1" gaincap="10" gainhp="20" gainmana="20" gainhpticks="1" gainhpamount="120" gainmanaticks="2" gainmanaamount="80" manamultiplier="3.0" attackspeed="550" soulmax="200" gainsoulticks="15" fromvoc="10" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="2.0" club="1.2" sword="1.6" axe="1.5" distance="1.5" shielding="1.3" fishing="1.1" experience="1.0"/> </vocation> <vocation id="14" name="Supreme Kitranda" description="a Supreme Kitranda (Vip)" needpremium="1" gaincap="15" gainhp="30" gainmana="30" gainhpticks="1" gainhpamount="120" gainmanaticks="2" gainmanaamount="60" manamultiplier="3.0" attackspeed="550" soulmax="200" gainsoulticks="15" fromvoc="10" lessloss="50"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="2.0" club="1.1" sword="1.5" axe="1.6" distance="1.5" shielding="1.3" fishing="1.1" experience="1.0"/> </vocation> </vocations>
bom ta ae , agora npc que ativa a vocação;
<?xml version="1.0"?> <npc name="King Arthas III" script="data/npc/scripts/alissow.lua" walkinterval="5000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. voce quer uma {promote} para ficar mais forte!" /> </parameters> </npc>
Agora o script do npc que ativa a vocação;
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 vocations = { [5]= {new_voc = 9,price = 50000,cobrar = true,level = 50,need_level = true}, -- voc 5 para 9 [6]= {new_voc = 10,price = 50000,cobrar = true,level = 50,need_level = true}, -- voc 6 para 10 [7]= {new_voc = 11,price = 50000,cobrar = true,level = 50,need_level = true}, -- voc 7 para 11 [8]= {new_voc = 12,price = 50000,cobrar = true,level = 50,need_level = true}, -- voc 8 para 12 [13]= {new_voc = 14,price = 100000,cobrar = true,level = 60,need_level = true} -- voc 13 para 14 } local voc = vocations[getPlayerVocation(cid)] if(msgcontains(msg, 'promote') or msgcontains(msg, 'promotion')) then if(not voc) then selfSay('Desculpe,Você deve ter a primeira promotion para falar comigo', cid) talkState[talkUser] = 0 else selfSay('Você deseja ser promovido para 2° promotion? {yes} ', cid) talkState[talkUser] = 1 end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if voc.need_level == true and getPlayerLevel(cid) < voc.level then selfSay('Desculpe,Você não tem level ' .. voc.level .. ' ou mais para ser promovido', cid) talkState[talkUser] = 0 else if voc.cobrar == true and doPlayerRemoveMoney(cid, voc.price) == FALSE then selfSay('Desculpe,Você não tem ' .. voc.price .. ' gps para ser promovido', cid) talkState[talkUser] = 0 else doPlayerSetVocation(cid,voc.new_voc) selfSay('Parabens,Você Foi promovido para ' .. getVocationInfo(getPlayerVocation(cid)).name .. ' promotion', cid) talkState[talkUser] = 0 end end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("ok, fale dinovo mais tarde", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Bom ta ae postei com clareza tudo certinho espero que tire minha duvida !
servidor ;mysql protocolo ;8.60 ;experiencia 2 anos !
:XTibia_smile:
Aguardando.......................................