mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-05 13:04:54 +02:00
Update documentation, add examples
This commit is contained in:
parent
6fa2bb7e91
commit
42902b8eb5
@ -1,6 +1,6 @@
|
|||||||
# Town Building Format
|
# Town Building Format
|
||||||
|
|
||||||
# Required data
|
## Required data
|
||||||
|
|
||||||
Each building requires following assets:
|
Each building requires following assets:
|
||||||
|
|
||||||
@ -9,6 +9,76 @@ Each building requires following assets:
|
|||||||
- Selection area (1 image)
|
- Selection area (1 image)
|
||||||
- Town hall icon (1 image)
|
- Town hall icon (1 image)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
These are just a couple of examples of what can be done in VCMI. See vcmi configuration files to check how buildings from Heroes III are implemented or other mods for more examples
|
||||||
|
####
|
||||||
|
|
||||||
|
##### Order of Fire from Inferno:
|
||||||
|
```jsonc
|
||||||
|
"special4": {
|
||||||
|
"requires" : [ "mageGuild1" ],
|
||||||
|
"name" : "Order of Fire",
|
||||||
|
"description" : "Increases spellpower of visiting hero",
|
||||||
|
"cost" : {
|
||||||
|
"mercury" : 5,
|
||||||
|
"gold" : 1000
|
||||||
|
},
|
||||||
|
"configuration" : {
|
||||||
|
"visitMode" : "hero",
|
||||||
|
"rewards" : [
|
||||||
|
{
|
||||||
|
// NOTE: this forces vcmi to load string from H3 text file. In order to define own string simply write your own message without '@' symbol
|
||||||
|
"message" : "@core.genrltxt.582",
|
||||||
|
"primary" : { "spellpower" : 1 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Mana Vortex from Dungeon
|
||||||
|
```jsonc
|
||||||
|
"special2": {
|
||||||
|
"requires" : [ "mageGuild1" ],
|
||||||
|
"name" : "Mana Vortex",
|
||||||
|
"description" : "Doubles mana points of the first visiting hero each week",
|
||||||
|
"cost" : {
|
||||||
|
"gold" : 5000
|
||||||
|
},
|
||||||
|
"configuration" : {
|
||||||
|
"resetParameters" : {
|
||||||
|
"period" : 7,
|
||||||
|
"visitors" : true
|
||||||
|
},
|
||||||
|
"visitMode" : "once",
|
||||||
|
"rewards" : [
|
||||||
|
{
|
||||||
|
"limiter" : {
|
||||||
|
"noneOf" : [ { "manaPercentage" : 200 } ]
|
||||||
|
},
|
||||||
|
"message" : "As you near the mana vortex your body is filled with new energy. You have doubled your normal spell points.",
|
||||||
|
"manaPercentage" : 200
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Resource Silo with custom production
|
||||||
|
```jsonc
|
||||||
|
"resourceSilo": {
|
||||||
|
"name" : "Wood Resource Silo",
|
||||||
|
"description" : "Produces 2 wood every day",
|
||||||
|
"cost" : {
|
||||||
|
"wood" : 10,
|
||||||
|
"gold" : 5000
|
||||||
|
},
|
||||||
|
"produce" : {
|
||||||
|
"wood": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
## Town Building node
|
## Town Building node
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
@ -65,11 +135,11 @@ Each building requires following assets:
|
|||||||
// Buildings which bonuses should be overridden with bonuses of the current building
|
// Buildings which bonuses should be overridden with bonuses of the current building
|
||||||
"overrides" : [ "anotherBuilding ]
|
"overrides" : [ "anotherBuilding ]
|
||||||
|
|
||||||
// Bonuses, provided by this special building on build using bonus system
|
// Bonuses provided by this special building if this building or any of its upgrades are constructed in town
|
||||||
"bonuses" : BONUS_FORMAT
|
"bonuses" : [ BONUS_FORMAT ]
|
||||||
|
|
||||||
// Bonuses, provided by this special building on hero visit and applied to the visiting hero
|
// If set to true, this building will replace all bonuses from base building, leaving only bonuses defined by this building"
|
||||||
"onVisitBonuses" : BONUS_FORMAT
|
"upgradeReplacesBonuses" : false,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -94,7 +164,8 @@ Building requirements can be described using logical expressions:
|
|||||||
```
|
```
|
||||||
### List of unique town buildings
|
### List of unique town buildings
|
||||||
|
|
||||||
Following Heroes III buildings can be used as unique buildings for a town. Their functionality should be identical to a corresponding H3 building:
|
#### Buildings from Heroes III
|
||||||
|
Following Heroes III buildings can be used as unique buildings for a town. Their functionality should be identical to a corresponding H3 building. H3 buildings that are not present in this list contain no hardcoded functionality. See vcmi json configuration to see how such buildings can be implemented in a mod.
|
||||||
- `mysticPond`
|
- `mysticPond`
|
||||||
- `artifactMerchant`
|
- `artifactMerchant`
|
||||||
- `freelancersGuild`
|
- `freelancersGuild`
|
||||||
@ -103,64 +174,18 @@ Following Heroes III buildings can be used as unique buildings for a town. Their
|
|||||||
- `creatureTransformer`
|
- `creatureTransformer`
|
||||||
- `portalOfSummoning`
|
- `portalOfSummoning`
|
||||||
- `ballistaYard`
|
- `ballistaYard`
|
||||||
- `stables`
|
|
||||||
- `manaVortex`
|
|
||||||
- `lookoutTower`
|
|
||||||
- `library`
|
- `library`
|
||||||
- `brotherhoodOfSword`
|
|
||||||
- `fountainOfFortune`
|
|
||||||
- `escapeTunnel`
|
- `escapeTunnel`
|
||||||
- `lighthouse`
|
|
||||||
- `treasury`
|
- `treasury`
|
||||||
- `spellPowerGarrisonBonus`
|
|
||||||
- `attackGarrisonBonus`
|
|
||||||
- `defenseGarrisonBonus`
|
|
||||||
|
|
||||||
|
#### Buildings from other Heroes III mods
|
||||||
Following HotA buildings can be used as unique building for a town. Functionality should match corresponding HotA building:
|
Following HotA buildings can be used as unique building for a town. Functionality should match corresponding HotA building:
|
||||||
- `thievesGuild`
|
- `thievesGuild`
|
||||||
- `bank`
|
- `bank`
|
||||||
|
|
||||||
In addition to above, it is possible to use same format as [Rewardable](../Map_Objects/Rewardable.md) map objects for town buildings. In order to do that, town building type must be set to `configurable` and configuration of a rewardable object must be placed into `configuration` node
|
#### Custom buildings
|
||||||
|
In addition to above, it is possible to use same format as [Rewardable](../Map_Objects/Rewardable.md) map objects for town buildings. In order to do that, configuration of a rewardable object must be placed into `configuration` json node in building config.
|
||||||
|
|
||||||
Example 1 - Order of Fire from Inferno:
|
|
||||||
```jsonc
|
|
||||||
"special4": { //
|
|
||||||
"type" : "configurable",
|
|
||||||
"requires" : [ "mageGuild1" ],
|
|
||||||
"configuration" : {
|
|
||||||
"visitMode" : "hero",
|
|
||||||
"rewards" : [
|
|
||||||
{
|
|
||||||
"message" : "@core.genrltxt.582", // NOTE: this forces vcmi to load string from H3 text file. In order to define own string simply write your own message without '@' symbol
|
|
||||||
"primary" : { "spellpower" : 1 }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Example 2 - Mana Vortex from Dungeon
|
|
||||||
```jsonc
|
|
||||||
"special2": {
|
|
||||||
"type" : "configurable",
|
|
||||||
"requires" : [ "mageGuild1" ],
|
|
||||||
"configuration" : {
|
|
||||||
"resetParameters" : {
|
|
||||||
"period" : 7,
|
|
||||||
"visitors" : true
|
|
||||||
},
|
|
||||||
"visitMode" : "once",
|
|
||||||
"rewards" : [
|
|
||||||
{
|
|
||||||
"limiter" : {
|
|
||||||
"noneOf" : [ { "manaPercentage" : 200 } ]
|
|
||||||
},
|
|
||||||
"message" : "@core.genrltxt.579",
|
|
||||||
"manaPercentage" : 200
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Town Structure node
|
### Town Structure node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user