> For the complete documentation index, see [llms.txt](https://yigu-studio.gitbook.io/bannerlord-modding-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yigu-studio.gitbook.io/bannerlord-modding-cn/_csharp-api/campaignsystem/actions/changeownerofsettlementaction.md).

# ChangeOwnerOfSettlementAction

The function of this class is to set or change the owner of a settlement.

## Functions

Here is a list of functions that detail different ways a settlement can change ownership:

* `ApplyByDefault(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`hero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)` - Called at the start of a campaign or when a player cheats to attain a settlement
* `ApplyByKingDecision(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`hero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyBySiege(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`newOwner,`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`capturerHero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyByRevolt(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`hero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyByLeaveFaction(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`hero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyByBarter(`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`hero,`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyByRemoveFaction(`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement)`
* `ApplyByDestroyClan(`[Settlement](/bannerlord-modding-cn/_csharp-api/campaignsystem/settlement.md)`settlement,`[Hero](/bannerlord-modding-cn/_csharp-api/campaignsystem/hero.md)`newOwner)` - Called when owner of settlement dies, when this happens, the fief is passed to a random child of the previous owner
