• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Remove Summon After 5 sec

Mooosie

mistofdeath.com
Premium User
Joined
Aug 2, 2008
Messages
735
Solutions
2
Reaction score
43
Location
Sweden
I made a spell that you summon a fire totem. And i want it to disappear after 5 sec.. how can i do it?

Code:
 function onCastSpell(cid, var)
local pos = getThingPos(cid)
    if(getTilePzInfo(getCreaturePosition(cid)) == true) then
            doCreatureSay(cid, "You cannot summon in PZ!", TALKTYPE_ORANGE_1)
			doSendMagicEffect(pos, CONST_ME_POFF)
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        return true
    end
    if table.maxn(getCreatureSummons(cid)) > 0 then
            doPlayerSendCancel(cid, "You can't summon more than one.")
			doSendMagicEffect(pos, CONST_ME_POFF)
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

    else
            doConvinceCreature(cid, doCreateMonster("Fire Totem", pos))
			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			doPlayerSendCancel(cid, "You put out your fire totem.")
			setPlayerStorageValue(cid, 21981)
			
    end
	config = { 
			formula = (getCreatureMaxHealth(cid) / 100) * 5,
			form = (getCreatureMaxHealth(cid) / 100) * 1,
	}
function onKill(cid, target, damage, flags)
	if getPlayerStorageValue(cid, 151015) == 1 then
	doCreatureAddHealth(cid, config.formula)
	else
	doCreatureAddHealth(cid, config.form)
	end
		return true
end
end
 
LUA:
local function f(c)
	if isMonster(c) then
		doRemoveCreature(c)
	end
end

function onCastSpell(cid, var)
	local p = getThingPos(cid)
	if getTileInfo(p).protection then
		doCreatureSay(cid, 'You cannot summon in PZ!', TALKTYPE_ORANGE_1, false, cid, p)
		doSendMagicEffect(p, CONST_ME_POFF)
	elseif #getCreatureSummons(cid) ~= 0 then
		doPlayerSendCancel(cid, 'You can\'t summon more than one.')
		doSendMagicEffect(p, CONST_ME_POFF)
	else
		local r = doSummonMonster(cid, 'Fire Totem')
		if r == 1 then
			doSendMagicEffect(p, CONST_ME_MAGIC_BLUE)
			doPlayerSendCancel(cid, 'You put out your fire totem.')
			doCreatureSetStorage(cid, 21981, 1)
			addEvent(f, 5000, getCreatureSummons(cid)[1])
			return true
		else
			doPlayerSendDefaultCancel(cid, r)
		end
	end
end
 
Rep bro!

Off topic:
Can you do a totem who is healing, not attacking? (a monster who is healing his mastersummoner)
 
Back
Top