Jump to content

Garrisoning units


 Share

Recommended Posts

Well it's not hard, you just have to know a couple of things.

Here's my topic where I asked the exact same thing https://wildfiregames.com/forum/index.php?/topic/24774-garrison-units-from-the-editor/&tab=comments#comment-361355

 

Basically you've to "invoke" a trigger script and let it do what you want; in this case I wanted to garrison people, so:

1- Trigger:

Trigger.prototype.InitMyMap_GarrisonBuildings = function()

2- Who do I want to garrison?  I want infantry units, he'll decide which ones; they have to be romans and be Elite:

let romeInfantryUnits = TriggerHelper.GetTemplateNamesByClasses("CitizenSoldier+Infantry", "rome", undefined, "Elite", true);

3- Where and how many people do I want to garrison? I want the 20% of the maximum garrison number in everything that responds to the class of tower; they've to be Roman infantry units, belonging to player 1:

TriggerHelper.SpawnAndGarrisonAtClasses(2, "Tower", romeInfantryUnits, 1); 

 

Before you do anything, though, you've to tell the game he's to look where the triggers are, in my case in

    "scripts/TriggerHelper.js",
    "skirmishes/Gauls_vs_Romans.js"

The first one is the reference for triggers in the whole game, the second one is my personal script referred to that particular map

  • Thanks 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...