• Tutorials

  • Home
  • KnowableSpellsMinMax

    This hook is called when the player is asked to select the initial spell complement for a newly created character or when a character gains an additional level and has the opportunity to know additional spells.

    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.

    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)
    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.

    Search Order

    The character's class

    Parameters

    Parameter[4] is set to “I” (for Initial character creation) or “L” (for Level up).
    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
    Character