Question about making dojo-like buildings

I’ve been trying to make a building that functions like the Japanese dojo (produces free troops over time, can be toggled to different troops) but the coding for the dojo makes no sense for me. Can someone please give me a brief rundown on how to make a building like this? If so, should I start with the code for the dojo or start from scratch due to the dojo’s seemingly very odd code?

Depends on how “Dojo-like” you want to make it.

Yeah it’s convoluted no way around that, but should be doable.

You’ll have to check the dojo tactics, change to the units you want, probably create dummy units so you get the unit groups you want, and then remember to change the flags in your custom building so you can flip through the tactics.

So as I said, doable, but not the most intuitive building.

1 Like

What do you mean by dummy units? Is there an example of one in protoy.xml?

Yeah look up any unit with “abstractbannerarmy” and then check the civs that have access to that banner army in the civs.xml file.

Does the fact that dojo tactics count as dance bonuses mean that it won’t function properly with native civs?

Also, what does this mean in the dojo tactics?

    <modifymultiplier>0.065</modifymultiplier>
    <modifyexponent>1.03</modifyexponent>
    <modifybase>0.0</modifybase>

If I had to do that, I would search in the Texas fort files for that, including the fort tactics. I would hope is less convoluted than the Dojo

1 Like

Honestly, never stopped to check that. Maybe.

Those modify multiplier and exponents, if I’m not mistaken, is the percentage vills contribute towards their production when working the Plaza. Why does the Dojo have that. I dunno.

Asians have a hardcoded “ghost” villager dancing to power it. Summer Palace and Dojos work like that for some inexplicable reason.

1 Like

Where is the code for this ghost unit stored? Can it be given to any civ?

As far as I’m aware it’s hardcoded to the civs so it’s not something that can be modded. You could only really use this method for Asian civs and potentially native civs (though the plaza would turbocharge it).

But as others have said, there’s probably other methods that could get you the same end result for any civ. @SealingEar046 suggested trying to copy Texas Forts.

For block trained units such as Dojo armies or banner armies there’s a dummy unit that spawns the whole group when trained. And auto-training units (like Heavy Cannons in Factories) works for any civ. So combining those functions would probably do what you want.

1 Like

What I’m trying right now is using the code for the hacienda that automatically spawns soldados/chicanos since it looked the simplest.

Doesn’t that one also use dance-like effects?

Yes but it looks like it preserves the train time and I’m guessing if I set <modifybase>1.0</modifybase> it would be interpreted as having a gatherer, if it doesn’t work I’m going to test around with the Texan fort. My issue right now is that the units aren’t even appearing in the building, so I’m trying to see if I can fix that.

I was able to get it working by adding <maintaintrainpoints>270</maintaintrainpoints> to the tactics, so it wasn’t reliant on a community plaza-like work rate. If anyone else ever has this problem, the action entries in the tactics file should look something like this:

  <action>
    <name stringid="(number)">(name of action)</name>
    <type>DanceBonus</type>
    <dancebonustype>UnitSpawn</dancebonustype>
    <active>1</active>
    <persistent>1</persistent>
    <modifyprotoid>(dummy unit)</modifyprotoid>
    <maintaintrainpoints>(desired train time)</maintaintrainpoints>
    <modifymultiplier>0.325</modifymultiplier>
    <modifyexponent>0.9656</modifyexponent>
    <modifybase>1.0</modifybase>
  </action>
1 Like