Ir para conteúdo

Featured Replies

Postado
  • Autor

@Vodkart   não mudei nada ainda praticamente

 

function GiveRewards(cid, items) -- n mexa na função
    local backpack,str = doPlayerAddItem(cid, 1999, 1), '' -- backpackID
    for i = 1, table.maxn(items) do
        local chance, itemid, amount = items.chance, items.itemid,items.amount
        if chance > math.random(1, 100) then
            if isItemStackable(itemid) or amount == 1 then
                doAddContainerItem(backpack, itemid, amount)
            else
                for i = 1, amount do
                    doAddContainerItem(backpack, itemid, 1)
                end
            end
            str = str .. amount .. ' ' .. getItemNameById(itemid)
            str = i ~= table.maxn(items) and str .. ', ' or str .. '.'
        end
    end
    return str
end

local monstName = "SPECIAL BOSS" -- nome do monstro

local rewards = { -- chance, itemid e quantidade
    {chance = 50, itemid = 2173, amount = 1},
    {chance = 10, itemid = 2494, amount = 1},
    {chance = 100, itemid = 2159,amount = 20},
    {chance = 100, itemid = 2160, amount = 100}
}

function onDeath(cid, corpse, killer)
    if isMonster(cid) and string.lower(getCreatureName(cid)) == string.lower(monstName) then
        local t = getSpectators(getCreaturePosition(cid), 7, 5, false) -- quem vai estar a 7x5 sqm dele vai ganhar os itens. pode aumentar o radius.
        if t then
            for _, pid in ipairs(t) do
                if isPlayer(pid) then
                    local r = GiveRewards(pid, rewards)
                    doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE,"Parabéns, Você destriu o monstro "..monstName..". Suas recompensas: "..r)
                end
            end
        end
    end
    return true
end

  • Respostas 14
  • Visualizações 992
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • rewmonster.lua   function GiveRewards(cid, items) -- n mexa na função local backpack,str = doPlayerAddItem(cid, 1999, 1), '' -- backpackID for i = 1, table.maxn(items) do local chance, it

  • O servidor não está conseguindo achar o arquivo... Você colocou o creaturescript com o nome rewmonster.lua?

  • @douglas0000777 testei e funcionou... colou o evento no xml do monstro?   15:42 Parabéns, Você destriu o monstro Pythius The Rotten. Suas recompensas: 20 scarab coin, 100 crystal coin.  

Postado

@douglas0000777 testei e funcionou... colou o evento no xml do monstro?

 

15:42 Parabéns, Você destriu o monstro Pythius The Rotten. Suas recompensas: 20 scarab coin, 100 crystal coin.

 

 

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

 

no arquivo do monstro tem que ficar assim olha:

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Pythius the rotten" nameDescription="a Pythius the rotten" race="undead" experience="100" speed="300" manacost="0">
  <health now="8350" max="8350"/>
  <look type="231" corpse="6306"/>
  <targetchange interval="5000" chance="8"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag summonable="0"/>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag illusionable="1"/>
    <flag convinceable="0"/>
    <flag pushable="0"/>
    <flag canpushitems="1"/>
    <flag canpushcreatures="1"/>
    <flag targetdistance="1"/>
    <flag staticattack="90"/>
    <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack name="melee" interval="2000" skill="95" attack="95"/>

    <attack name="fire" interval="2000" chance="20" range="7" radius="4" target="1" min="-300" max="-395">
      <attribute key="shootEffect" value="fire"/>
      <attribute key="areaEffect" value="redspark"/>
    </attack>

    <attack name="death" interval="3000" chance="20" range="7" min="-0" max="-600">
      <attribute key="shootEffect" value="suddendeath"/>
    </attack>

    <attack name="poison" interval="2000" chance="20" range="7" radius="4" target="1" min="-120" max="-390">
      <attribute key="shootEffect" value="poison"/>
      <attribute key="areaEffect" value="poison"/>
    </attack>

    <attack name="poison" interval="1000" chance="10" range="7" min="-50" max="-180">
      <attribute key="shootEffect" value="poison"/>
      <attribute key="areaEffect" value="poison"/>
    </attack>

    <attack name="fire" interval="4000" chance="25" length="8" spread="3" min="-500" max="-600">
      <attribute key="areaEffect" value="firearea"/>
    </attack>

    <attack name="poison" interval="2000" chance="23" length="8" spread="3" min="-200" max="-685">
      <attribute key="areaEffect" value="poison"/>
    </attack>

    <attack name="lifedrain" interval="3000" chance="25" length="8" spread="3" min="-300" max="-600">
      <attribute key="areaEffect" value="greenshimmer"/>
    </attack>

  </attacks>
  <defenses armor="35" defense="30">
  </defenses>
	<elements>
		<element physicalPercent="10"/>
		<element icePercent="10"/>
		<element holyPercent="-10"/>
	</elements>
  <immunities>
    <immunity death="1"/>
    <immunity earth="1"/>
    <immunity fire="1"/>
    <immunity drown="1"/>
    <immunity lifedrain="1"/>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>
  <summons maxSummons="2">
    <summon name="Undead Gladiator" interval="1000" chance="8"/>
  </summons>
  <voices interval="5000" chance="10">
    <voice sentence="YOU'LL NEVER GET MY TREASURE!"/>

  </voices>
	<script>
		<event name="RewaMonster"/>
	</script>
</monster>

 

 

você precisa registrar essa parte :

 

 

	<script>
		<event name="RewaMonster"/>
	</script>

 

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