Auto-translated
In general, I think it would be useful to dedicate a separate thread specifically to combat scripts (I hope a thread like this hasn't already been created).
Why I wanted to create this thread:
In the file with scripted functions, there is also a description of functions used in battles. For example, I have already used features such as summoning various creatures onto the battlefield, casting targeted/mass/area-of-effect spells, and moving along the ATB scale. However, during experiments with combat scripts, many questions arose, and I haven't found answers to them.
The purpose of this thread:
Personally, I would like to understand how much control a map editor can have over battles using combat scripts. Why, in some cases, a script doesn't work or doesn't produce the desired result, and how to achieve that result. Also, beginner map editors will have the opportunity to get to know combat scripts better.
Here are just a few questions that I remember and have wanted to ask for a long time:
1) Can combat scripts be used to temporarily increase the stats of creatures/heroes during a battle? (e.g., give +1 to the speed of friendly creatures).
2) Can a creature be given an ability during a battle that it doesn't normally have? (unlikely, but who knows...)
3) How can I make it so that when a hero casts a spell using a script, they don't move back on the ATB scale? (of course, you can move the hero along the scale using the corresponding function, but I haven't found a function that returns the CURRENT position of a unit/hero).
4) Situation: a friendly creature starts its turn and attacks an enemy. At this time, the hero casts a conditional magic arrow using a script, and the target creature dies before the attacker reaches it. How can this collision be avoided?
5) Can creatures that normally cannot cast spells cast spells using a combat script? Or those that don't have that spell in their spellbook? Can siege weapons cast spells? :D
6) Can you give extra shots to a ballista or catapult in battle? Increase damage/healing power?
7) Is there a try-catch structure that allows you to ignore errors that occur during script execution?