Ir para conteúdo
  • 0

Bug No Npc De Promotion


Allannet

Pergunta

É o seguinte, eu estou tentando fazer um NPC que dá segunda promotion. Mais tá dando erro e eu não sei o que pode ser

Minha pasta Vocations.xml

 

<?xml version="1.0" encoding="UTF-8"?>

 

<vocations>

 

<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="15" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="100" manamultiplier="4.0" attackspeed="1000" 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="Mago" description="a Mago" needpremium="0" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="50" gainmanaticks="2" gainmanaamount="75" manamultiplier="1.1" attackspeed="700" 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="Druida" description="a Druida" needpremium="0" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="50" gainmanaticks="2" gainmanaamount="75" manamultiplier="1.1" attackspeed="700" 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="Paladino" description="a Paladino" needpremium="0" gaincap="6" gainhp="29" gainmana="38" gainhpticks="2" gainhpamount="65" gainmanaticks="2" gainmanaamount="65" manamultiplier="1.4" attackspeed="700" 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="Guerreiro" description="a Guerreiro" needpremium="0" gaincap="7" gainhp="37" gainmana="20" gainhpticks="2" gainhpamount="75" gainmanaticks="3" gainmanaamount="200" manamultiplier="3.0" attackspeed="500" 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="Mago Master" description="a Mago Master" needpremium="1" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="50" gainmanaticks="2" gainmanaamount="75" manamultiplier="1.1" attackspeed="650" soulmax="100" gainsoulticks="120" 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="Druida Lider" description="an Druida Lider" needpremium="1" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="50" gainmanaticks="2" gainmanaamount="75" manamultiplier="1.1" attackspeed="650" soulmax="100" gainsoulticks="120" 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="Paladino Real" description="a Paladino Real" needpremium="1" gaincap="6" gainhp="29" gainmana="38" gainhpticks="2" gainhpamount="65" gainmanaticks="2" gainmanaamount="65" manamultiplier="1.4" attackspeed="650" soulmax="100" gainsoulticks="120" 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="Guarda" description="an Guarda" needpremium="1" gaincap="7" gainhp="37" gainmana="20" gainhpticks="2" gainhpamount="75" gainmanaticks="3" gainmanaamount="200" manamultiplier="3.0" attackspeed="300" soulmax="500" gainsoulticks="120" fromvoc="4" 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.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="Mago Supremo" description="an Mago Supremo" needpremium="0" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="600" gainmanaticks="2" gainmanaamount="1900" manamultiplier="1.1" attackspeed="630" soulmax="100" gainsoulticks="15" fromvoc="5" 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="Druida Supremo" description="an Druida Supremo" needpremium="0" gaincap="5" gainhp="15" gainmana="48" gainhpticks="2" gainhpamount="600" gainmanaticks="2" gainmanaamount="1900" manamultiplier="1.1" attackspeed="630" soulmax="100" 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="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="Paladino Supremo" description="an Paladino Supremo" needpremium="0" gaincap="6" gainhp="29" gainmana="38" gainhpticks="3" gainhpamount="1200" gainmanaticks="2" gainmanaamount="1300" manamultiplier="1.4" attackspeed="630" soulmax="100" 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.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="Guerreiro Supremo" description="an Guerreiro Supremo" needpremium="0" gaincap="7" gainhp="37" gainmana="20" gainhpticks="2" gainhpamount="1900" gainmanaticks="3" gainmanaamount="600" manamultiplier="3.0" attackspeed="490" soulmax="100" 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.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

-->

</vocations>

 

------------------------------------------

 

 

 

Eu acho que o problema e ai e não no script do npc, porque ele promove o player, mais a vocação fica bugada

Quando eu do look em alguem que comprou segunda promotion fica assim: 20:09 You see yourself. You are .

 

No executador aparece o seguinte erro quando alguem compra promotion: [Warning - Vocations: getvocation] Vocation 9 not found.

 

O que eu fiz de errado?

 

Script do NPC Que dá segunda promotion

 

 

local focus = 0

local talk_start = 0

local target = 0

local days = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talk_start = 0

end

end

 

 

function onCreatureTurn(creature)

 

end

 

 

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

 

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ! I sell second promotion.')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry,! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'promotion') or msgcontains(msg, 'second promotion') then

if getPlayerVocation(cid) > 8 then

selfSay('Sorry, you are already promoted.')

talk_state = 0

elseif getPlayerLevel(cid) < 600 then

selfSay('Sorry, you need level 600 to buy second promotion.')

talk_state = 0

elseif not isPremium(cid) then

selfSay('Sorry, you must be premium to buy second promotion.')

talk_state = 0

else

selfSay('Do you want to buy promotion for 5kk?')

talk_state = 1

end

 

elseif msgcontains(msg, 'premium') or msgcontains(msg, 'premmy') then

selfSay('Do you want to buy 7 days of premium for 7k?')

talk_state = 2

 

elseif talk_state == 1 then

if msgcontains(msg, 'yes') then

if pay(cid,5000000) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

selfSay('You are now promoted!')

else

selfSay('Sorry, you do not have enough money.')

end

end

talk_state = 0

 

elseif talk_state == 2 then

if msgcontains(msg, 'yes') then

if pay(cid,7000) then

selfSay('/premium '.. creatureGetName(cid) ..', 7')

selfSay('You have 7 days of premium more!')

else

selfSay('Sorry, you do not have enough money.')

end

end

talk_state = 0

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

focus = 0

talk_start = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Acho que você não precisa mudar no fromvoc, já que o script verifica se a vocation id é maior que a 8. Então edite nas vocações a partir de 9 <vocation id="9" name="Mago Supremo" ------------- fromvoc="5" lessloss="50">, mudando para fromvoc="1" e veja se funciona. Vlw, espero ter ajudado.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...