Create Character Hooks
During the 'Character Creation Process we call Hooks so that you, the Designer, can modify the character being created. For example, when creating a Magic User, you might want to give the character a Special Ability such as “IsPsionic' in order to create a magic specialist.
Hooks:
PostClass
This hook is called after the player finishes selecting the character's class.
Search Order:
Global Special Ability named 'Global_CreateCharacter'.
Parameters
None
Context
Character
PostCreateCharacter
This hook is called after the player accepts the new character and it is about to be saved..
Search Order:
Global Special Ability named 'Global_CreateCharacter'.
Race of created character
Context
Class - (of created character)
Race - (of created character)
CreateCharacterSpells
This hook is called when the player is asked to select the initial spell complement for a newly created character.
Search Order:
- The character's class
- The spell
Parameters
Parameter [5] = character's INT value
Parameter [6] = spell's level
Parameter [7] = number of spells already acquired at this level
Parameter [8] = number of spells the character can acquire at this level with 100 percent certainty
Context
Class of created character
The spell
The character
This hook is called for every defined spell. That can be a lot of spells so you probably don't want your scripts to be very long.
First we call the 'Class' scripts. If the result is an empty string then we call any 'Spell' scripts.
The final script result is examined and if it is non-empty then it is used as the percentage chance of success. For example, if the result is “85”, then the spell acquisition will succeed 85 times out of 100. Your script should probably contain something like this:
if ( hookParameter[8] > hookParameter[7] ) probability = 100
If the final result is empty, then the chance of success will be 100 percent. If the final result is zero, then the spell is not displayed.
CreateCharacterSpellsMinMax
This hook is called when the player is asked to select the initial spell complement for a newly created character.
Search Order:
- The character's class
Parameters
Parameter [5] = character's INT value
Parameter [6] = spell level
Parameter [7] = 3 (modifiable … minimum number of spells)
Parameter [8] = 5 (modifiable … maximum number of spells)
Parameter 9 = 1 (modifiable … number of spells learned with certainty)
Context
Class of created character
The character
This hook is called to determine the minimum number and maximum number of spells that the character can learn at each spell level and the number of spells that the character can learn at each spell level with a probability of 100 percent.. If the spell level is zero then the result will be applied to all spell levels (all spell levels will have the same minimum and maximum).
The hook should supply a result in hook parameters [7], [8], and [9]. Hook parameter [7] is initially set to 3 and should be modified to the desired minimum. Hook parameter [8] is initially set to 5 and should be modified to the desired maximum. Hook parameter [9] is initially set to 1 and should be modified to the desired number of spell that the character can acquire with 100 percent probability (called the 'certainty').
First we call the 'Class' scripts and use the (possibly modified) hook parameters. The final results will be limited to reasonable integers:
maximum = max(maximum, 0)
minimum = max(minimum, 0)
certainty = min (certainty, 0)
certainty = max(certainty, 100)
and the maximum will be limited so that it is not less than the minimum:
maximum = max(maximum, minimum)
The spells are presented to the player in passes (simplified a little bit): The player can select up to maximum number of spells but cannot select the same spell twice. If he attempts to select a spell and fails, the spell is no longer available for selection.
If the player has acquired fewer than minimum spells at any level then all the remaining spells at that level are again made available and the player can continue to select spells until he has the minimum. Again, he cannot select the same spell twice and any spell that he selects and fails to acquire is removed from the list of available spells.
Repeat step 2 until the player has selected minimum spells at every level.