Captain Orhotek
New Member
- Joined
- May 20, 2009
- Messages
- 118
- Reaction score
- 1
I made some simple summoning spells but I have no idea how to limit how many things can be summoned.
That is a little example of the spell but at the moment all it does is summon a Orc for every dead body. I either want it to summon a couple at a cast or limit how many of that creature can be summoned in all. Like it still uses all dead bodies but only summons 2. And yes this is a crude edit of the summon undead legion spell...unless I am mistaken the code
means how many dead bodies you need to summon. But that is the only thing I see..
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)
function onTargetTile(cid, pos)
local position = pos
position.stackpos = 255
local item = getThingfromPos(position)
if item.itemid > 0 then
if isInArray(CORPSES, item.itemid) == TRUE then
doRemoveItem(item.uid,1)
local creature = doSummonCreature("Orc", pos)
doConvinceCreature(cid, creature)
doSendMagicEffect(pos, CONST_ME_POFF)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
That is a little example of the spell but at the moment all it does is summon a Orc for every dead body. I either want it to summon a couple at a cast or limit how many of that creature can be summoned in all. Like it still uses all dead bodies but only summons 2. And yes this is a crude edit of the summon undead legion spell...unless I am mistaken the code
Code:
doRemoveItem(item.uid,1)