66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: tk_cm_leveler
|
|
//::
|
|
//:: Tag-based script.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Implements an item that when activated, allows
|
|
a player to set the intended caster level of an
|
|
enchantable item (blank scroll, potion, or wand)
|
|
in the player's inventory.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: The Krit
|
|
//:: Created On: June 29, 2007
|
|
//:://////////////////////////////////////////////
|
|
|
|
|
|
//#include "x2_inc_switches" -- included by x2_inc_craft
|
|
#include "x2_inc_craft"
|
|
|
|
|
|
void main()
|
|
{
|
|
// We're only implementing activation.
|
|
if ( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE )
|
|
return;
|
|
|
|
// Signal that the script handled this.
|
|
SetExecutedScriptReturnValue();
|
|
|
|
object oPC = GetItemActivator();
|
|
object oTarget = GetItemActivatedTarget();
|
|
|
|
// Check: Valid target.
|
|
if ( !GetIsObjectValid(oTarget) )
|
|
{
|
|
FloatingTextStrRefOnCreature(83384, oPC); // "* Failure - Invalid Target *"
|
|
return;
|
|
}
|
|
// Check: Target is currently possessed.
|
|
if ( GetItemPossessor(oTarget) != oPC )
|
|
{
|
|
FloatingTextStrRefOnCreature(83354, oPC); // "* Failure: Item must be in your possession *"
|
|
return;
|
|
}
|
|
// Check: Target is identified.
|
|
if ( !GetIdentified(oTarget) )
|
|
{
|
|
FloatingTextStringOnCreature("* Failure: Item must be identified *", oPC);
|
|
return;
|
|
}
|
|
// Check: Target is a magical crafting base item.
|
|
if ( !CIGetIsCraftFeatBaseItem(oTarget) )
|
|
{
|
|
FloatingTextStringOnCreature("* Failure: Item must be an unenchanted potion, scroll, or wand *", oPC);
|
|
return;
|
|
}
|
|
|
|
// Remember the target.
|
|
SetLocalObject(oPC, "TK_CRAFT_MAGIC_Leveler_Target", oTarget);
|
|
|
|
// Start the conversation that will allow the item's goal level to be set.
|
|
AssignCommand(oPC, ClearAllActions());
|
|
AssignCommand(oPC, ActionStartConversation(oPC, "tk_cm_leveler", TRUE, FALSE));
|
|
}
|