1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Update documentation

This commit is contained in:
Ivan Savenko 2024-09-02 15:35:02 +00:00
parent a19a55b4ae
commit 525ae72f8e
3 changed files with 199 additions and 14 deletions

View File

@ -14,14 +14,6 @@ Full object consists from 3 parts:
generated by the game. When new object is created its starting
appearance will be copied from template
## Object types
- [Rewardable](Map_Objects/Rewardable.md) - Visitable object which grants all kinds of rewards (gold, experience, Bonuses etc...)
- [Creature Bank](Map_Objects/Creature_Bank.md) - Object that grants award on defeating guardians
- [Dwelling](Map_Objects/Dwelling.md) - Object that allows recruitments of units outside of towns
- [Market](Map_Objects/Market.md) - Trading resources, artifacts, creatures and such
- [Boat](Map_Objects/Boat.md) - Object to move across different terrains, such as water
## Object group format
``` javascript
@ -33,7 +25,8 @@ Full object consists from 3 parts:
// human readable name, localized
"name": "My cool object",
//defines C++/script class name that handles behavior of this object
// defines C++ class name that handles behavior of this object
// see Object Types section below for possible values
"handler" : "mine",
// default values, will be merged with each type during loading
@ -46,6 +39,61 @@ Full object consists from 3 parts:
}
```
## Object types
### Moddable types
These are object types that are available for modding and have configurable properties
- `configurable` - see [Rewardable](Map_Objects/Rewardable.md). Visitable object which grants all kinds of rewards (gold, experience, Bonuses etc...)
- `bank` - see [Creature Bank](Map_Objects/Creature_Bank.md). Object that grants award on defeating guardians. Deprectated in favor of [Rewardable](Map_Objects/Rewardable.md)
- `dwelling` - see [Dwelling](Map_Objects/Dwelling.md). Object that allows recruitments of units outside of towns
- `market` - see [Market](Map_Objects/Market.md). Trading resources, artifacts, creatures and such
- `boat` - see [Boat](Map_Objects/Boat.md). Object to move across different terrains, such as water
- `hillFort` - TODO: documentation. See config files in vcmi installation for reference
- `shipyard` - TODO: documentation. See config files in vcmi installation for reference
- `terrain` - Defines terrain overlays such as magic grounds. TODO: documentation. See config files in vcmi installation for reference
### Common types
These are types that don't have configurable properties, however it is possible to add additional map templates for this objects, for use in editor or in random maps generator
- `static` - Defines unpassable static map obstacles that can be used by RMG
- `generic` - Defines empty object type that provides no functionality. Note that unlike `static`, objects of this type are never used by RMG
- `borderGate`
- `borderGuard`
- `lighthouse`
- `magi`
- `mine`
- `obelisk`
- `subterraneanGate`
- `whirlpool`
- `resource`
- `denOfThieves`
- `garrison`
- `keymaster`
- `pandora`
- `prison`
- `questGuard`
- `seerHut`
- `sign`
- `siren`
- `monolith`
### Internal types
These are internal types that are generally not available for modding and are handled by vcmi internally.
- `hero`
- `town`
- `monster`
- `randomArtifact`
- `randomHero`
- `randomResource`
- `randomTown`
- `randomMonster`
- `randomDwelling`
- `artifact`
- `event`
- `heroPlaceholder`
## Object type format
``` javascript
@ -151,4 +199,4 @@ Full object consists from 3 parts:
"zIndex": 0
}
}
```
```

View File

@ -3,7 +3,116 @@
Reward types for clearing creature bank are limited to resources, creatures, artifacts and spell.
Format of rewards is same as in [Rewardable Objects](Rewardable.md)
``` javascript
Deprecated in 1.6. Please use [Rewardable Objects](Rewardable.md) instead. See Conversion from 1.5 format section below for help with migration
### Example
This example defines a rewardable object with functionality similar of H3 creature bank.
See [Rewardable Objects](Rewardable.md) for detailed documentation of these properties.
```jsonc
{
"name" : "Cyclops Stockpile",
// Generic message to ask player whether he wants to attack a creature bank, can be replaced with custom string
"onGuardedMessage" : 32,
// Generic message to inform player that bank was already cleared
"onVisitedMessage" : 33,
// As an alternative to a generic message you can define 'reward'
// that will be granted for visiting already cleared bank, such as morale debuff
"onVisited" : [
{
"message" : 123, // "Such a despicable act reduces your army's morale."
"bonuses" : [ { "type" : "MORALE", "val" : -1, "duration" : "ONE_BATTLE", "description" : 99 } ]
}
],
"visitMode" : "once", // Banks never reset
// Defines layout of guards. To emulate H3 logic,
// use 'creatureBankNarrow' if guardian units are narrow (1-tile units)
// or, 'creatureBankWide' if defenders are double-hex units
"guardsLayout" : "creatureBankNarrow",
"rewards" : [
{
"message" : 34,
"appearChance" : { "min" : 0, "max" : 30 },
"guards" : [
{ "amount" : 4, "type" : "cyclop" },
{ "amount" : 4, "type" : "cyclop" },
{ "amount" : 4, "type" : "cyclop", "upgradeChance" : 50 },
{ "amount" : 4, "type" : "cyclop" },
{ "amount" : 4, "type" : "cyclop" }
],
"resources" : {
"gold" : 4000
}
},
{
"message" : 34,
"appearChance" : { "min" : 30, "max" : 60 },
"guards" : [
{ "amount" : 6, "type" : "cyclop" },
{ "amount" : 6, "type" : "cyclop" },
{ "amount" : 6, "type" : "cyclop", "upgradeChance" : 50 },
{ "amount" : 6, "type" : "cyclop" },
{ "amount" : 6, "type" : "cyclop" }
],
"resources" : {
"gold" : 6000
}
},
{
"message" : 34,
"appearChance" : { "min" : 60, "max" : 90 },
"guards" : [
{ "amount" : 8, "type" : "cyclop" },
{ "amount" : 8, "type" : "cyclop" },
{ "amount" : 8, "type" : "cyclop", "upgradeChance" : 50 },
{ "amount" : 8, "type" : "cyclop" },
{ "amount" : 8, "type" : "cyclop" }
],
"resources" : {
"gold" : 8000
}
},
{
"message" : 34,
"appearChance" : { "min" : 90, "max" : 100 },
"guards" : [
{ "amount" : 10, "type" : "cyclop" },
{ "amount" : 10, "type" : "cyclop" },
{ "amount" : 10, "type" : "cyclop", "upgradeChance" : 50 },
{ "amount" : 10, "type" : "cyclop" },
{ "amount" : 10, "type" : "cyclop" }
],
"resources" : {
"gold" : 10000
}
}
]
},
```
### Conversion from 1.5 format
This is a list of changes that needs to be done to bank config to migrate it to 1.6 system. See [Rewardable Objects](Rewardable.md) documentation for description of new fields
- If your object type has defined `handler`, change its value from `bank` to `configurable`
- If your object has non-zero `resetDuration`, replace with `resetParameters` entry
- For each possible level, replace `chance` with `appearChance` entry
- If you have `combat_value` or `field` entries inside 'reward' - remove them. These fields are unused in both 1.5 and in 1.6
- Rename `levels` entry to `rewards`
- Add property `"visitMode" : "once"`
- Add property `"onGuardedMessage" : 119`, optionally - replace with custom message for object visit
- Add property `"onVisitedMessage" : 33`, optionally - custom message or morale debuff
- Add property `"message" : 34`, to every level of your reward, optionally - replace with custom message
### Old format (1.5 or earlier)
``` jsonc
{
/// If true, battle setup will be like normal - Attacking player on the left, enemy on the right
"regularUnitPlacement" : true,
@ -63,4 +172,4 @@ Format of rewards is same as in [Rewardable Objects](Rewardable.md)
]
}
```
```

View File

@ -117,6 +117,9 @@ Rewardable object is defined similarly to other objects, with key difference bei
// Message that will be shown if there are multiple selectable awards to choose from
"onSelectMessage" : "",
// Message that will be shown if object has undefeated guards
"onGuardedMessage" : "",
// Message that will be shown if this object has been already visited before
"onVisitedMessage" : "{Warehouse of Crystal}\r\n\r\nThe owner of the storage is apologising: 'I am sorry Milord, no crystal here. Please, return next week!'",
@ -125,10 +128,22 @@ Rewardable object is defined similarly to other objects, with key difference bei
"onVisited" : [
]
// Layout of units in the battle (only used if guards are present)
// Predefined values:
// "default" - attacker is on the left, defender is on the right, war machine, tactics, and battlefield obstacles are present
// "creatureBankNarrow" - emulates H3 logic for banks with narrow (1-tile wide) units
// "creatureBankWide" - emulates H3 logic for banks with wide units that take 2 hexes
// Additionally, it is possible to define new layouts, see "layouts" field in (vcmi install)/config/gameConfig.json file
"guardsLayout" : "default"
// if true, then player can refuse from reward and don't select anything
// Note that in this case object will not become "visited" and can still be revisited later
"canRefuse": true,
// If set to true, then this object can be visited from land when placed next to a coast.
// NOTE: make sure that object also has "blockedVisitable" set to true. Othervice, behavior is undefined
"coastVisitable" : true
// Controls when object state will be reset, allowing potential revisits. See Reset Parameters definition section
"resetParameters" : {
}
@ -479,8 +494,6 @@ Keep in mind, that all randomization is performed on map load and on object rese
],
```
canLearnSpells
### Creatures
- Can be used as limiter
- Can be used as reward, to give new creatures to a hero
@ -496,6 +509,21 @@ canLearnSpells
],
```
### Guards
- When used in a reward, these creatures will be added to guards of the objects
- Hero must defeat all guards before being able to receive rewards
- Guards are only reset when object rewards are reset
- Requires `guardsLayout` property to be set in main part of object configuration
- It is possible to add up to 7 slots of creatures
- Guards of the same creature type will never merge or rearrange their stacks
```jsonc
"guards" : [
{ "type" : "archer", "amount" : 20 },
{ "type" : "archer", "amount" : 20, "upgradeChance" : 30 },
{ "type" : "archer", "amount" : 20 }
],
```
### Creatures Change
- Can NOT be used as limiter
- Can be used as reward, to replace creatures in hero army. It is possible to use this parameter both for upgrades of creatures as well as for changing them into completely unrelated creature, e.g. similar to Skeleton Transformer