Script to change city ownership

Users who are viewing this thread

Kommissar

Recruit
Hello,

I'm writing a little testing utility that changes hands of a random settlement of main culture. It assigns it to any random clan.
It works, in principle - the city changes hands and is assigned to a new faction. I do this with a small line of code like this:
C#:
currentSettlement.OwnerClan = info.OriginalOwner.Leader.Clan;

After some hours pass though the city goes back to the original owner's hands. I tried removing the garrison and telling all other present parties to leave. Any ideas why the city changes hands back?
 
Have a look at


using TaleWorlds.CampaignSystem.Actions;

ChangeOwnerOfSettlementAction.ApplyByDefaul(hero,settlement)

or the other functions
 
Hi Zervox, thanks. It seems that whatever function I use, the settlement still goes back to original owner. Any reason you might think of for this?
 
Forget it guys. I forgot that I wrote a daily tick (long time ago) that causes this behaviour. I'm an absolute fool.
 
No problem lol, I ended up digging through that file in DLL decompiler and I learned a ton about how the game handles people taking over settlements. Good luck on modding.
 
Back
Top Bottom