Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] BOSS que ao morrer da item


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Este tópico foi movido para a área correta. Esta é uma mensagem automática!
Pedimos que leia as regras do fórum!

Spoiler

This topic has been moved to the correct area. This is an automated message!
Please read the forum rules.

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • Solução

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, itemid, amount = items[i].chance, items[i].itemid,items[i].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 = "Pythius The Rotten" -- 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

 

em creaturescript.xml adicione a tag:

 

<event type="death" name="RewaMonster" event="script" value="rewmonster.lua"/>


 

 

No arquivo Xml do seu monstro adicione

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

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
  • Moderador
1 minuto atrás, douglas0000777 disse:

@Vodkart Esta dando esse erro 

[Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/rewmonster.lua)
 cannot open data/creaturescripts/scripts/rewmonster.lua: No such file or directory
 (done).

 

 

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

Link para o post
Compartilhar em outros sites

Agora ta aparecendo outro kkkk

 

>>> Loading creaturescripts... [Error - LuaInterface::loadFile] data/creaturescripts/scripts/rewmonster.lua:7: unexpected symbol near 'ï'
[Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/rewmonster.lua)
data/creaturescripts/scripts/rewmonster.lua:7: unexpected symbol near 'ï'
 (done).

Link para o post
Compartilhar em outros sites

@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

Link para o post
Compartilhar em outros sites

@douglas0000777 vc copiou errado ta vendo essa linha:

 

local chance, itemid, amount = items[i].chance, items[i].itemid,items[i].amount

 

 

na sua sumiu os "i"

 

entendeu? ai da esses erros mesmo... tente copiar certinho brother.

COPIA DIRETO DAQUI O CODIGO PRA NAO BUGAR: 

 

https://pastebin.com/raw/38hjyntG

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@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>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo