Converting puppets to annexed cities

PawelS

Ancient Druid
Joined
Dec 11, 2003
Messages
2,811
Location
Poland
Does anyone know how to create a LUA script that, when an AI creates a puppet, converts it to an annexed city? (Alternatively it can check all cities every turn, and convert all puppets to annexed.)

I need it for my mod where annexed cities cause the same unhappiness as the ones you found (and Courthouse serves a different purpose), and I don't want the AI to have lower policy costs due to puppets (thanks to Slowpoke, I already know how to disable the puppet buttons for the human player).

I'm new to LUA modding (so far I only changed the resource quantities in AssignStartingPlots.lua), so I have no idea how to write this kind of event, in which file to put it etc. I only know that it should probably use the following command (found in PuppetCityPopup.lua):

Code:
Network.SendDoTask(cityID, TaskTypes.TASK_ANNEX_PUPPET, -1, -1, false, false, false, false);
 
in the earth 18 civs scenario in my sig there's an example on how to do this with some checks to catch it
 
Thanks, I found the code that does it (it uses city:SetPuppet(false); which seems to be a simpler method of "unpuppeting" cities than the code I put in the OP), now I'm trying to figure out how to add it to my mod :)

Edit: I think I got it. I should add a "LuaContext" to InGame.xml to make my LUA file used by the game, right?
 
its been a few weeks but iirc i wasnt able to setpuppet false on the city capture, actually had to wait a turn (for human). interested in how you get it to work, that some script i have id like to optimize

and yes, luacontext to ingame.xml
 
I simplified your script, my version just "unpuppets" all puppets every turn (see attachment).

I also added the following to InGame.xml:

Code:
	<LuaContext FileName="Assets/UI/InGame/_UnPuppet"        ID="_Unpuppet"    Hidden="True" />

It works, thanks for help :)
 

Attachments

Back
Top Bottom