class template||doc136910

September 20, 2022

Class Templates

This document only covers Classes with templates that can be created (e.g. Parts), but not Classes without templates (e.g. decal)

Introduction

Class templates are used to describe specific subsets of the Class. All templates for a given Class are considered the same Class, but their configuration properties may vary.

Using a real-life example: A "living thing" is a Class while a "Wolf" and a "Goat" are templates of the "living thing" Class. However, their properties would be different as the Wolf eats meat while the Goat eats grass.

Blockman Editor can create templates for Entity, DropItem, Buff, Skill, and Missile. In the above example, Wolf and Goat are both Entity templates.

image.png

Class determines the template's logic, while configuration information determines its properties

When trying to create something, consider what Class is needed to achieve it. Here are some examples:

Intended Effect Suggested Class Access in Editor
Things that have biological properties like the player character or AI Entity image.png
Things that are placed in the scene, and can be picked up and used by Entities DropItem image.png
Things that can be added to Entities to produce certain effects Buff image.png
Things that can be executed by Entities to produce certain effects Skill image.png
Things that fly and collide with Entities or Parts to produce certain effects. Frequently created and destroyed. Missile image.png

After deciding on the Class and creating different templates, each template will have its own set of information that can be configured to produce different effects. The information can be configured using the Properties panel on the right of the Editor window

image.png

Difference between configuration information and Entity properties

Configuration information for templates are shared by Entity Objects and cannot be changed when the game is running, whereas properties are unique to each Entity Object and are frequently changed when the game is running

Examples of configuration information :

Initial character template

image.png

Initial max HP

image.png

Revivable or not

image.png

Click here to see details of Entity Properties.

Methods to get configuration information

Entity.GetCfg("myplugin/templateID") – Get configuration information for Entity templates
DropItem.GetCfg("myplugin/templateID") – Get configuration information for DropItem templates
Missile.GetCfg("myplugin/templateID") – Get configuration information for Missile templates
Entity.TryBuffCfg("myplugin/templateID") – Get configuration information for Buff templates
Skill.Cfg("myplugin/templateID") – Get configuration information for Skill templates