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

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...