Modding

There are several ways to mod the game.

## **Always Do This Stuff**

* Make a mod folder
* Name the mod folder something not already there

## Provinces

### **Summary**

The easiest way to mod provinces with little in-depth work is to copy and paste it from another province, then edit what you need to change. For example, you want to make the province of Asgard, copy and paste it from another nation, then edit it.

### **Step-by-Step Guide**

You can ensure you have done it right by following the steps.

Ensure that all the cultures, religions, etc. you want are already in the game. You can do this by checking the relevant scripts in the ie\_core's scripts subfolder. Also ensure that you have a nation to give the province to.

1) Copy and paste a province's code

```
    province = Province:create{ ref\_name = "dresden", color = 0x8cb2ff }
    province.name = \_("Dresden")
    province:register()
    province:add\_pop(artisan, german, protestant, 5000, 0.9)
    province:add\_pop(farmer, german, protestant, 40000, 0.8)
    province:add\_pop(soldier, german, protestant, 8000, 0.8)
    province:add\_pop(craftsmen, german, protestant, 5000, 0.9)
    province:add\_pop(bureaucrat, german, protestant, 5000, 0.9)
    province:add\_pop(aristocrat, german, protestant, 5000, 0.9)
    province:add\_pop(clergymen, german, protestant, 5000, 0.9)
    province:add\_pop(laborer, german, protestant, 50000, 0.8)
    province:add\_pop(entrepreneur, german, protestant, 800, 0.9)
    province:add\_nucleus(saxony)
    province:give\_to(saxony)
    saxony:set\_capital(province)

```

The first line of this code, where it establishes a variable, defines it as being a Province class, then using the Province:create function is how creating the definition of it for the game. It has the reference name, meaning it is what will be used to reference that province in things, ex events. The hexadecimal is the color the province is on the game map. If it isn't on the map, then the province won't show up. The province name is what it will look like when the player right-clicks on it, showing the province information. The game will show it as Dresden. It then hands over the name, reference, and color to the Province register function, thus actually creating it.
The traits after it are defining it, from giving it pops, to adding nuclei, to giving the province to Saxony, to setting the province as the capital of Saxony

2) Check that the reference id, hexadecimal color, province name, province nuclei, province owner, and the job, culture, religion, and amount of pops are accurate

Asgard isn't German protestant, it's Asgardian Norse, owned by Asgard, as well as being its capital. This means that we need to replace it. Be sure to put whatever color you made the Asgard province on the map in the blank.

```
    province = Province:create{ ref\_name = "asgard", color = 0x\_\_\_\_\_\_ }
    province.name = \_("Asgard")
    province:register()
    province:add\_pop(artisan, asgardian, norse, 5000, 0.9)
    province:add\_pop(farmer, asgardian, norse, 40000, 0.8)
    province:add\_pop(soldier, asgardian, norse, 8000, 0.8)
    province:add\_pop(craftsmen, asgardian, norse, 5000, 0.9)
    province:add\_pop(bureaucrat, asgardian, norse, 5000, 0.9)
    province:add\_pop(aristocrat, asgardian, norse, 5000, 0.9)
    province:add\_pop(clergymen, asgardian, norse, 5000, 0.9)
    province:add\_pop(laborer, asgardian, norse, 50000, 0.8)
    province:add\_pop(entrepreneur, asgardian, norse, 800, 0.9)
    province:add\_nucleus(asgard)
    province:give\_to(asgard)
    asgard:set\_capital(province)

```

3) Save the province file, and remove the province's color from unknown.lua; since we added a province that wasn't there originally, we don't need this step, but you should always double-check.

4) To add your province file to the game, create it, then go to init.lua, find the area where it loads the province files, then copy, paste, and edit the reference file so it calls yours.

## Nations

### **Summary**

Navigate to the nations folder, make sure all attributes you want are already in there. Copy and paste the code from another nation, edit it so it fits your nation, and save the file. Remove the province from unknown.lua, and you have created a nation.

### **Step-By-Step Guide**

Navigate to the game files, and go into the scripts folder. From there, go into the nations folder, and open the file.
This example will be adding Asgard as a nation. For the sake of simplicity, the nation of the Netherlands will be copied.

```
    --Netherlands
    netherlands = Nation:create{ ref\_name = "netherlands" }
    netherlands.name = \_("Netherlands")
    netherlands:register()
    netherlands:add\_accepted\_culture(dutch)

    --Asgard
    asgard = Nation:create{ ref\_name = "asgard" }
    asgard.name = \_("Asgard")
    asgard:register(asgard)
    asgard:add\_accepted\_culture(dutch)

```

Asgard has the Asgardian culture, which must be added to cultures. Culture modding is more quicker and easier than nation modding.
Now to finish the nation's creation.

```
    --Asgard
    asgard = Nation:create{ ref\_name = "asgard" }
    asgard.name = \_("Asgard")
    asgard:register()
    asgard:add\_accepted\_culture(asgardian)

```

Now, to create the nation, it needs to have some provinces.

The nation of Asgard has been successfully created.

## Religions

### **Summary**

Go to the area in religions.lua where it creates the religions. Then, copy and paste a religion. Change the unique attributes about it, and save the file.

### **Step-By-Step Guide**

This example will make the Norse religion. Navigate to the religions file. Use the find function to find the section with religions.

Copy and paste a religion.

```
    -- Religion
    protestant = Religion:create{ ref\_name = "protestant" }
    protestant.name = \_("Protestant")
    protestant:register()

```

Edit the religion.

```
    -- Religion
    norse = Religion:create{ ref\_name = "norse" }
    norse.name = \_("Norse")
    norse:register()

```

Save the file. The Norse religion has now been created.

## Cultures

### **Summary**

Go to the area in init.lua where it creates the cultures. Then, copy and paste a culture. Change the unique attributes about it, and save the file.

### **Step-By-Step Guide**

This example will make the Asgardian culture. Navigate to the init.lua file. Use the find function to find the section with cultures.

Copy and paste a culture.

```
    -- American
    yankee = Culture:create{ ref\_name = "yankee" }
    yankee.name = \_("Yankee")
    yankee:register()

```

Edit the culture.

```
    -- Asgardian
    asgardian = Culture:create{ ref\_name = "asgardian" }
    asgardian.name = \_("Asgardian")
    asgardian:register()

```

Save the file. The Asgardian culture has now been created.

## Events

### **Summary**

Go to mod.lua, and enter the file. You should see an event. Copy it. Edit all the relevant parts.

### **Step-By-Step Guide**

Go to mod.lua, then copy and paste the first event. For this example, the cake event will be edited.

```
function cake\_test()
	-- Requirements
	return EVENT\_CONDITIONS\_MET
end
function cake\_event()
	local title = "Cake"
	local text = "Sir, a cake has just magically appeared in your desk, what would you like to do?"
	descision = Descision:new{
		ref\_name = "cake\_descision\_0",
		name = "I think i will eat it",
		descision\_fn = "cake\_descision\_0",
		effects = "You will consume cake"
	}
	cake\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "cake\_descision\_1",
		name = "Fuck you",
		descision\_fn = "cake\_descision\_1",
		effects = "You will consume cake anyways"
	}
	cake\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "cake\_descision\_2",
		name = "Cake!?",
		descision\_fn = "cake\_descision\_2",
		effects = "Your compulsory desire for cake has began to grow"
	}
	cake\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "cake\_descision\_3",
		name = "Britain, we have a problem",
		descision\_fn = "cake\_descision\_3",
		effects = "What the fuck is britain gonna do, invade us?"
	}
	cake\_thing:add\_descision(descision)
	return EVENT\_DO\_ONE\_TIME
end
function cake\_descision\_0()
	print('The cake tasted like a cake, what a surprise! and you find a bunch of peseants outside your palace... oh no')
end
function cake\_descision\_1()
	print('Why no eat my poisoned cake? i put so much poison in it :(')
end
function cake\_descision\_2()
	print('Bruh, where the fuck am i?')
end
function cake\_descision\_3()
	print('Britain converted the cake into tea')
end
cake\_thing = Event:new{
	ref\_name = "cake\_thing",
	conditions\_fn = "cake\_test",
	event\_fn = "cake\_event",

	title = "Cake",
	text = "Sir, a cake has just magically appeared in your desk, what would you like to do?"
}
cake\_thing:register()
cake\_thing:add\_receivers(Nation:get("hawai\_i"))

```

First, add any requirements. Then, edit any parts of the mod that you want to change. First, the name, reference, and description. Then the decisions

```
function cake\_event()
	local title = "Thor Banished!"
	local text = "Thor Odinson has been banished from Asgard!"
	descision = Descision:new{
		ref\_name = "thor\_descision\_0",
		name = "Thor has been banished, and there he will stay",
		descision\_fn = "thor\_descision\_0",
		effects = "Thor never comes back"
	}
	thor\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "thor\_descision\_1",
		name = "Thor will be returned!",
		descision\_fn = "cake\_descision\_1",
		effects = "Thor comes back"
	}
	thor\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "thor\_descision\_2",
		name = "Thor will learn his lesson",
		descision\_fn = "cake\_descision\_2",
		effects = "Thor will eventually return"
	}
	thor\_thing:add\_descision(descision)

	descision = Descision:new{
		ref\_name = "thor\_descision\_3",
		name = "Britain gets involved",
		descision\_fn = "cake\_descision\_3",
		effects = "Britain gets Thor"
	}
	thor\_thing:add\_descision(descision)
	return EVENT\_DO\_ONE\_TIME
end

```

Next, edit the decisions.

```
function cake\_descision\_0()
	print('Thor will never return')
end
function cake\_descision\_1()
	print('Thor returns')
end
function cake\_descision\_2()
	print('Thor must become worthy again')
end
function cake\_descision\_3()
	print('Britain has Thor now')
end

```

Finally, edit the event's ending.

```
cake\_thing = Event:new{
	ref\_name = "thor\_thing",
	conditions\_fn = "thor\_test",
	event\_fn = "thor\_event",

	title = "Thor Banished!",
	text = "Thor Odinson has been banished from Asgard!"
}

```

Now the event is complete.