Auto-translated
Can static objects be removed using the RemoveObject function?
New here? I'm Roha — want a quick tour?
Instead of UnitCastAimedSpell(unit,spell,target), use startThread(UnitCastAimedSpell,unit,spell,target). The error will remain, but it won't affect the script's further execution.
StartThread doesn't work; it seems you can't start multiple threads during combat.
What does the console say?
value was NIL when getting global 'startThread'
attempt to call a nil value
That's strange... The screenshot shows an example. Everything works, there are no errors.
Could there be a mod that adds this feature? Because the Haven faction has different shields.
And where is this screenshot from?
No. It's just an NCF, it only adds creatures (although I don't know :D).
To be honest, I don't really understand battle scripts. Half of them aren't even in the official manual. Can anyone help me with the following:
a) How do I determine if my hero is defending or attacking? (IsAttacker works very strangely)
b) What UnitName should I specify? Is it the name of the unit as it appears on the map, or the script name?
c) How do I make a hero cast a spell at the beginning of the battle or in sync with another action (like Frida's Divine Retribution or Leto's Plague)?
I would appreciate it if you could provide some small examples, as I won't be able to figure it out otherwise.
Thank you in advance.
if GetHeroName('defender-hero') == 'hero name' then
--hero is defending
elseif GetHeroName('attacker-hero') == 'hero name' then
--hero is attacking
else
--not participating
endb) If unitName is in the arguments, then the unit names are determined by the GetAttackerCreatures or GetDefenderCreatures functions, which return an array. 'attacker-hero' and 'defender-hero' can also be unit names.function Start()
hero = GetAttacker(Defender)Hero
UnitCastAreaSpell(hero, spellID, X, Y)
end