Bom poderia por para coisa mais de 1 item com uma chance cada nada de muito difícil.
- Fórum
- OTServ
- Recursos
- Scripting
- Globalevents e Spells
- Especial Loot Bonus - Deve Ter X Storage
15
creatureevent
Especial Loot Bonus - Deve Ter X Storage
Por 1579091, 30 de set. de 2012 em Globalevents e Spells
script
3
891
info
Grupo: Visconde
Registrado: 22/09/10
Posts: 474
Reputação: +47

30 de setembro de 2012 às 22:43



info
Grupo: Marquês
Registrado: 06/11/11
Posts: 1.1k
Reputação: +109
Char no Tibia: Stroked
Especial loot bonus with storage
Créditos à Erika Kontenis
Hoje, estava fuçando em outro fórum, e encontrei um script bem legal.
Como Funciona?
Como o nome já diz, funciona assim. O player que tiver tal storage (configuravel óbviamente), terá uma chance de cair um loot bonus... Voce pode por pra apenas vips, ou quem tiver feito uma quest... E também pode configurar o monstro que caira o loot.
Vamos Lá!
Em 'data/creaturescripts/creaturescripts.xml coloque essa tag:
<event type="kill" name="especialloot" event="script" value="especialloot.lua"/> -- Para 0.4~
<event type="death" name="especialloot" script="especialloot.lua"/> -- Para 0.2~
Depois, registre isso em login.lua:
registerCreatureEvent(cid, "especialloot")
Agora em data/creaturescripts/scripts/especialloot.xml coloque isso:
Para 0.4:
local monsters = {
["demon"] = {item = 2160, count = 2, chance = 70},
["rat"] = {item = 2160, count = 2, chance = 80}
}
function onKill(cid, target, lastHit)
local storage = 7474
local v = getMonsterInfo(getCreatureName(target)).lookCorpse
local chance = math.random(1, 100)
if getPlayerStorageValue(cid, storage) == 1 then
for k, a in pairs(monsters) do
if (isMonster(target) and ((string.lower(getCreatureName(target))) == k)) then
if a.chance >= chance then
local function dropLoot(pos, v, cid)
local corpse = getTileItemById(pos, v).uid
doAddContainerItem(corpse, a.item, math.random(1, a.count))
end
addEvent(dropLoot, 0, getThingPos(target), v,cid)
end
end
end
end
return true
end
0.2~
local monsters = {
["demon"] = {item = 2160, cant = 2, chance = 70},
["rat"] = {item = 2160, cant = 2, chance = 100}
}
local storage = 7474
function onDeath(cid, corpse)
local chance = math.random(1, 100)
if getPlayerStorageValue(getPlayerByName(getPlayerName(getCreatureTarget(cid))), storage) == 1 then
for k, v in pairs(monsters) do
if (isMonster(cid) and ((string.lower(getCreatureName(cid))) == k)) then
if v.chance >= chance then
doAddContainerItem(corpse.uid, v.item, math.random(1, v.cant))
end
end
end
end
return true
end
Configurando:
["demon"] = {item = 2160, count = 2, chance = 70},
["nome do bixo"] = {item = ID do item a dropar, count = quantidade maxima que ira cair, chanse = chanse de cair
Após configurar o monstro, la no monstro você também terá que editar basta editar em todos os monstros (que tiver o loot bonus) adicionando esta tag:
<script>
<event name="bubu"/>
</script>
Ficando assim (no caso do Rat):
<?xml version="1.0" encoding="UTF-8"?>
<monster name="rat" nameDescription="a rat" race="blood" experience="5" speed="140" manacost="200">
<health now="20" max="20"/>
<look type="21" head="20" body="30" legs="40" feet="50" corpse="5964"/>
<targetchange interval="2000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="5"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="8" attack="9"/>
</attacks>
<defenses armor="7" defense="5"/>
<immunities/>
<script>
<event name="bubu"/>
</script>
<loot>
<item id="3976" countmax="6" chance1="50000" chancemax="0"/>
<item id="2148" countmax="7" chance1="80000" chancemax="0"/>
<item id="2696" chance="20000"/>
</loot>
</monster>
Editado Setembro 30 por GuizitoG