Checks if the current spell was used to brew a potion and performs the brewing process.
target of the spell; IGNORED - will always be set to GetSpellTargetObject()
caster of the spell; IGNORED - will always be set to OBJECT_SELF
This function is used to brew a potion.
It checks if the caster of the spell has the necessary crafting feat (brew potion), the spell's level is within the range allowed for brewing potions (0-3), the spell is on the list of allowed spells for brewing potions and the caster has enough experience points and gold to pay for the brewing process.
If everything checks out, a new potion representing the spell is created. If the potion is created successfully, the original spell target (which is implicitly assumed to be an empty bottle) is destroyed and the appropriate amount of XP and gold is removed from the caster.
The function always returns TRUE, which indicates to the spellhook that the spell has been used up (and consequentially the spell script should be aborted by the spellhook, even if the potion could not be created successfully).
This functions is usually called from the spellhook (see X2PreSpellCastCode() in x2_inc_spellhook).
It should only be used within a spell script, otherwise its behavior is unpredictable.
Any parameters passed to the function are ignored (see Known Bugs).
The function always returns TRUE (even if no potion is created).
The function ignores any parameters passed to it. It sets oCaster to OBJECT_SELF and determines oSpellTarget by calling the function GetSpellTargetObject().
|functions:||CICraftCheckScribeScroll | CICraftScribeScroll | CIGetIsCraftFeatBaseItem | CraftBrewPotion | GetSpellId | GetSpellTargetObject | X2PreSpellCastCode|
|categories:||Item Creation Functions | Spells Functions|
author: motu99, editor: Mistress