• Tutorials

  • Home
  • LearnSpellsNum

    When a character is created, the player selects spells that the character can 'LEARN' later in the game. This list of spells is called the 'Knowable' list. At various times in the game, the player is allowed to move certain spells from the 'Knowable' list to the character's spellbook. This process is called 'Learning Spells'. The engine calls two hooks: one to control the number of spells that can be Learned at each spell level and the other to determine which spells can be Learned.

    When the character is allowed to “Learn” spells (transfer spells from the 'Knowable List' to the spellbook), the engine calls this hook for each possible spell level. The hook provides two pieces of information for each spell level:

    1. The total number of spells that can be in the spellbook at each level.
    2. The number of spells that can be learned with certainty at each level.

    This hook is called when:

    Search Order

    1. The character's class

    Parameters

    Parameter [4] = 'Circumstance Code'. See discussion above.
    Parameter [5] = character's INT value.
    Parameter [6] = spell level.
    Parameter [7] = number of spells already in the spellbook at this level
    Parameter [8] = 3 (modifiable - total number of spells that can be in the spellbook at this level)
    Parameter [9] = 0 (modifiable - number of additional spells at this level that can be learned with certainty)

    Context

    Class of created character
    The character


    This hook is called to determine the 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 [8] and [9]. Hook parameter [8] is initially set to 3 and should be modified to the desired maximum. Hook parameter [9] is initially set to 0 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:

    parameter[8] = max(parameter[8], 0)

    parameter[9] = min (parameter[9], 0)

    The spells which can be learned are presented to the player one level at a time. When a spell is successfully 'Learned', it is removed from the 'Knowable' list. If a spell is selected but fails to be learned, it remains in the 'Knowable List' but is not longer displayed for selection.

    The list of 'Knowable' spells is kept in the character's ASL named “$KnowableSpells$ in the form of a delimited string containing the spells' unique names. For example:

    “?Bless|Dork?Heal|Just Once?Levitate”

    Your scripts can examine and modify this list. But any modification by the two hooks described on this page will be overwritten when the Learning process is complete.