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.
The one that helped me is Chris77 (I believe is correct spelling) and I am simply looking for more help and I believe this is the correct spot for the post so I think I may find more here. The final code does work sort of. It summons two orcs but does no longer require the bodies and if used again it summons about 10 of them.
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..
So what I need help with is two main things. A code to limit the amount of a certain monster can be summoned, or an overall limit to the character summoning as in they can only heve 5 total..may change with level..if that is doable.
And a way to change how many bodies the summon takes. At the moment it takes only one.
Will edit a code someone gave me and the results I got from it. Also this post is now in this thread as I think I put it in the wrong one the first time.
Above is the code someone gave me on these forums but sadly did not work the way I needed...will show it in code below.
Edit- I found out what the Orc one does now it uses any item in the area to summon..it does not need an item but if there happen to be one it will use it. Just now took my spellbook.
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
The one that helped me is Chris77 (I believe is correct spelling) and I am simply looking for more help and I believe this is the correct spot for the post so I think I may find more here. The final code does work sort of. It summons two orcs but does no longer require the bodies and if used again it summons about 10 of them.
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)
So what I need help with is two main things. A code to limit the amount of a certain monster can be summoned, or an overall limit to the character summoning as in they can only heve 5 total..may change with level..if that is doable.
And a way to change how many bodies the summon takes. At the moment it takes only one.
Will edit a code someone gave me and the results I got from it. Also this post is now in this thread as I think I put it in the wrong one the first time.
Code:
local summons = getCreatureSummons(cid)
if(table.maxn(summons) >= 2) then
doPlayerSendCancel(cid, "You may not summon more than 2 creatures.")
return TRUE
end
Code:
local summons = getCreatureSummons(cid)
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 and
(table.maxn(summons) >= 2) then
doPlayerSendCancel(cid, "You may not summon more than 2 creatures.")
else
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
Edit- I found out what the Orc one does now it uses any item in the area to summon..it does not need an item but if there happen to be one it will use it. Just now took my spellbook.
Last edited: