Ir para conteúdo

Featured Replies

Postado

Galera queria que alguem me ajudasse nessa script de aura, tipo, queria por pra essa aura funcionar somente quando o player ataca outro player, ou vice e versa...

Porque essa aura desse script abaixo, ela esta atacando sozinha, queria por pra usar ela somente em player e nao em bixos.

 

Vou posta o script todo dela, e se alguem poder me ajudar agradeço!

 

Entre na pasta data/lib e crie um arquivo chamado configAura.lua e cole o seguinte código:

-- [[ AURA SYSTEM LIB (BY: XXOTSERVXX) ]] --

-- [[ CONFIGURAÇÕES DO NPC ]] --
npc = {
level = 1, -- level para pegar aura (1 para não precisar)
price = 0, -- preço para comprar a aura (0 para ser gratis)
premmy = false, -- precisar ser premium (false para não precisar)
}

-- [[ OUTRAS CONFIGURAÇÕES ]] --
auexchance = 20 -- chance de acontecer uma explosão de aura(maixmo 100)
aurast = 56897 -- storage da aura (troque se ja estiver usando ela) -- [[ AURA SYSTEM LIB (BY: XXOTSERVXX) ]] --

-- [[ CONFIGURAÇÕES DO NPC ]] --
npc = {
level = 1, -- level para pegar aura (1 para não precisar)
price = 0, -- preço para comprar a aura (0 para ser gratis)
premmy = false, -- precisar ser premium (false para não precisar)
}

-- [[ OUTRAS CONFIGURAÇÕES ]] --
auexchance = 20 -- chance de acontecer uma explosão de aura(maixmo 100)
aurast = 56897 -- storage da aura (troque se ja estiver usando ela)

Bom nesse script é onde você vai poder configurar variias coisas do script, é só seguir os comentários no script.

 

 

Continuando na mesma pasta data/lib crie outro arquivo com o nome libAura.lua e cole o seguinte script:

-- [[ FUNÇÕES ]] --
au = {
["fire"] = {ef = {5, 6, 15, 36}, sh = 3, dmg = COMBAT_FIREDAMAGE},
["ice"] = {ef = {41, 42, 43}, sh = 28, dmg = COMBAT_ICEDAMAGE},
["earth"] = {ef = {8, 45, 20}, sh = 29, dmg = COMBAT_EARTHDAMAGE},
["death"] = {ef = {17, 34, 38}, sh = 31, dmg = COMBAT_DEATHDAMAGE},
["holy"] = {ef = {39, 49}, sh = 30, dmg = COMBAT_HOLYDAMAGE},
["energy"] = {ef = {11, 47, 48}, sh = 35, dmg = COMBAT_ENERGYDAMAGE}
}

function isAura(cid)
if type(getPlayerStorageValue(cid, aurast)) == "string" then
	return true
end
return false
end

function addAura(cid, aura)
return setPlayerStorageValue(cid, aurast, aura)
end

function getAura(cid)
return getPlayerStorageValue(cid, aurast)
end

function startAura(cid, aura)
a = au[aura]
if not isCreature(cid) then return true end
doSendMagicEffect(getThingPos(cid), a.ef[math.random(1, #a.ef)])
addEvent(startAura, 2000, cid, aura)
end

arrex = createCombatArea{
{0, 0, 1, 0, 0},
{0, 1, 1, 1, 0},
{1, 1, 2, 1, 1},
{0, 1, 1, 1, 0},
{0, 0, 1, 0, 0}
}

function sendExplosion(cid, aura, model)
rateatk = math.ceil(getPlayerLevel(cid)/2*1,5)
a = au[aura]
min, max = rateatk/2, rateatk
if model == 1 then
	doAreaCombatHealth(cid, a.dmg, getThingPos(cid), arrex, -min, -max, a.ef[math.random(1, #a.ef)])
elseif model == 2 then
	for i = 0, 3 do
		doSendDistanceShoot(getThingPos(cid), getPositionByDirection(getThingPos(cid), i, 1), a.sh)
		doAreaCombatHealth(cid, a.dmg, getPositionByDirection(getThingPos(cid), i, 1), 0, -min, -max, a.ef[math.random(1, #a.ef)])
	end
end
end

function getPositionByDirection(position, direction, size) -- TFS FUNCTION
local n = size or 1
if(direction == NORTH) then
	position.y = position.y - n
elseif(direction == SOUTH) then
	position.y = position.y + n
elseif(direction == WEST) then
	position.x = position.x - n
elseif(direction == EAST) then
	position.x = position.x + n
elseif(direction == NORTHWEST) then
	position.y = position.y - n
	position.x = position.x - n
elseif(direction == NORTHEAST) then
	position.y = position.y - n
	position.x = position.x + n
elseif(direction == SOUTHWEST) then
	position.y = position.y + n
	position.x = position.x - n
elseif(direction == SOUTHEAST) then
	position.y = position.y + n
	position.x = position.x + n
end

return position
end

Neste script não é recomendado mexer a não ser que vc seje um scritper e saiba oque faça.

 

Agora entre na pasta data/creaturescripts/scripts e crie um arquivo chamado creatureAura.lua e cole o seguinte código:

function onStatsChange(cid, attacker, type, combat, value)
if type == STATSCHANGE_HEALTHLOSS then
	if isAura(cid) then
		if math.random(1, 100) < auexchance then
			sendExplosion(cid, getAura(cid), math.random(1, 2))
		end
	end
end
return true
end

function onLogin(cid)
if isAura(cid) then
	startAura(cid, getAura(cid))
end
return true
end

Também não é recomendando mexer

 

continuando nesta mesma pasta (data/creaturescripts/scripts) procure pelo login.lua e no final do script antes do return true end, cole isto:

registerCreatureEvent(cid, "loginAura")
registerCreatureEvent(cid, "statsAura")

 

 

Vá na pasta anterior data/creaturescripts e procure pelo arquivo creaturescripts.xml e adicione as seguintes tags:

<event type="login" name="loginAura" event="script" value="creatureAura.lua"/>
<event type="statschange" name="statsAura" event="script" value="creatureAura.lua"/>

 

 

Agora entre na pasta data/npc e crie um arquivo chamado Npc Aura.xml e cole o seguinte codigo:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Npc Aura" script="npcAura.lua" walkinterval="2000" floorchange="0">
   <health now="100" max="100"/>
   <look type="128" head="55" body="53" legs="42" feet="0" addons="2"/>
   <parameters>
       <parameter key="message_greet" value="Ola, diga {aura} para ver as auras disponiveis."/>
   </parameters>
</npc>

 

 

Entre na pasta data/npc/scripts e crie um arquivo chamado npcAura.lua e cole o seguinte código:

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

   if msgcontains(msg, 'aura') then
               if not isAura(cid) then
                       selfSay('Temos disponiveis as seguintes auras: {fire}, {ice}, {earth}, {death}, {holy} e {energy}, qual você quer aprender ?', cid)
                       talkState = 1
               else
                       selfSay('Você já tem á '..getAura(cid).." aura.", cid)
               end
       elseif isInArray({"fire", "ice", "earth", "death", "holy", "energy"}, msg) and talkState == 1 then
               if getPlayerLevel(cid) < npc.level then
                       return selfSay("Desculpe mais para aprender a aura é preciso level "..npc.level..".")
               end
               if getPlayerMoney(cid) < npc.price then
                       return selfSay("Desculpe mais para aprender a aura é preciso "..npc.price.."gps.")
               end
               if not isPremium(cid) and npc.premmy then
                       return selfSay("Desculpe mais para aprender a aura é preciso ser premium.")
               end
               addAura(cid, msg)
               startAura(cid, getAura(cid))
               doPlayerRemoveMoney(cid, npc.price)
               selfSay("Você acaba de receber á "..getAura(cid).." aura.")
			talkState = 2
       end
       return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Bom para quem não entende de script é recomendando mexer somente no configAura.lua da pasta data/lib, lá é possivel configurar de modo funcional.

 

 

 

 

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.7k

Informação Importante

Confirmação de Termo