1. I don't know if there's a minimum range or if it's just the fact that the fort won't let it target itself, but either way it's not something you can fix in worldbuilder and you'd have to make a map.ini for this. But isn't it kind of pointless for them to use fireball on their own buildings? I mean what you could do is make the lightning and fireball only damage units and not buildings.. which can be done in two different ways I believe, one of which is changing the armor for their fortress and the damage type for the fireball, but then you've got yourself even more ini stuff to learn.
What you can do in worldbuilder is having them fire rain of fire or something on the units when they are around the fort. My suggestion is making two areas. One that covers everything your current area does, except for a small area around their fortress, and another that covers only that small area around the fort. Then, I'd do something else to those units if they are inside that fort area. Like using oil on the Mordor fortress... or possibly spawning orcs next to it.
Current script i have checks if a particular unit is in area X and then fires mighty catapult at the nearest unity of that type
So i was thinking along the lines of, if infantry is in area X, shoot on closest infantry in area X? Is that doable?
I'm guessing you have a bunch of named units which spawn on your map and you're using the names of those to check whether they are in the area or not? Like this:
**IF** Unit 'UnluckyUnit01' is inside area 'X'
**OR** Unit 'UnluckyUnit02' is inside area 'X'
? In that case, you can reduce the amount of scripts and make it easier to add/change units by using unit types instead: (You can find this under Player instead of Unit)
**IF** 'Player_1' has Greater Than or Equal To 1 unit with KIND OF 'CAVALRY' in area 'X'
**OR** 'Player_1' has Greater Than or Equal To 1 unit with KIND OF 'INFANTRY' in area 'X'
**OR** 'Player_2' has Greater Than or Equal To 1 unit with KIND OF 'CAVALRY' in area 'X'
**OR** 'Player_2' has Greater Than or Equal To 1 unit with KIND OF 'INFANTRY' in area 'X'
Alternatively, you can use Teams, which also can be very useful. Go to Edit Teams, then to one of the human players. Player_1 for example, if that's the case for you. Add a new team and change its name to something easy to remember... "UnitSpawnP1" for example. Do the same for Player_2.
When you make the unit spawn scripts, pick the UnitSpawn team for the unit you're spawning like so:
Spawn 'UnluckyUnit01' of type 'ElvenLorienArcherHorde' on Team 'Player_1/UnitSpawnP1' at Waypoint 'X'
Then for the area scripts you check if the team is inside it rather than a specific unit:
**IF** Team 'Player_1/UnitSpawnP1' has one or more units in area 'X' (Surfaces Allowed:GROUND)
However, that'd mean you'll have to do all your unit spawn scripts all over again so the first option is probably better for you.
Alternative 3 which is the fastest and easiest, would be to just do a "If player 1 has units in area X", but that's not the smartest move to do if you have builders on your map, as the script will activate by both builders, buildings and even stuff like elven wood when you use it inside area X.
Edited by Jokuc, 16 January 2018 - 12:33 AM.