Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- As I said you should have freez system to prevent player from moving L:D when you summon this :D
- #Slavi
- ]]
- local config = {
- onlyPlayer = false, -- only works on player?
- monsterName = "dragon", -- example monster ...
- monsterCount = 4, -- how much monsters should be made?
- waves = 1, -- not done yet.
- effect = 50, -- effect on target
- effect2 = 69, -- effect on each pet you summon.
- dEffect = 28, --CONST_ANI_TARSALARROW -- you must have seen gif image :D
- interval = 5, -- interval to remove pets in seconds
- extraDamage = true,
- safePercent = 20, -- in extra hit damage it low the damage if player's mana or health percent(depend on Magicshield active..) lower than this damage become half
- storageSummon = 1988455, -- Don't wanna use of storage? use spell time in spells.xml
- minDmg = 70,
- maxDmg = 120,
- }
- --[[
- I already provided every configurable thing up.
- so don't go down.
- ]]
- function onCastSpell(cid, var)
- local player = Player(cid)
- local c = config
- if player:getTarget() then
- if player:getStorageValue(c.storageSummon) > 0 then player:say("You can't summon now..", TALKTYPE_MONSTER_SAY); return false end
- local target = player:getTarget()
- if(not isPlayer(target))and(c.onlyPlayer)then
- player:say("You can only summon on players", TALKTYPE_MONSTER_SAY)
- return false
- end
- local pos = target:getPosition()
- for i = 1, c.waves do
- for s = 1, c.monsterCount do
- local creatureId = Game.createMonster(c.monsterName, pos)
- local monster = Monster(creatureId) or creatureId
- monster:setMaster(player)
- monster:getPosition():sendMagicEffect(c.effect)
- addEvent(removeSummon, config.interval * 1000, target.uid, creatureId.uid, c.extraDamage)
- player:getPosition():sendDistanceEffect(target:getPosition(), config.dEffect)
- end
- end
- if target:isPlayer() then
- activeFreez(target.uid, c.interval)
- end
- player:setStorageValue(c.storageSummon, 1)
- addEvent(backStorage, (c.interval+10) * 1000, player.uid)
- return true
- else
- player:getPosition():sendMagicEffect(3)
- player:say("No Target.", TALKTYPE_MONSTER_SAY) -- no target
- end
- end
- function backStorage(cid)
- if not Player(cid) then return false end
- Player(cid):setStorageValue(config.storageSummon, 0)
- return true
- end
- function activeFreez(cid, interval)
- if Player(cid) then
- doSetFreezed(cid, true)
- Player(cid):say("Freezed", TALKTYPE_MONSTER_SAY)
- addEvent(doSetFreezed, interval*1000, cid, false)
- end
- return true
- end
- function doSetFreezed(cid, bool)
- if not Player(cid) then return false end
- Player(cid):setFreezed(bool)
- player:say("Melted", TALKTYPE_MONSTER_SAY)
- return true
- end
- function removeSummon(pid, tid, boolExtraAtk)
- if Creature(pid) then
- if Creature(tid) then
- tid = Creature(tid)
- pid = Creature(pid)
- local c = tid:getPosition()
- if tid:remove() then
- local p = pid:getPosition()
- p:sendMagicEffect(config.effect2)
- c:sendMagicEffect(config.effect)
- if Creature(pid):isPlayer() then
- c:sendDistanceEffect(p, config.dEffect, Player(pid))
- else
- c:sendDistanceEffect(p, config.dEffect)
- end
- if boolExtraAtk then
- if not pid then return true end
- local hp, maxHp, mp, maxMp = pid:getHealth(), pid:getMaxHealth(), pid:getMana(), pid:getMaxMana()
- local pHp, pMp = (hp/maxHp)*100, (mp/maxMp)*100
- local sF, max, min = config.safePercent, config.maxDmg, config.minDmg
- if pid:isPlayer() then
- if getCreatureCondition(creature, CONDITION_MANASHIELD) == true then
- if pMp > sF then
- doTargetCombatMana(0, pid, -min, -max, 1)
- else
- doTargetCombatMana(0, pid, -(min/2), -(max/2), 1)
- end
- else
- if pHp > sF then
- doTargetCombatHealth(0, pid, COMBAT_PHYSICALDAMAGE, min, max, 1)
- else
- doTargetCombatHealth(0, pid, COMBAT_PHYSICALDAMAGE, (min/2), (max/2), 1)
- end
- end
- else
- if pHp > sF then
- doTargetCombatHealth(0, pid, COMBAT_PHYSICALDAMAGE, min, max, 1)
- else
- doTargetCombatHealth(0, pid, COMBAT_PHYSICALDAMAGE, (min/2), (max/2), 1)
- end
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement