Templates - Editing

To create a new template, use the Create Blank button (lower left). An empty template is added, with some default code to serve as a guide. You can then change the name. Use the Copy Current button to instead copy another template. The Delete button, obviously, deletes the template.

Templates are programmed in VBScript. VBScript code is extremely versatile and can handle nearly any template situation possible. See the following help topics for more info on scripting:

o        Scripting – General Functions Available

o        Scripting – Debugging

o        Scripting – func Object

o        Scripting – Creature

o        Scripting – Creature Functions

o        Scripting – Race

o        Scripting – Attacks

The template prerequisite code checks the character to make sure it meets the prerequisites (for example alignment). For a valid character, do nothing. If it is invalid, code like this to signal it and give the reason:

Prereq = False

Reason = Reason & "Must be good or neutral; "

The template code is the heart of the template – as in feats, the Cr object is the target creature. The cRace object is the target's race. The func object is a general-purpose object for common functions.

Given the variety of possible situations it is impossible to give hints in advance of all possible things you may want a template to do. Try looking at other templates or at feats to get some tricks. You can also ask your question in the DM Genie forums at http://www.dmgenie.com/

Some feat effects are better handled by a feat (or special ability); for example, see the Alternate Form ability that lycanthropes have. You can design a template to work with a feat, by saving custom variables from the template code that the feat will read when used, for example.

Here follows example code for a template:

Public Sub TemplateApply()

'This is an example default template

'Modify this to match your template

'Consult the code of other templates for more code examples.

'Change the name of the creature

cr.Name = cr.Name & ", template"

'Abilities: This increases each ability by +2

cr.StrBase = cr.StrBase + 2

cr.DexBase = cr.DexBase + 2

cr.ConBase = cr.ConBase + 2

cr.IntBase = cr.IntBase + 2

cr.WisBase = cr.WisBase + 2

cr.ChaBase = cr.ChaBase + 2



'--- Special Attacks ---

'This adds "daylight, Smite Evil" to the Special Attacks text box

s = cr.SpecialAttacks

s = s & ", daylight, Smite Evil"

if mid (s,1,2) = ", " then s = mid (s,3)

cr.SpecialAttacks = s

'--- Special Qualities ---

'This adds a string at the end of the Special Qualities string

s = cr.SpecialQualities

s = s & ", darkvision 60 ft, immunity to disease, resistance to acid, cold and electricity 10"

if mid (s,1,2) = ", " then s = mid (s,3)

cr.SpecialQualities = s

'--- Giving Feats or Special Abilities ---

'For a feat/special ability to show up in the Feats tab use code like this:

cr.GiveFeatName "Darkvision" , "" , True

cr.GiveFeatName "Resistance to energy" , "" , True

cr.GiveFeatName "Spell Resistance" , "" , True

'You can also create a new feat specifically for this template and put in script code to automate tasks.

'Give a +8 racial (misc) bonus to a skill (Hide in this case)

n = func.GetSkillNum( "Hide" )

cr.SkillMisc(n) = cr.SkillMisc(n) + 8

'Challenge Rating: Same as the base creature + 2.

cr.ChallengeRating = cr.ChallengeRating + 2

'Level Adjustment: Same as the base creature +4.

cr.TemplateLevelAdjust = cr.TemplateLevelAdjust + 4

End Sub

Documentation for DM Genie and Player Genie, page Template_Edit. Copyright © Mad Scientist Studios, 2006.
Help Contents   |   DM Genie home page
Click here if you cannot see the table of contents on the left