Here's my item_equip script:#include "inc_functions"
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
string sTag = GetTag(oItem);
////////////////////////////////////////////////////////////////////////////////
if (!GetIsCursed(oPC) && sTag == "grandeepee16")
{
SetLocalInt(oPC, "cursed", 1);
SetBerserk(oPC);
}
else if (!GetIsCursed(oPC) && sTag == "ceinture23")
{
SetLocalInt(oPC, "cursed", 1);
SetLocalInt(oPC, "apparence", GetAppearanceType(oPC));
if (GetGender(oPC) == GENDER_MALE) SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_FEMALE_01);
else if (GetGender(oPC) == GENDER_FEMALE) SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_MALE_01);
}
//
if (GetIsCursed(oItem))
{
SetLocalInt(oPC, "cursed", 1);
SetLocalInt(oItem, "cursed", 2);
}
}
My item_unequip script:#include "inc_functions"
void main()
{
object oPC = GetPCItemLastUnequippedBy();
object oItem = GetPCItemLastUnequipped();
string sTag = GetTag(oItem);
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oPC) && GetIsCursed(oItem))
{
int nSlot = GetItemSlot(oItem);
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionEquipItem(oItem, nSlot));
SendMessageToPC(oPC, "Cet objet est maudit!");
DelayCommand(0.1, SetCommandable(FALSE, oPC));
DelayCommand(2.0, SetCommandable(TRUE, oPC));
}
else if (!GetIsCursed(oPC) && GetIsCursed(oItem) && GetTag(oItem) == "ceinture23") SetCreatureAppearanceType(oPC, GetLocalInt(oPC, "apparence"));
if (!GetIsCursed(oPC) && GetIsCursed(oItem)) SetLocalInt(oItem, "cursed", 1);
}
My item_unacquire script:#include "inc_functions"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
string sTag = GetTag(oItem);
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oPC) && GetLocalInt(oItem, "cursed") == 2)
{
int nSlot = GetItemSlot(oItem);
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionPickUpItem(oItem));
AssignCommand(oPC, ActionEquipItem(oItem, nSlot));
SendMessageToPC(oPC, "Cet objet est maudit!");
DelayCommand(0.1, SetCommandable(FALSE, oPC));
DelayCommand(2.0, SetCommandable(TRUE, oPC));
}
}
And the two custom functions in my include:int GetItemSlot(object oItem)
{
int nType = GetBaseItemType(oItem);
if (nType == BASE_ITEM_AMULET) return INVENTORY_SLOT_NECK;
else if (nType == BASE_ITEM_ARMOR) return INVENTORY_SLOT_CHEST;
else if (nType == BASE_ITEM_BASTARDSWORD ||
nType == BASE_ITEM_BATTLEAXE ||
nType == BASE_ITEM_CLUB ||
nType == BASE_ITEM_DAGGER ||
nType == BASE_ITEM_DIREMACE ||
nType == BASE_ITEM_DOUBLEAXE ||
nType == BASE_ITEM_DWARVENWARAXE ||
nType == BASE_ITEM_GREATAXE ||
nType == BASE_ITEM_GREATSWORD ||
nType == BASE_ITEM_HALBERD ||
nType == BASE_ITEM_HANDAXE ||
nType == BASE_ITEM_HEAVYCROSSBOW ||
nType == BASE_ITEM_HEAVYFLAIL ||
nType == BASE_ITEM_KAMA ||
nType == BASE_ITEM_KATANA ||
nType == BASE_ITEM_KUKRI ||
nType == BASE_ITEM_LIGHTCROSSBOW ||
nType == BASE_ITEM_LIGHTFLAIL ||
nType == BASE_ITEM_LIGHTHAMMER ||
nType == BASE_ITEM_LIGHTMACE ||
nType == BASE_ITEM_LONGBOW ||
nType == BASE_ITEM_LONGSWORD ||
nType == BASE_ITEM_MAGICROD ||
nType == BASE_ITEM_MAGICSTAFF ||
nType == BASE_ITEM_MAGICWAND ||
nType == BASE_ITEM_MORNINGSTAR||
nType == BASE_ITEM_QUARTERSTAFF ||
nType == BASE_ITEM_RAPIER ||
nType == BASE_ITEM_SCIMITAR ||
nType == BASE_ITEM_SCYTHE ||
nType == BASE_ITEM_SHORTBOW ||
nType == BASE_ITEM_SHORTSPEAR ||
nType == BASE_ITEM_SHORTSWORD ||
nType == BASE_ITEM_SICKLE ||
nType == BASE_ITEM_SLING ||
nType == BASE_ITEM_TRIDENT ||
nType == BASE_ITEM_TWOBLADEDSWORD ||
nType == BASE_ITEM_WARHAMMER ||
nType == BASE_ITEM_WHIP) return INVENTORY_SLOT_RIGHTHAND;
else if (nType == BASE_ITEM_BELT) return INVENTORY_SLOT_BELT;
else if (nType == BASE_ITEM_BOOTS) return INVENTORY_SLOT_BOOTS;
else if (nType == BASE_ITEM_BRACER ||
nType == BASE_ITEM_GLOVES) return INVENTORY_SLOT_ARMS;
else if (nType == BASE_ITEM_CLOAK) return INVENTORY_SLOT_CLOAK;
else if (nType == BASE_ITEM_HELMET) return INVENTORY_SLOT_HEAD;
else if (nType == BASE_ITEM_LARGESHIELD ||
nType == BASE_ITEM_SMALLSHIELD ||
nType == BASE_ITEM_TOWERSHIELD) return INVENTORY_SLOT_RIGHTHAND;
else if (nType == BASE_ITEM_RING) return INVENTORY_SLOT_LEFTRING;
else return -1;
}
int GetIsCursed(object oObject)
{
if (GetLocalInt(oObject, "cursed") != 0) return TRUE;
return FALSE;
}
The only problem is with a ring in the right slot, it will be reequiped in the left slot... Otherwise it works pretty well for what you want to do. And in my spellhook, casting remove curse delete the local int on the pc or the item (depends on what you cast it). Of course for this to work you need to set the variable "cursed" to 1 on the item you want to be cursed!
Modifié par Krevett, 09 juillet 2012 - 04:07 .