Author: Marzo Sette Torres Junior
Date: 10-17-09 02:56
UI_add_spell(5, 0, -761);
//random spell and spellbook shape number, i read it is supposed
//to be negative?
The problem is here: negative numbers convert to *npcs*. You are supposed to find the spellbook in the NPC's inventory (e.g., the find_object intrinsic) and use the return of that intrinsic as the spellbook object. For example:
if (hasGold(30))
{
const int AVATAR = -356; // If already defined elsewhere, skip this
const int QUALITY_ANY = -359; // If already defined elsewhere, skip this
const int FRAME_ANY = -359; // If already defined elsewhere, skip this
var spellbook = AVATAR->find_object(761, QUALITY_ANY, FRAME_ANY);
if (!spellbook)
say("@No spellbook on Avatar@");
else if (!UI_add_spell(5, 0, spellbook))
say("@You already have the spell!@");
else
{
chargeGold(30);
say("After accepting your gold, he teaches you a spell.");
}
}
else say("@Not enough gold@");
For more information on intrinsics, please see the intrinsic documentation.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
How To Ask Questions The Smart Way