• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

jiruoan

Private
51 Badges
Oct 23, 2018
11
3
  • Stellaris: Distant Stars
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Cadet
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Prison Architect
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Heir to the Throne
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Cities: Skylines
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Crusader Kings II
  • Europa Universalis IV
  • Magicka
  • Cities: Skylines Deluxe Edition
Hi, I am modding the game trying to grant government-owned buildings to local workforce, but there does not seem to be a way to do so. I see there is `create_building.add_owner` in "history" folder, but I'm unsure if that works for events. Ideally, I want to mod a gui and a scripted_gui to have a button for that (or even better, a popup like `PopupManager.ShowNationalizeBuildingConfirmation`). I would also be OK if it's a decision or trigger under on_building_built.

If this is not currently supported, does the dev team consider adding it in the future? Thanks!
 
  • 1Like
Reactions:
I thought that nationalization would be a great mechanic to add. So was thinking along the same lines. Here's what ChatGPT has to says. Im using the Paradox Interactive Modder GPT which is pretty good, though only up to version 1.6:

Yes, it is possible to change building ownership via events in Victoria 3. The game’s scripting system allows you to modify building ownership, usually by transferring it from one country to another. This can be useful in scenarios where territories change hands, or where certain conditions or diplomatic actions result in the control of buildings shifting.

How to Change Building Ownership via Event:

To change building ownership, you typically use scripted effects in the event system. Here's how you can do it:

**1. **Basic Script Structure for Changing Ownership:​

You’ll use the transfer_building effect to change the ownership of a building from one country to another.

plaintext
Copy code
transfer_building = {
building = [building_type] # Type of building you want to transfer
to = [recipient_country] # The country that will receive the building
from = [current_owner] # The country that currently owns the building
state = [target_state] # The state where the building is located
amount = [number_of_buildings] # (Optional) The amount of buildings to transfer
}

**2. **Example Event Script:​

Let’s say you want to transfer ownership of a factory from one country to another as part of a peace treaty or colonial handover.

plaintext
Copy code
namespace = building_transfer_event

building_transfer_event.1 = {
type = country_event
title = "Ownership Transfer"
desc = "As part of the treaty, the ownership of key industries in [Root.GetName] has been transferred to [target_country.GetName]."

trigger = {
has_diplomatic_pact = {
type = transfer_treaty
who = scope:target_country
}
}

immediate = {
transfer_building = {
building = textile_mills # Example building type
to = scope:target_country # The recipient country
from = root # The current owner, triggering country
state = 1 # The state ID where the building is located
amount = 1 # (Optional) The number of buildings to transfer, defaults to all
}
}

option = {
name = "Transfer Complete"
trigger_event = { id = building_transfer_event.2 } # Optional: Trigger another event after transfer
}
}

**3. Understanding the Parameters:

  • building: This is the type of building you want to transfer, such as textile_mills, arms_industries, or railways. You can find a list of building types in the game files under common/buildings/.
  • to: The recipient country that will take ownership of the building. This can be referenced as scope:target_country or by the specific country tag (e.g., ENG for England).
  • from: The current owner of the building. This is typically the country triggering the event, often referenced as root.
  • state: The ID of the state where the building is located. You can find state IDs in the game files under common/history/states/.
  • amount: This is optional and specifies the number of buildings to transfer. If omitted, it defaults to all buildings of that type in the specified state.

**4. Triggering the Event:

The event can be triggered by various means, such as the conclusion of a war, a diplomatic play, or another event that necessitates the transfer of building ownership.

**5. Considerations:

  • State Ownership: Ensure that the receiving country controls the state where the building is located. If the state is not under the recipient's control, this might cause issues or unintended behavior.
  • Balance: Changing building ownership can have significant effects on a country’s economy and resources. It’s important to consider the balance implications when designing events that transfer buildings.

Summary:

Yes, you can change building ownership via events in Victoria 3 using the transfer_building effect. This allows you to script scenarios where control over specific buildings changes hands, reflecting the outcomes of treaties, conquests, or diplomatic actions. By carefully scripting and testing these events, you can create immersive and impactful gameplay experiences that reflect the historical complexities of territorial and industrial control.
 
Ah GPT, utterly terrible at PDX scripting.

Fairly sure, only the most general outline of that info is correct, if any of it is. I don't believe there is a transfer_building effect in the first place (happy to be proven wrong from example in vanilla or vanilla documentation), and if there were, the structure given is quite odd, e.g. Vic3 doesn't reference state IDs by number, but by script names

Also, there is no vanilla "transfer_treaty" pact, and its localization effects (i.e. [Root.GetName]) are also incorrect for Vic3.
 
Ah GPT, utterly terrible at PDX scripting.

Fairly sure, only the most general outline of that info is correct, if any of it is. I don't believe there is a transfer_building effect in the first place (happy to be proven wrong from example in vanilla or vanilla documentation), and if there were, the structure given is quite odd, e.g. Vic3 doesn't reference state IDs by number, but by script names

Also, there is no vanilla "transfer_treaty" pact, and its localization effects (i.e. [Root.GetName]) are also incorrect for Vic3.

Yeah its not great for sure. I've had some success pumping it full of existing events and such and telling it to adapt to whatever I'm trying to do.

Can you destroy a building via event and then create a building via event, maybe?

Victoria 3\game\events\test_events.txt
2334 # name = "Add 2 levels to barracks"
2335 # scope:cur_state = {
2336: # add_building_level = {
2337 # building = building_barracks
2338 # level = 2
....
2344 # name = "Remove 1 level from barracks"
2345 # scope:cur_state = {
2346: # add_building_level = {
2347 # building = building_barracks
2348 # level = -1

BTW absolutely love 1632 book series.
 
Yeah, I don't think there is a `transfer_building` effect.

Destroying the building then immediately create a building is the closest thing we can get, I guess. It does have downsides though, like everyone become unemployed, I think that also affects radical/loyalists.