Hello. I'm encountering a strange problem with spellcasting in a combat script.
function DefenderCreatureDeath (unit)
if exist ('Priest') then
sleep (2)
SetUnitManaPoints(Osillian, GetUnitManaPoints(Osillian)+50)
sleep (1)
UnitCastAimedSpell (Osillian, SPELL_RESURRECT, unit)
sleep (5)
UnitCastAimedSpell (Osillian, SPELL_CELESTIAL_SHIELD, unit)
end
end
In this script snippet, I need the hero to resurrect the fallen defenders after their death and then cast Celestial Shield on them. The resurrection works fine, but the Celestial Shield simply won't cast. The console displays a generic "Unit can't cast aimed spell..." message. I've been struggling with this for two days, and I would be very grateful if someone could offer some advice.
And another question: I need the enemy hero's archer, let's call him 'Hunter', to target one of the player's hero's creatures during his turn, but not a specific one. However, I can't figure out how to do this. I think I need to create a table of creatures that the archer can choose from, but I'm not sure how to create it, and I also know that the regular commandShot won't work here, so how can I make the archer actually shoot?