Difference between revisions of "Templates"
Line 1: | Line 1: | ||
+ | == Basics == | ||
* Templates are files which describe properties of objects to be created in the world. | * Templates are files which describe properties of objects to be created in the world. | ||
* A template is the building plan, the blueprint for an object | * A template is the building plan, the blueprint for an object | ||
Line 6: | Line 7: | ||
* The basic file format is XML, so you have the rules for XML tags and attributes. | * The basic file format is XML, so you have the rules for XML tags and attributes. | ||
* Do not use special characters in the names for your templates, it can cause weird bugs<br/>Forbidden characters in template names: "&" | * Do not use special characters in the names for your templates, it can cause weird bugs<br/>Forbidden characters in template names: "&" | ||
+ | == Template Properties == | ||
+ | Templates describe GameObjects, so a fundamental understanding of GameObjects is necessary: [[GameObj]] | ||
+ | |||
+ | Example of a simple template: | ||
+ | <syntaxhighlight lang=xml> | ||
+ | <ObjectTemplate> | ||
+ | <ClientId>461</ClientId> | ||
+ | <Name>[FF9500]Green Book[-]</Name> | ||
+ | <SharedStateEntry name="Weight" type="int" value="1"/> | ||
+ | <Hue>0xFFFFFFFF</Hue> | ||
+ | </ObjectTemplate> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | All Template MUST have the opening and closing tags: | ||
+ | <syntaxhighlight lang=xml> | ||
+ | <ObjectTemplate> | ||
+ | </ObjectTemplate> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | The ClientId tag also is mandatory: | ||
+ | <syntaxhighlight lang=xml> | ||
+ | <ObjectTemplate> | ||
+ | <ClientId>2</ClientId> | ||
+ | </ObjectTemplate> | ||
+ | </syntaxhighlight> | ||
+ | This id probably the most primitive template possible. The ClientId tells that the invivible NoDraw object is to be displayed. Apart from that it has no properties, scripts or anything. | ||
+ | |||
+ | After creation in the world this object already has some default properties: | ||
+ | Basic: | ||
+ | *Name: "" (Empty String) | ||
+ | *Hue:"FFFFFF" (white) | ||
+ | *Position: Loc(166.34,0.00,-135.43) - that's where I placed it | ||
+ | *Rotation: Loc(0,0,0) | ||
+ | *Scale: Loc(1,1,1) | ||
+ | *template: "MostDumbTemplateEver" (That's how I named the template when I saved it) | ||
+ | Shared Object Properties | ||
+ | *DefaultInteraction: "Use" (When we click it) | ||
+ | *NoInteract: false (Default Interaction is on) | ||
+ | *TooltipString: "" (Empty String) | ||
+ | *Weight: -1 (Cannot be picked up normally) |
Revision as of 14:24, 1 November 2016
Basics
- Templates are files which describe properties of objects to be created in the world.
- A template is the building plan, the blueprint for an object
- You can create as many instances of these objects as your server allows:
1000 rabbits, if you wish from a single rabbit template, or cultists opr whatever. - Templates are described in files, one template per file only, so there are many.
- These file live in a special directory called "templates" inside your mods directory.
- The basic file format is XML, so you have the rules for XML tags and attributes.
- Do not use special characters in the names for your templates, it can cause weird bugs
Forbidden characters in template names: "&"
Template Properties
Templates describe GameObjects, so a fundamental understanding of GameObjects is necessary: GameObj
Example of a simple template:
<ObjectTemplate>
<ClientId>461</ClientId>
<Name>[FF9500]Green Book[-]</Name>
<SharedStateEntry name="Weight" type="int" value="1"/>
<Hue>0xFFFFFFFF</Hue>
</ObjectTemplate>
All Template MUST have the opening and closing tags:
<ObjectTemplate>
</ObjectTemplate>
The ClientId tag also is mandatory:
<ObjectTemplate>
<ClientId>2</ClientId>
</ObjectTemplate>
This id probably the most primitive template possible. The ClientId tells that the invivible NoDraw object is to be displayed. Apart from that it has no properties, scripts or anything.
After creation in the world this object already has some default properties: Basic:
- Name: "" (Empty String)
- Hue:"FFFFFF" (white)
- Position: Loc(166.34,0.00,-135.43) - that's where I placed it
- Rotation: Loc(0,0,0)
- Scale: Loc(1,1,1)
- template: "MostDumbTemplateEver" (That's how I named the template when I saved it)
Shared Object Properties
- DefaultInteraction: "Use" (When we click it)
- NoInteract: false (Default Interaction is on)
- TooltipString: "" (Empty String)
- Weight: -1 (Cannot be picked up normally)