|
|
(20 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
− | ==Description==
| + | {{Template:MovedToWebpage|https://vcmi.eu/modders/Map_Object_Format/}} |
− | Work-in-progress draft, not implemented in code
| |
− | | |
− | Full object consists from 3 parts:
| |
− | * Object group - set of objects that have similar behavior and share same identifier in H3 (towns, heroes, mines, etc)
| |
− | * Object type - object with fixed behavior but without fixed appearance. Multiple objects types may share same group
| |
− | * Object template - defines appearance of an object - image used to display it, its size & blockmap. These entries only describe templates that will be used when object is placed via map editor or generated by the game. When new object is created its starting appearance will be copied from template
| |
− | == Object group format ==
| |
− | <syntaxhighlight lang="javascript">
| |
− | | |
− | {
| |
− | "myCoolObjectGroup":
| |
− | {
| |
− | //numeric ID, mandatory for h3/wog objects, shall be unique if not defined
| |
− | //not recommended for VCMI objects
| |
− | "id":689
| |
− | | |
− | //TODO: define C++/script class name that describes behavior of this object
| |
− | }
| |
− | | |
− | ]
| |
− | }
| |
− | </syntaxhighlight>
| |
− | == Object format ==
| |
− | <syntaxhighlight lang="javascript">
| |
− | | |
− | { | |
− | "myCoolObject":
| |
− | {
| |
− | // defines base object class this object belongs to
| |
− | "base" : "myCoolObjectGroup",
| |
− | | |
− | //numeric sub ID, mandatory for h3/wog objects, shall be unique if not defined
| |
− | //not recommended for VCMI objects
| |
− | "id":689,
| |
− |
| |
− | //Mandatory for new objects,
| |
− | // human readable name, localized
| |
− | //default for original objects from "OBJNAMES.TXT"
| |
− | "name": "My cool object",
| |
− | | |
− | // parameters that will be passed over to class that controls behavior of the object
| |
− | "parameters" : {
| |
− | "producedResources" : "gold",
| |
− | "producedValue" : 1000
| |
− | }
| |
− | }
| |
− | | |
− | ]
| |
− | }
| |
− | </syntaxhighlight>
| |
− | == Object template format ==
| |
− | <syntaxhighlight lang="javascript">
| |
− | {
| |
− | "myCoolObjectTemplate" :
| |
− | {
| |
− | // defines base object class this object belongs to
| |
− | "base" : "myCoolObject",
| |
− | | |
− | // resource ID of animation, relative to SPRITES directory (def file or json file)
| |
− | "animation":"DEFNAME.def",
| |
− | | |
− | // directions from which hero can visit this object.
| |
− | // "+" means that object can be visited from that direction, or "-" othervice
| |
− | // if central symbol is "+" then object is visitable by standing on it (most of buildings)
| |
− | // if central symbol is "-" then object is visitable only from adjacent tiles (most of pickable objects)
| |
− | "visitableFrom" : [
| |
− | "---",
| |
− | "+++",
| |
− | "+++"
| |
− | ],
| |
− | | |
− | // passability of the object
| |
− | // 0=not visible, passable
| |
− | // V=visible, passable
| |
− | // B=blocked, visible
| |
− | // H=blocked, not visible
| |
− | // A=activable, visible, passable depending on visitableFrom field
| |
− | //top and left leading zeros are optional and in fact ignored
| |
− | //bottom, right corner of mask = bottom right corner of animation frame
| |
− | //animation can not be larger than size of mask
| |
− | "mask":[
| |
− | "00000000",
| |
− | "00000000",
| |
− | "00000000",
| |
− | "0000VVVV",
| |
− | "0000HBBB",
| |
− | "0000HHBA"
| |
− | ],
| |
− | | |
− | //optional; default: all terrains except rock
| |
− | //allowed terrain types to place object too, can be overridden in editor. Affects also RMG.
| |
− | "landscape":["dirt", "sand"],
| |
− | | |
− | //optional; default: all terrains except rock
| |
− | // tags from object type are always present (???)
| |
− | // List of tags that can be used to locate object in map editor
| |
− | "tags":["dirt", "sand", "mine"],
| |
− | | |
− | //zindex, defines order in which objects on same tile will be blit. optional, default is 0
| |
− | //NOTE: legacy overlay objects has zindex = -1.000.000
| |
− | "zIndex": 0
| |
− | }
| |
− | ]}
| |
− | </syntaxhighlight>
| |
− | {{Modding}}
| |