Ir para conteúdo
  • 0

-=[TFS]=- 0.3.6 8.60 - PET HIT COM MAGIA NO PLAYER QUE O SUMONO OU SEJA NO DOMADOR POR CAUSA QUE PET TEM MAGIA EM AREA


Muvuka

Pergunta

-=[TFS]=- 0.3.6 8.60 - PET HIT COM MAGIA NO PLAYER QUE O SUMONO OU SEJA NO DOMADOR ELE ATACA A CRITATURA PLAYER OU MONSTER MAIS MAGIA EM AREA AFETA O DOMADOR

 

Item que sumona pet

 <action itemid="4864" event="script" value="simple_pet.lua"/>

 

SCRIPT QUE USO ESTA FALTANDO PRA O PET NÃO ATACA COM MAGIA NO DOMADOR OU SEJA QUEM SUMONO O PET

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local petName = "[PET] NIVEL MAXIMO"
    local storageValue = 83712
    local playerPets = getCreatureSummons(cid)

    -- Verifica se o jogador já tem um pet invocado
    if #playerPets <= 0 then
        -- Se não houver pet invocado, invoca um novo
        local newPet = doSummonMonster(cid, petName)
        if newPet then
            setPlayerStorageValue(cid, storageValue, 1)
        end
    else
        -- Se houver pet invocado, verifica se é o pet correto e remove-o
        for _, pet in ipairs(playerPets) do
            if getCreatureName(pet) == petName then
                doRemoveCreature(pet)
            end
        end
    end
    return true
end

 

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="[PET] NIVEL MAXIMO" nameDescription="[PET] NIVEL MAXIMO" race="fire" experience="" speed="999" manacost="0">
  <health now="950000000" max="950000000"/>
 <look type="35" corpse="3058"/>
  <targetchange interval="" chance="1000000000"/>
  <strategy attack="1000000000" defense="1000000000"/>
  <flags> 
    <flag skull="4"/>
    <flag summonable="0"/>
    <flag attackable="0"/>
    <flag hostile="0"/>
    <flag illusionable="0"/>
    <flag convinceable="0"/>
    <flag pushable="0"/>
    <flag canpushitems="0"/>
    <flag canpushcreatures="0"/>
    <flag targetdistance="0"/>
    <flag staticattack="0"/>
    <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack name="melee" interval="" min="-9584571530" max="-95845715300"/>
    	<attack name="firecondition" interval="1000" chance="1000000" range="100" min="-1000000" max="-1000000">
			<attribute key="shootEffect" value="fire"/>
			<attribute key="areaEffect" value="yellowspark"/>
     </attack>
    <attack name="death" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="mortarea"/>
    </attack>
    <attack name="speed" interval="1000" chance="1000000" radius="100" target="100" speedchange="-1000000" duration="100000">
      <attribute key="areaEffect" value="poison"/>
    </attack>
    <attack name="strength" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="blackspark"/>
    </attack>
		<attack name="firefield" interval="1000" chance="1000000" radius="100" target="100">
			<attribute key="areaEffect" value="explosion"/>
   </attack>
<attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="shootEffect" value="explosion"/>
      <attribute key="areaEffect" value="YELLOWENERGY"/>
    </attack>
    <attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="shootEffect" value="ENERGYBALL"/>
      <attribute key="areaEffect" value="assassin"/>
    </attack>
    <attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="shootEffect" value="ICE"/>
      <attribute key="areaEffect" value="WATERCREATURE"/>
    </attack>
       <attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
			<attribute key="shootEffect" value="fire"/>
			<attribute key="areaEffect" value="firearea"/>
		</attack>
     <attack name="fire" interval="" chance="1000000" range="100" radius="100" target="1" min="-1000000000" max="-1000000000">
			<attribute key="shootEffect" value="DEATH"/>
			<attribute key="areaEffect" value="EXPLOSION"/>
        </attack>
    <attack name="manadrain" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="energyarea"/>
    </attack>
    <attack name="energy" interval="1000" chance="1000000" length="100" spread="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
    <attack name="poisoncondition" interval="1000" chance="1000000" length="100" spread="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="greenspark"/>
    </attack>
    <attack name="lifedrain" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="greenshimmer"/>
  </attack>
    <attack name="death" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="mortarea"/>
    </attack>
    <attack name="speed" interval="1000" chance="1000000" radius="100" target="100" speedchange="-1000000" duration="100000">
      <attribute key="areaEffect" value="poison"/>
    </attack>
    <attack name="strength" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="blackspark"/>
    </attack>
		<attack name="firefield" interval="1000" chance="1000000" radius="100" target="100">
			<attribute key="areaEffect" value="explosion"/>
   </attack>
    <attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="shootEffect" value="fire"/>
      <attribute key="areaEffect" value="firearea"/>
    </attack>
       <attack name="fire" interval="1000" chance="1000000" range="100" radius="100" target="100" min="-1000000" max="-1000000">
			<attribute key="shootEffect" value="fire"/>
			<attribute key="areaEffect" value="firearea"/>
		</attack>
     <attack name="fire" interval="" chance="1000000" range="100" radius="100" target="1" min="-1000000000" max="-1000000000">
			<attribute key="shootEffect" value="HOLY"/>
			<attribute key="areaEffect" value="EXPLOSION"/>
        </attack>
    <attack name="manadrain" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="energyarea"/>
    </attack>
    <attack name="energy" interval="1000" chance="1000000" length="100" spread="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
    <attack name="poisoncondition" interval="1000" chance="1000000" length="100" spread="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="greenspark"/>
    </attack>
    <attack name="lifedrain" interval="1000" chance="1000000" radius="100" target="100" min="-1000000" max="-1000000">
      <attribute key="areaEffect" value="greenshimmer"/>
    </attack>
       <attack name="fire" interval="" chance="1000000" range="100" radius="100" target="100" min="-150" max="-250">
			<attribute key="shootEffect" value="fire"/>
			<attribute key="areaEffect" value="firearea"/>
		</attack>
     <attack name="fire" interval="" chance="1000000" range="100" radius="100" target="1" min="-1000000000" max="-1000000000">
			<attribute key="shootEffect" value="HOLY"/>
			<attribute key="areaEffect" value="EXPLOSION"/>
        </attack>
   <attack name="manadrain" interval="" chance="1000000" radius="100" target="100" min="-1000000000" max="-10000000000">
      <attribute key="areaEffect" value="energyarea"/>
    </attack>
        <attack name="lifedrain" interval="" chance="1000000" radius="100" target="100" min="-1000000000" max="-10000000000">
      <attribute key="areaEffect" value="greenshimmer"/>
    </attack>
  </attacks>
  <defenses armor="999" defense="999">
    <defense name="healing" interval="100" chance="100000" min="950000000" max="950000000">
      <attribute key="areaEffect" value="blueshimmer"/>
    </defense>
    <defense name="speed" interval="2000" chance="100000" speedchange="900" duration="9000">
      <attribute key="areaEffect" value="redshimmer"/>
    </defense>
  </defenses>
  <immunities>
    <immunity physical="100"/>
    <immunity energy="100"/>
    <immunity fire="100"/>
    <immunity poison="100"/>
    <immunity lifedrain="100"/>
    <immunity paralyze="100"/>
    <immunity outfit="100"/>
    <immunity drunk="100"/>
    <immunity invisible="100"/>
    <immunity ice="100"/>
    <immunity death="100"/>
    <immunity holy="100"/>
  </immunities>
  <voices interval="1000" chance="1000000">
    <voice sentence="INVENCIVEL!" yell="1"/>
  </voices>
<loot>
  <item id="1988" chance="1000000">
		<inside>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
<item id="2159" countmax="1000000" chance1="1000000000" chancemax="1000000000"/>
		</inside>
 	</item>
  </loot>
</monster>

 

Editado por Muvuka
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 1
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local petName = "[PET] NIVEL MAXIMO"
    local storageValue = 83712
    local playerPets = getCreatureSummons(cid)

    -- Verifica se o jogador já tem um pet invocado
    if #playerPets <= 0 then
        -- Se não houver pet invocado, invoca um novo
        local newPet = doSummonMonster(cid, petName)
        if newPet then
            setPlayerStorageValue(cid, storageValue, 1)
        end
    else
        -- Se houver pet invocado, verifica se é o pet correto e remove-o
        for _, pet in ipairs(playerPets) do
            if getCreatureName(pet) == petName then
                doRemoveCreature(pet)
            end
        end
    end

    -- Impede que o domador seja afetado pelo ataque em área
    registerCreatureEvent(cid, "Infriendlyfire")

    return true
end



alem disso, adicione: 
 

<event type="infriendlyfire" name="Infriendlyfire" event="script" value="infriendlyfire.lua"/>


e crie um .lua: 
 

function onInfriendlyfire(cid, attacker, target)
    if isPlayer(attacker) and isPlayer(target) then
        return false -- Impede que jogadores causem dano uns aos outros
    end
    if isPlayer(attacker) and isSummon(target) then
        local master = getCreatureMaster(target)
        if master == attacker then
            return false -- Impede que o domador cause dano ao seu pet
        end
    end
    if isSummon(attacker) then
        local master = getCreatureMaster(attacker)
        if master == target then
            return false -- Impede que o pet cause dano ao seu domador
        end
    end
    return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 1

qual erro retorna no console?

simple_pet.lua
 

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local petName = "[PET] NIVEL MAXIMO"
    local storageValue = 83712
    local playerPets = getCreatureSummons(cid)

    -- Verifica se o jogador já tem um pet invocado
    if #playerPets <= 0 then
        -- Se não houver pet invocado, invoca um novo
        local newPet = doSummonMonster(cid, petName)
        if newPet then
            setPlayerStorageValue(cid, storageValue, 1)
        end
    else
        -- Se houver pet invocado, verifica se é o pet correto e remove-o
        for _, pet in ipairs(playerPets) do
            if getCreatureName(pet) == petName then
                doRemoveCreature(pet)
            end
        end
    end

    -- Registra o evento Infriendlyfire
    registerCreatureEvent(cid, "Infriendlyfire")

    return true
end



infriendlyfire.lua
 

function onInfriendlyfire(cid, attacker, target)
    if isPlayer(attacker) and isPlayer(target) then
        return false -- Impede que jogadores causem dano uns aos outros
    end
    if isPlayer(attacker) and isSummon(target) then
        local master = getCreatureMaster(target)
        if master == attacker then
            return false -- Impede que o domador cause dano ao seu pet
        end
    end
    if isSummon(attacker) then
        local master = getCreatureMaster(attacker)
        if master == target then
            return false -- Impede que o pet cause dano ao seu domador
        end
    end
    return true
end

 

Editado por Holograma
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...