Creditos:
Vodkart
Kydrai
fala galerinha resolvi posta alguns script que acontece quando o player mata algum monstro ...
o primeiro é o script que acontece quando voce mata um Monstro abre o teleport.
o segundo é matar o monstro e sumir a parede por algum tempo.
Obs: o Nome do monstro deve ser colocado com Letra Maiuscula.
certo:Demon
errado:
demon
[ Matar monstro e abrir Teleport ]
creaturescript\script
tp.lua
local tpId = 1387 local tps = { ["Orshabaal"] = {pos = {x=761, y=57, z=7}, toPos = {x=767, y=52, z=7}, time = 30}, } function removeTp(tp) local t = getTileItemById(tp.pos, tpId) if t then doRemoveItem(t.uid, 1) doSendMagicEffect(tp.pos, CONST_ME_POFF) end end function onDeath(cid) local tp = tps[getCreatureName(cid)] if tp then doCreateTeleport(tpId, tp.toPos, tp.pos) doCreatureSay(cid, "O teleport irá sumir em "..tp.time.." segundos.", TALKTYPE_ORANGE_1) addEvent(removeTp, tp.time*1000, tp) end return TRUE end
explicação:
["Orshabaal"] --------- Nome do monstro
pos = {x=761, y=57, z=7} ----------- onde o Teleport irá abrir
toPos = {x=767, y=52, z=7} ------- onde o teleport vai leva eles
time = 30 ------------ tempo em segundos que o teleport ficará aberto
em creaturescript adicione:
<event type="death" name="tp" event="script" value="tp.lua"/>
no arquivo.xml do seu monstro adicione:
<script> <event name="tp"/> </script>
[ Matar Monstro e parede sumir por determinado tempo ]
creaturescript\script
removewall.lua
function onDeath(cid, corpse, killer) local M ={ ["rat"] = {Pos = {x=177,y=40,z=7},id= 1058 ,time = 20}, ["necromancer"] = {Pos = {x=173, y=40, z=7},id= 10196 ,time = 10}, } local x = M[getCreatureName(cid)] function criar() local parede = getTileItemById(x.Pos, x.id) doCreateItem(x.id, 1, x.Pos) end if x then local parede = getTileItemById(x.Pos, x.id) if parede then doRemoveItem(parede.uid, 1) doCreatureSay(cid, "A parede Será criada Novamente em "..x.time.." segundos.", TALKTYPE_ORANGE_1) addEvent(criar, x.time*1000) end end return TRUE end
em creaturescript.xml adicione a tag:
<event type="death" name="removeall" event="script" value="removeall.lua"/>
No arquivo Xml do seu monstro adicione
<script> <event name="removeall"/> </script>
[ Matar Monstro e ser teleportado ]
teleportmon.lua
[/b][b]function onDeath(cid, corpse, killer)[/b] [b]local Ppos = {x = 160, y = 54, z = 7} -- posicao para onde ele vai ir local monstName = "Rat" -- nome do monstro if isMonster(cid) and string.lower(getCreatureName(cid)) == string.lower(monstName) then if isInParty(killer[1]) == TRUE then local players = getPartyMembers(getPartyLeader(killer[1])) for i, k in ipairs(players) do doTeleportThing(k, Ppos) end else doTeleportThing(killer[1], Ppos) end end return TRUE end
em creaturescript.xml adicione a tag:
<event type="death" name="TelePort" event="script" value="teleportmon.lua"/>
No arquivo Xml do seu monstro adicione
<script> <event name="TelePort"/> </script>
[ Matar Monstro e Ganhar Storage ]
StorageMonster.lua
function onDeath(cid, corpse, killer) local monstName = "Demon" -- nome do monstro local Storage = 11543 -- storage que o jogador ira ganhar if isMonster(cid) and string.lower(getCreatureName(cid)) == string.lower(monstName) then doCreatureSay(cid, "Você ganhou acesso para uma Secret Quest.", TALKTYPE_ORANGE_1) if isInParty(killer[1]) == TRUE then local players = getPartyMembers(getPartyLeader(killer[1])) for i, k in ipairs(players) do setPlayerStorageValue(k, Storage, 1) end else setPlayerStorageValue(killer[1], Storage, 1) end end return TRUE end
em creaturescript.xml adicione a tag:
<event type="death" name="StoraGe" event="script" value="StorageMonster.lua"/>
No arquivo Xml do seu monstro adicione
<script> <event name="StoraGe"/> </script>