CICraftCheckScribeScroll(object, object)

Checks if the current spell was used to scribe a scroll and performs the scribe process.

int CICraftCheckScribeScroll(
    object oSpellTarget,
    object oCaster



presumed target of the spell (should be an empty scroll)


presumed caster of the spell (should be OBJECT_SELF)


This function is used to scribe a scroll.

It checks if the presumed caster of the spell (oCaster) has the necessary crafting feat (scribe scroll), the spell is on the list of allowed spells for scribing scrolls and oCaster has enough experience points and gold to pay for the scribe process.

If everything checks out, a new scroll representing the current spell is created. If the scroll is created successfully, oSpellTarget (which is implicitly assumed to be an empty scroll) is destroyed and the appropriate amount of XP and gold is removed from oCaster.

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 scroll could not be created successfully).


This functions is usually called from the spellhook (see X2PreSpellCastCode() in x2_inc_spellhook).

It should be used within a spell script, however, if appropriate parameters are passed into the function, it will work in the manner described above, creating a scroll with whatever spellID is returned by the function GetSpellId(). Note that GetSpellId() usually returns an invalid spellID (-1) outside a spell script.

The function always returns TRUE (even if no scroll is created).


#include "x2_inc_craft"



See Also

functions:  CICraftCheckBrewPotion | CICraftScribeScroll | CIGetIsCraftFeatBaseItem | CraftBrewPotion | GetSpellId | X2PreSpellCastCode
categories:  Item Creation Functions | Spells Functions

author: motu99, editor: Mistress