Jump to content

Any way to restrict what classes a unit can attack?


chaosislife
 Share

Recommended Posts

Actually, in this case, I just want my siege tower to only attack military units and let economy units just walk right by. With the preferred classes it attacks the military units first, but then goes on to attack the economy units once the military ones are all dead. I also want it to not attack walls because I like to try to salvage the walls in the fortress maps so I can build my new base inside them. Allowing the economy units to live weakens their military in that they can't build many new military units when they've got 200 plus gatherers.

Edited by chaosislife
Link to comment
Share on other sites

I think its really stupid for siege weapons like the battering ram to attack individual military units. I can understand the ballistae and the catapult to shoot at military units, but a battering ram?

Since when can battering rams attack units? When I try it, it can only attack buildings.

Link to comment
Share on other sites

Actually, in this case, I just want my siege tower to only attack military units and let economy units just walk right by. With the preferred classes it attacks the military units first, but then goes on to attack the economy units once the military ones are all dead. I also want it to not attack walls because I like to try to salvage the walls in the fortress maps so I can build my new base inside them. Allowing the economy units to live weakens their military in that they can't build many new military units when they've got 200 plus gatherers.

see: template_unit_mechanical_siege_ram.xml


<RestrictedClasses datatype="tokens">Organic</RestrictedClasses>
<PreferredClasses datatype="tokens">Gates Structure</PreferredClasses>

Replicate this. This is how it's done for what you are talking about in this thread. In the example you give with your siege tower, you would put "Support" where "Organic" is in my example.

  • Like 1
Link to comment
Share on other sites

Hmmm, didn't get errors this time, probably entered it wrong last time. Still, it doesn't work the way I want. It might not be attacking the support units with it's main attack but it's definitely firing off a million garrison arrows at them so I can't really tell if it's working or not. I'll try that on my archers and see if it works there. Also, I forget just what civ's ram it is, possibly Persians, but the one that has a beam that goes up and down still auto attacks all types of units, at least when it's in the hands of the AI players. Edit : It works for the archers, but still doesn't work for the towers garrison attack. Still, very useful for controlling my victims military capability. Edit 2: Nope doesn't even work for the tower's regular un-garrisoned attack

Edited by chaosislife
Link to comment
Share on other sites

That is because buildings (and by extension siege towers and ships (sort of a hack)) don't check for preferred or restricted classes in the attack component. If we want them to support that, we should create a new ticket to make cmpBuildingAI adhere to those cmpAttack restrictions. (Note to whoever creates the ticket: Should have the 'simple' keyword)

Link to comment
Share on other sites

Ticket Created : http://trac.wildfiregames.com/ticket/1985

Hmmm, until that's done, could a full unit type handle garrison attack capability or unit building? My tower o' doom is pretty much a mobile command base. Could make an elephant o' doom I suppose. Or a PF-51 Mustang O' Doom? hmmmmm.

Edit: do the elephants somehow use the building AI? I just added restrictions to my amped versions of the Mauryan war elephants and they completely ignored them and went about attacking the civies once the buildings were knocked down.

Edit 2: I'll have to test it on other unit types to be really sure, but so far it looks as if the AI needs work in reference to this. My elephants obey the restrictions fine only so long as they're in standground stance. Once I put them in violent, aggressive, or defensive they ignore the restrictions and target everything. But then since they're in stand ground and they're melee they couldn't attack anything anyhow unless it walked into them. Could it have something to do with them being allowed to attack walls by default? I've never found what controls that.

Edited by chaosislife
Link to comment
Share on other sites

Since when can battering rams attack units? When I try it, it can only attack buildings.

One of the moments I started laughing was when I was playing the game for the first time and I build a watchtower and then the Ai started building a watch tower on the other side. I was like; Haha, what is this for silly game!

Another moment was when a battering ram attacked another battering ram. Though I guess it would work in theory.

Link to comment
Share on other sites

It'd work well in practice too, a battering ram is similar in function to a tank, it's meant to be nearly impervious to arrows, and decent against swords......it's basically a rolling house afterall. But another ram would tear it apart. In all honesty a ram would also destroy any infantry or cavalry that make the mistake of standing directly in front of it. In practice however infantry and cavalry don't tend to stand directly in front of an oncoming ram, so having our rams able to attack them is impractical.

Link to comment
Share on other sites

It'd work well in practice too, a battering ram is similar in function to a tank, it's meant to be nearly impervious to arrows, and decent against swords......it's basically a rolling house afterall. But another ram would tear it apart. In all honesty a ram would also destroy any infantry or cavalry that make the mistake of standing directly in front of it. In practice however infantry and cavalry don't tend to stand directly in front of an oncoming ram, so having our rams able to attack them is impractical.

Oh god I made this topic off-topic.

Well it would work in practice if you would ever face battering ram to battering ram. Hehe.

I assume the way to destroy them was fire (I thought I read that in a medieval book) and simply going inside and kill the men manning it.

I think the battering rams need a bit of work. They seem too fast, and on the other hand way to vulnerable to arrows. Though they are already quite strong.

I'm not going to respond to a second post regarding this topic. I don't want to derail this thread.

Link to comment
Share on other sites

you can use the following lines within their melee attack bracket to enable them to only attack walls, buildings, and seige weapons.

<PreferredClasses datatype="tokens">Wall Structure Siege</PreferredClasses>

<RestrictedClasses datatype="tokens">Infantry Cavalry Support Organic</RestrictedClasses>

and if you add the following to the <identity> bracket in "template_unit_mechanical_siege_ram" you should be able to change the "Siege" to "SiegeRam" so they only attack walls, buildings and rams.

<Classes datatype="tokens">SiegeRam</Classes>

This should all work, unless of course the ram is buggy like the siege elephant is. Just make sure you put everything in the right place and whatnot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...