Preventing Onagers from cutting down trees

I’ve recently learned about three different methods to prevent Onagers/Siege Onagers from cutting through forests. These methods, all using triggers, are pretty simple, but I think this is something still worth sharing.

Method 1: Dead Unit ID
This method uses the Modify Attribute effect to automatically respawn trees when they die. First,

  • Create a trigger with a Modify Attribute effect
  • Under Source Player, select Gaia
  • Under Object List Type, select Others
  • Under Object List, select the tree that you want to prevent the Onagers from cutting. For example, if you don’t want an Onager cutting through a Pine Forest, select “Tree (Pine Forest)” as your object.
  • Under Object Attributes, select Dead Unit ID
  • Under Operation, select Set
  • Finally, under Quantity, set the quantity to the tree’s item ID For Tree (Pine Forest), you would enter a value of 350.

Here’s how your Modify Attribute should look like:

This method makes the target tree not only invincible to Onagers, but make them have an infinite amount of resources. This means that, alongside Onagers, Lumberjacks will also be unable to remove trees. You can disable invincible trees, though, by creating another effect that changes the Dead Unit ID back to the default Dead Unit ID (for Tree (Pine Forest), the default Dead Unit ID is 415).

I actually made a custom scenario using this method:

But what if you want Lumberjacks to chop through forests, but don’t feel like toggling invincibility on and off. Well…

Method 2: Blast Defense Level
All units have a Blast Attack Level and a Blast Defense Level. Blast attacks only harm units with a Blast Defense Level equal to or greater than the blast attack’s Blast Attack Level. The Mangonel has a Blast Attack Level of 2 while Onagers/Siege Onagers have a Blast Attack Level 1. Trees have a Blast Defense Level of 1, which is why by default Onagers can cut trees while Mangonels can’t.

Like with Dead Unit IDs, Blast Defense Levels can be edited with the Modify Attribute effect:

  • Once again, set Source Player to Gaia, Operation to Set and Object List to the target tree
  • This time, set Object Attributes to Blast Defense Level
  • Finally, set Quantity to 0. Because 0 < 1, Onagers/Siege Onagers will now be unable to cut down your trees

Here’s how your Modify Attribute should look like (I used dragon trees in this screenshot):

While Onagers can’t cut down these trees, Lumberjacks can still chop them, given that trees aren’t automatically respawning when they die (as seen in Method 1). You also might think that, as opposed to modifying Blast Defense Level, you can instead set the Onager’s Blast Attack Level to 2 with Modify Attribute. Unfortunately, I think the Blast Attack Level attribute may be hardcoded, so you’re probably stuck with modifying Blast Defense Level in the meantime.

Modify Attribute affects units regardless of location. But what if, for aesthetics purposes, you only want certain sections of your forest to be Onager cuttable?

Method 3: Remove Object
Projectiles, including Onager projectiles, are actually considered to be units, even though they’re unavailable under the unit tab.

Confusingly, Onagers/Siege Onagers projectiles are named “Projectile Mangonel” while Mangonel projectiles are named “Projectile Onager.”

All projectile units have a class of 11 (Miscellaneous). And you know what Effect can remove units? The Remove Object effect. To block projectiles with the Remove Object effect:

  • Create a Remove Object effect under a looping trigger
  • Set the area where you want to block projectiles from flying through
  • Set Source Player to Player 1
  • Set Object Group to Miscellaneous
  • Finally, set Object State to Alive

This is how your Remove Object effect should appear:

With this, you can now prevent Onagers from chopping trees in specific areas, as opposed to the whole map, while also preventing infinite Wood resources. I believe this is the same method used to prevent players from Onager cutting to the battlefield in the The Fruits of Her Labor scenario (DLC campaigns are encrypted, so I can’t view these scenarios in the editor). And yes, if you enable aegis in that scenario, Lumberjacks will eventually chop their way to the battlefield.

This method is not perfect, though. Assuming your area follows the tree line, Onagers will still be able to cut about 5 tiles deep into your forest. I think this has to deal with the fact even without a Timer condition, a looping trigger only activates once per second, leaving a second long gap where a projectile could still land. Therefore, make sure your forests are pretty big before using this method.