• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making siege units focus buildings

Status
Not open for further replies.
Level 7
Joined
Aug 16, 2019
Messages
61
I have a non-melee custom map, which involves some computer controlled units. Some of these are siege units with an attack for units and one for buildings (they're based on Mortar Teams) and I would like to make these units target buildings rather than units whenever they're within range.

I don't want other units to focus buildings so I can't just change the attack priority of the buildings so what else can I do? I could probably make some messy triggers that get the job done, but I'm hoping there's a smarter way to do it.

I know the custom AI has a 'Smart Artillery' option, which sounds like exactly what I need, but when running the AI script for the computer, it doesn't seem to make any difference.
 
Level 12
Joined
Jun 15, 2016
Messages
472
I think smart artillery targeting is based on how the firing unit and the target unit are classified. The classification itself is done in the object editor. So the problem itself could be in the object editor.

What I suggest is to do the following test:
Try the same script with actual mortar teams and buildings, not custom units. If the vanilla units display the behavior you want, try replacing the mortar teams with your edited siege only, then try replacing the vanilla buildings with your edited ones. See who breaks the behavior and check the object data accordingly.
 
Level 12
Joined
Jun 15, 2016
Messages
472
WAI files are for the AI editor, I need the .ai file itself. You can get it using the export option in the AI editor (should look like a page with a green arrow next to it).

Then you can upload it by zipping, or simply change the file to a text file, it works too.
 
Level 12
Joined
Jun 15, 2016
Messages
472
Well, I don't really know what's going on with that. You have a generic AI editor script, which should work by all accounts. As you can see from the last line here:

JASS:
function InitOptions takes nothing returns nothing
    call SetCampaignAI(  )
    call SetDefendPlayer( false )
    call SetRandomPaths( false )
    call SetTargetHeroes( false )
    call SetPeonsRepair( false )
    call SetHeroesFlee( false )
    call SetHeroesBuyItems( false )
    call SetUnitsFlee( false )
    call SetGroupsFlee( false )
    call SetWatchMegaTargets( false )
    call SetIgnoreInjured( false )
    call SetHeroesTakeItems( false )
    call SetSlowChopping( false )
    call SetCaptainChanges( false )
    call SetSmartArtillery( true )
endfunction

The script really does set up to prioritize buildings. And sorry for the delay I'm not very active these days
 
Level 7
Joined
Aug 16, 2019
Messages
61
Well that's okay, thanks for looking at it.
I ended up making something with triggers instead. All siege units gets added to a unit group and a script checks periodically for each of them if they're within range of buildings and orders them to attack that if they are.
It's far from optimal, but it seems to function more or less for now.
 
Status
Not open for further replies.
Top