Ir para conteúdo

Featured Replies

  • Respostas 25
  • Visualizações 1.4k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Adriano SwaTT
    Adriano SwaTT

    Já tem esta opção nos servidores acima de 8.6 (se não me engano).   No próprio items.xml você adiciona estes atributos ao item. Como por exemplo a Focus Cape, que adiciona ML ao player, vejamos com

  • Mas isso não especifica e nem dá atributos de acordo com vocação... né ?    dá pra qualquer um que usar...

  • Mas ele não quer limitar os players que usam.   e sim, dar atributos de acordo com a vocação do usuário.     Dá pra fazer , mas o do look será complicado.   seria ruim se: colocasse na descr

Posted Images

Postado

Na verdade encontrei o erro, tente usar este:

 

local mages = {1, 2, 5, 6}
local paladins = {3, 7}
local knights = {4, 8}
local addml = 2 -- quantidade de ML à adicionar aos mages
local addskill = 2 -- quantidade de skill adicionar aos guerreiros (pally e knights)

function onEquip(cid, item, slot)
    if isInArray(mages, getPlayerVocation(cid)) then
        doPlayerAddMagLevel(cid, addml)
    elseif isInArray(knights, getPlayerVocation(cid)) then
        for b = 1, 4 do
        doPlayerAddSkill(cid, b, addskill)
        end
    elseif isInArray(paladins, getPlayerVocation(cid)) then
        doPlayerAddSkill(cid, 5, addskill)
    end
return true
end

function onDeEquip(cid, item, slot)
    if isInArray(mages, getPlayerVocation(cid)) then
        doPlayerAddMagLevel(cid, - addml)
    elseif isInArray(knights, getPlayerVocation(cid)) then
        for b = 1, 4 do
        doPlayerAddSkill(cid, b, - addskill)
        end
    elseif isInArray(paladins, getPlayerVocation(cid)) then
        doPlayerAddSkill(cid, 5, - addskill)
    end
return true
end

 

O do look ficou assim:

Registre em CreatureScripts.xml esta tag:

<event type="look" name="ItemsDescription" event="script" value="items_descr.lua"/>

 

Registre também em login.lua a tag abaixo junto com as do gênero:

registerCreatureEvent(cid, "ItemsDescription")

 

Este é o arquivo items_descr.lua na pasta Scripts (Creaturescripts).

local mages = {1, 2, 5, 6}
local paladins = {3, 7}
local knights = {4, 8}
local items = {
[2456] = {2, 5}, -- [ItemID] = {ml, skills}
[2457] = {3, 6} -- ItemID
}

function onLook(cid, thing, pos, dist)
local voc = getPlayerVocation(cid)
local check = items[thing.itemid]

    if isPlayer(thing) then
    return true
    end
    
    if check then
        if isInArray(mages, voc) then
            local string = 'Increase + '..check[1]..' magic level.'
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
        elseif isInArray(knights, voc) then
            local string = 'Increase + '..check[2]..' skills for a knight.'
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
        elseif isInArray(paladins, voc) then
            local string = 'Increase + '..check[2]..' skills for a paladins.'
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
        end
    end
return true
end

 

Boa sorte.

Postado
  • Autor

Deu mais ou menos, ele add 6 de ml quando coloca o equipe, mas n tira o ml quando retiro o equipe... kkkkkk

E ficou dando erro, dai coloquei:

		<!-- Elfic Helmet -->
		<movevent type="Equip" itemid="2490" slot="head" event="script" value="elfichelmet.lua"/>
		<movevent type="DeEquip" itemid="2490" slot="head" event="script" value="elfichelmet.lua"/>

Tirei o "on" de "equip" ai pegou...

 

Modifiquie o script, dai ele muda 3 de ml (sendo q coloquei para mudar 1) e não sai quando retiro o equipe...

function onEquip(cid, item, slot)
		if getPlayerVocation(cid) == 1 then
			doPlayerAddMagLevel(cid, 1)
		elseif getPlayerVocation(cid) == 2 then
			doPlayerAddMagLevel(cid, 1)
		elseif getPlayerVocation(cid) == 3 then
			doPlayerAddSkill(cid, 5, 1)
		elseif getPlayerVocation(cid) == 4 then
			doPlayerAddSkill(cid, 1, 1)
		elseif getPlayerVocation(cid) == 5 then
			doPlayerAddMagLevel(cid, 1)
		elseif getPlayerVocation(cid) == 6 then
			doPlayerAddMagLevel(cid, 1)
		elseif getPlayerVocation(cid) == 7 then
			doPlayerAddSkill(cid, 5, 1)
		elseif getPlayerVocation(cid) == 8 then
			doPlayerAddSkill(cid, 1, 1)
		end
	return TRUE
end
function onDeEquip(cid, item, slot)
		if getPlayerVocation(cid) == 1 then
			doPlayerAddMagLevel(cid, -1)
		elseif getPlayerVocation(cid) == 2 then
			doPlayerAddMagLevel(cid, -1)
		elseif getPlayerVocation(cid) == 3 then
			doPlayerAddSkill(cid, 5, -1)
		elseif getPlayerVocation(cid) == 4 then
			doPlayerAddSkill(cid, 1, -1)
		elseif getPlayerVocation(cid) == 5 then
			doPlayerAddMagLevel(cid, -1)
		elseif getPlayerVocation(cid) == 6 then
			doPlayerAddMagLevel(cid, -1)
		elseif getPlayerVocation(cid) == 7 then
			doPlayerAddSkill(cid, 5, -1)
		elseif getPlayerVocation(cid) == 8 then
			doPlayerAddSkill(cid, 1, -1)
		end
	return TRUE
end

Editado por Gibion (veja o histórico de edições)

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo