A cry for help

GeminiDark

Chieftain
Joined
Sep 19, 2020
Messages
2
I've spent days trying to figure out how to do something, and while I think I'm on the right path, I can't get it to work. I also don't know how to go about coding another thing.

Basically, I need help with making a unique unit that can only be made once per game, and only by the civilization I'm making. I'm trying to do this through a unique Strategic Resource that I made, but I can't seem to get the mod to give the resource. I tried attaching it to the Leader Trait and to the unique building for the civ, but for some reason I can't get the building to work at all (despite getting it from a template and changing "Granary" to "Library" in what it replaces) so I can't even see if I'm able to give the resource via a building, and I can't get it to work with the leader trait.

Ideally, I'd set the leader trait to be that it starts the game with a single instance of the resource so that once the unit has its unlock criteria met, it would be able to be made one time. Though failing that, if I have to make the unique building one of a kind with MaxWorldInstances I could do that if I could get the building to work at all. I'm going to keep hammering away at it but...

Literally any advice would be helpful.
 
IIRC there is a method in Lua that was introduced in a scenario (I don't remember which one) to prevent an unit to be build by specific players.

I'd use that in a script running on start/load, removing at that time the unique unit from the build list for the player with your leader trait if the unit has been build once (and when it's build using the related city construction event)
 
I figured it out. I had to tie it to a unique building, set its MaxWorldInstances to 1, then use 'MODIFIER_SINGLE_CITY_GRANT_RESOURCE_IN_CITY' to grant a single copy of the resource. Which I had tried before but since my code was wrong somehow with the building I couldn't even build it to test that out.
 
Top Bottom