Ir para conteúdo

Featured Replies

Postado

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

Ex. TFS 1.3;

Base: TFS 1.3

 

 

Qual erro está surgindo/O que você procura?

Um script onde a vocação determinada não pode atacar X monster e nem o monster pode atacar essa vocação.

 

Exe:  O player com a vocação Dwarf não pode atacar nenhum monster Dwarf.

 

  • 2 weeks later...
Postado

Adicione essa função em data/events/scripts/creature.lua

 

Spoiler

function checkCombat(creature, target)
    -- ID da vocação seguido dos monstros "amigos"
	local vocations = {
		[0] = {"Skeleton"},
		[1] = {"Dwarf"},
		[2] = {"Dragon"},
		[3] = {"Rat"},
		[4] = {"Demon"}
	}

	if creature:isPlayer() and target:isPlayer() then
		return RETURNVALUE_NOERROR
	end

	if not creature:isPlayer() and target:isPlayer() then
		for _, value in pairs(vocations[target:getVocation():getId()]) do
			if value == creature:getName() then
				return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
			end
		end
	end

	if not target:isPlayer() and creature:isPlayer() then
		for _, value in pairs(vocations[creature:getVocation():getId()]) do
			if value == target:getName() then
				return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
			end
		end
	end

	return RETURNVALUE_NOERROR
end

 

 

E substitua a função Creature:onTargetCombat(target) por esta

 

Spoiler

function Creature:onTargetCombat(target)
	return checkCombat(self, target)
end

 

 

Não cheguei a testar com combate em área

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo