Skip to content
User Avatar
#3439
Auto-translated
KioM
So, does this mean I need to emulate casting spells for the mobs?

Another question: is it possible to make a mob cast a spell, say, Haste, at an expert level without editing the mob itself? Only through a script.
No, if a creature doesn't explicitly have a spell assigned, it will cast it at the advanced level. If I need a creature to cast a spell under specific conditions or at a specific level, I use hidden creatures with spells explicitly assigned to them. In battle, I summon the hidden creature -> it casts the spell -> I remove the creature. With this scheme, the appearance of the creature remains unnoticed. Example code (a working example from NHF):
-- summon
AddCreature(side, HELPER, 30, -1, -1, nil, 'fiona_sorrow_helper')
while not exist('fiona_sorrow_helper') do
sleep()
end
-- cast
for creature, _ in enemy_stacks_to_sorrow do
pcall(UnitCastAimedSpell, 'fiona_sorrow_helper', SPELL_SORROW, creature)
end
-- remove the creature
removeUnit('fiona_sorrow_helper')
while exist('fiona_sorrow_helper') do
sleep()
end
Нет войне.