LearnSpells
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.
You probably will not need to implement this hook. If the character is allowed to learn any of the spells in the 'Knowable List' then you can take advantage of the fact that the default result is 100 percent. If a certain spell cannot be learned until, for example, the character has obtained a slice of provolone cheese, then this hook might be attached to such a spell and might adjust the probability as a function of the cheese's ripeness.
This hook is called for each spell in the character's 'Knowable List'. The hook provides the probability of the spell being successfully learned.
Search Order
- The character's class
- The spell
Parameters
Parameter [5] = character's INT value.
Parameter [6] = spell's level.
Context
Class of created character
The spell
The character
This hook is called for every 'Knowable' 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.
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 to the player.