This tool provides a number of different functions to rearrange the character-generation system in order to (among other things) create the appearance of extra classes and extra selection options for the classes. (It does not and cannot add real new classes, but it can make it seem to the player that a new class has been added.) The tool also automatically alphabetises lists of classes and kits.
You set up this component by doing
LAF virtual_class_setup END
LAF add_virtual_class
INT_VAR
name_strref=45859
desc_strref=45869
STR_VAR
ident=DW_BARBARIAN
parent=fighter
END
LAF assign_kit_to_virtual_class STR_VAR class=DW_BARBARIAN kit=BARBARIAN END
You can assign names and descriptions via the currently-loaded .tra file rather than by strrefs, and that’s usually more convenient for entirely new classes. For instance, here’s how ToF creates the Favored Soul virtual class:
LAF add_virtual_class
INT_VAR
name=4000
desc=4001
STR_VAR
ident="favored_soul"
parent=SHAMAN
END
You can assign more than one kit to a virtual class, and if one kit has the same name as the virtual class and the others do not, the new kits will appear as if they are kits for the new class.
For instance, suppose we want to create a new Barbarian kit, ‘Amazon’. First we create this kit as an ordinary Fighter kit, say with rowname DW_AMAZON (this I leave as an exercise to the reader). Then we just assign it to the Barbarian virtual class:
LAF assign_kit_to_virtual_class STR_VAR class=DW_BARBARIAN kit=DW_AMAZON END
Now when the player selects ‘Barbarian’, they’ll be taken to a kit menu and offered either ‘Barbarian’ or ‘Amazon’ as kit choices.
Incidentally, there is no requirement that a virtual class has one kit that’s the ‘real’ class, and indeed SFO doesn’t know which kit you intend as the real class.
By default (if this tool is installed), kits are displayed in alphabetical order. Sometimes you might want to override this: for instance, for virtual classes, you might want the ‘real’ class displayed first, so it looks like a class and not just one more kit. You can do so like this:
LAF set_kit_display_priority INT_VAR priority=0 STR_VAR kit=BARBARIAN END
The ui_virtual_class tool lets you restrict a kit only to males, or only to females, like this:
LAF require_gender STR_VAR kit=DW_AMAZON gender=female END
By default, the kit selection menu has the title ‘Choose Kit’ .The ‘override_class_kit’ function lets you override this: for instance, we might want the kit-selection screen for clerics to be called ‘choose god’. It works like this:
LAF override_class_kit_menu
INT_VAR title_tra=100
STR_VAR class="CLERIC"
END
You can also override virtual classes’ kit titles. For instance, for Favored Souls, I again want that menu to be titled ‘Choose God’. We need to tell the function explicitly that our class is virtual, and then use its ident as set by add_virtual_class, like this:
LAF override_class_kit_menu
INT_VAR
title_tra=100
virtual=1
STR_VAR class="favored soul"
END
Sometimes it makes sense to gather kits together into groups, either for convenience or to create the appearance of selecting some option for the kit. (For instance, we might want to offer a Dragon Disciple character a choice of dragon, and implement this by having one kit per dragon). Here’s an example of how this works in ui_virtual_class, used to organize all specialist mages into one list:
LAF add_kit_menu
INT_VAR
name=1
desc=2
title=3
STR_VAR
kits=”ABJURER CONJURER DIVINER ENCHANTER ILLUSIONIST INVOKER NECROMANCER TRANSMUTER”
class=mage
id=dw_specialist_mage
END
Sometimes (especially in kit-selection submenus) it's useful to display something other than the name of the kit. For instance, if you are selecting a cleric's god, it may look better just to have 'Helm', 'Talos', 'Tyr' etc displayed, rather than 'Cleric of Helm', 'Cleric of Talos', etc. Similarly, if you have created a submenu to select which elemental type an elementalist specializes in, it may look better to display 'Fire' rather than 'Fire elementalist'.
You can do this with SFO's 'override_chargen_kit_name' function, like this:
LAF override_chargen_kit_name
INT_VAR
override=1011 // by default, an entry in your .tra file
STR_VAR
kit=”DW_ELEMENTALIST_FIRE”
class=MAGE
END
ui_virtual_class also has functionality to override the displayed classes on a character sheet. This is useful for (e.g.) multiclass kits that combine single-class kits (so that the single-class kit names should show on the character sheet instead of the base classes).
All this is implemented by the override_kit_desc_data function. The 'kit' STR_VAR (which should be a kitlist 2da rowname) specifies the kit for which the override should be applied. You can specify the override itself several ways. The simplest is to set 'swap' to a list of class=>kit swaps, e.g. swap="fighter=>kensai thief=>assasin". Here 'class' should be a class.ids entry, and 'kit' should be a kitlist.2da rowname. You can also directly specify strings to be swapped out and in, either by strref (old_[123]_strref is swapped for new_[123]_strref) or directly by string (old_[123] is swapped for new_[123]).
Complicatedly(!) but basically by overriding the standard class/kit tables in the character generation UI with its own. All the engine cares about is the eventual class and kit id that you select; by hiding and rearranging the data that lets the player choose those, we create a convincing illusion!
The character-sheet override just does a search-and-replace on the displayed class name(s) if the character has the appropriate kit.