Ir para conteúdo
  • 0

Remover Monstro


ScythePhantom

Pergunta

3 respostass a esta questão

Posts Recomendados

  • 0

pelo q intendi tu quer q o summon suma depois de um tempo e q tb caso o usuario use denovo a magia remova o summon certo? se for, toma ae...

 

local from,to = {x=962, y=885, z=7},{x=973, y=892, z=7}
local from2,to2 = {x=979, y=901, z=7},{x=991, y=905, z=7}
local MaximoSummon = 1
local timeToRemove = 30 --em segs

local function remove(summon)
  if isCreature(summon) then
  doSendMagicEffect(getThingPos(summon), 2)
  doRemoveCreature(summon)
  end  
end

function onCastSpell(cid, var)
  local playerpos = getPlayerPosition(cid)
  local cloth = getCreatureOutfit(cid)
  local health = getCreatureHealth(cid)
  local maxhealth = getCreatureMaxHealth(cid)
  local summons = getCreatureSummons(cid)

  if isInRange(playerpos, from, to) or isInRange(playerpos, from2, to2) then
  doPlayerSendCancel(cid, "You can not use Summons Here")
  return true
  end

  if #summons > MaximoSummon then
  for i = 1, #summons do
	  if getCreatureName(summons[i]) == "clone" then
		 doSendMagicEffect(getThingPos(summons[i]), 2)  
		 doRemoveCreature(summons[i])					--remove todos os clones quando usar a magia denovo
	  end
  end
  summons = getCreatureSummons(cid)
  end

  if #summons < MaximoSummon then -- no summons
  local clone = doCreateMonster("clone", playerpos, false)
  if not isCreature(clone) then
	 doPlayerSendCancel(cid, "Haven't enough space to summon your clone here!")
	 return true
  end
  doConvinceCreature(cid, clone)
  setCreatureMaxHealth(clone, maxhealth)
  doCreatureAddHealth(clone, health)
  doSetCreatureOutfit(clone, cloth, -1)
  doSendMagicEffect(playerpos, 2)
  addEvent(remove, timeToRemove*1000, clone)
  return TRUE
  end
end

 

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

×
×
  • Criar Novo...