• 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!

Spell that summons 4 fire elemental at once

manuelcash1

New Member
Joined
Mar 15, 2012
Messages
2
Reaction score
0
Hi, if some could help please, it would be great :). I want to create a spell that summons several monsters at once when a player casts it
 
I think it should work, but u must test it. Past errors here.
spell:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)

function onCastSpell(cid, var)
	local c = {
		storage = 8888,
		name_summoned_monster = "Fire Elemental",
		how_much_summons = 4,
		name_of_creatureevent = "SummonDeath"
	}
	for i = 1, (c.how_much_summons - getPlayerStorageValue(cid, c.storage)) do
		local creature = doSummonCreature(c.name_summoned_monster, getCreaturePosition(cid))
		doConvinceCreature(cid, creature)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		registerCreatureEvent(creature, c.name_of_creatureevent)
	end
	setPlayerStorageValue(cid, c.storage, c.how_much_summons)
end
creaturescripts death_summon.lua:
LUA:
function onDeath(cid, corpse, deathList)
	local c = {
		storage = 8888
	}
	
	if isCreature(cid) then
		if getPlayerStorageValue(getCreatureMaster(cid), c.storage) > -1 then
			setPlayerStorageValue(getCreatureMaster(cid), c.storage, getPlayerStorageValue(getCreatureMaster(cid), c.storage) - 1)
		end
		return true
	end
	return true
end
creaturescripts.xml:
LUA:
	<event type="death" name="SummonDeath" event="script" value="death_summon.lua"/>
 
Great! It works almost perfectly thank you very much, this will help me a lot. But i think there is a little problem when i cast the spell the first time it summons 5 and if i kill one of those summon and cast the spell again it summon 2 more, so there will be 6, and this gone on. if i kill another one it summon 2 more O.o I am sure the error must be something little but i cannot fix it. If you can help it will be great.
 
Last edited:
Back
Top