Making an item that cannot be unequipped?
#1
Posté 09 juillet 2012 - 01:41
#2
Posté 09 juillet 2012 - 01:46
#3
Posté 09 juillet 2012 - 03:59
#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 .
#4
Posté 09 juillet 2012 - 04:07
Thanks, I read through that and it looks just about perfect. I'm kind of ashamed to have been scripting for a good four years and still being unable to do such basic stuff!Krevett wrote...
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).
Modifié par Mr. Versipellis, 09 juillet 2012 - 04:46 .
#5
Posté 09 juillet 2012 - 04:16
#6
Posté 09 juillet 2012 - 04:47
How times change! I think the beserk thing is a bit much - this is for story reasons (the amulet I'm working with is part of a magical crystal which is embedded in the PC's chest until the end of the quest, when it gets removed.) I'm still a little confused - where would I need to put each script and where which variables need changing to get it working properly?Krevett wrote...
I was just a perfect beginner two years ago (in the toolset) and it took me a while putting this to workso bad that cursed items can't be done more easily!! I didn't put the SetBerserk function but you might guess what it's about!!!
#7
Posté 09 juillet 2012 - 05:35
Also if you just want an item that cannot be removed you can just use these:
OnEquip:
#include "inc_functions"
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oItem))
{
SetLocalInt(oPC, "cursed", 1);
SetLocalInt(oItem, "cursed", 2);
}
}
OnUnEquip:
#include "inc_functions"
void main()
{
object oPC = GetPCItemLastUnequippedBy();
object oItem = GetPCItemLastUnequipped();
////////////////////////////////////////////////////////////////////////////////
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));
}
if (!GetIsCursed(oPC) && GetIsCursed(oItem)) SetLocalInt(oItem, "cursed", 1);
}
OnUnAcquire:
#include "inc_functions"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
////////////////////////////////////////////////////////////////////////////////
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 when creating your amulet put a local variable "cursed" on it set to 1.
You will also need the two functions GetItemSlot and GetIsCursed of course!
Modifié par Krevett, 09 juillet 2012 - 05:38 .
#8
Posté 09 juillet 2012 - 10:09
I think I get it. Wouldn't it be more simple just to do a tag-based script that re-equipped the item, though?Krevett wrote...
these three scripts each go in the corresponding module event (OnPlayerEquipItem, OnPlayerUnEquipItem, OnUnAcquireItem).
Also if you just want an item that cannot be removed you can just use these:
OnEquip:
#include "inc_functions"
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oItem))
{
SetLocalInt(oPC, "cursed", 1);
SetLocalInt(oItem, "cursed", 2);
}
}
OnUnEquip:
#include "inc_functions"
void main()
{
object oPC = GetPCItemLastUnequippedBy();
object oItem = GetPCItemLastUnequipped();
////////////////////////////////////////////////////////////////////////////////
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));
}
if (!GetIsCursed(oPC) && GetIsCursed(oItem)) SetLocalInt(oItem, "cursed", 1);
}
OnUnAcquire:
#include "inc_functions"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
////////////////////////////////////////////////////////////////////////////////
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 when creating your amulet put a local variable "cursed" on it set to 1.
You will also need the two functions GetItemSlot and GetIsCursed of course!
#9
Posté 09 juillet 2012 - 10:17
#10
Posté 09 juillet 2012 - 10:22
Ah, in that case, I'll just go with your version - it's not that there was anything wrong with it, I just like to find the very best way of doing such things! Thanks terribly for the fast replies, if you ever need help with anything NWN-related, don't hesitate to ask c:Krevett wrote...
The problem lies in the unacquire then... It probably needs some testing but I think that if you just make the item beeing re-equipped on unequipping it and the player tries to drop it directly the item get dropped on the ground. That's why I dit the script that way, but anyway it could be tagbased with some small change ;-)
#11
Posté 09 juillet 2012 - 11:01
#12
Posté 10 juillet 2012 - 01:13
#13
Posté 10 juillet 2012 - 07:04
#14
Posté 10 juillet 2012 - 04:12
#15
Posté 10 juillet 2012 - 04:32
#16
Posté 10 juillet 2012 - 04:38
Krevett wrote...
Because I want the item to be droppable if not equipped
Yeah and you can do all that within on equip and un equip. You do not even need the on aquire part.
#17
Posté 10 juillet 2012 - 05:05
.
if (GetItemCursedFlag(oItem) == TRUE)
{
int nItemType = GetBaseItemType(oItem);
int nSlot;
switch (nItemType)
{
case BASE_ITEM_AMULET : nSlot = INVENTORY_SLOT_NECK; break;
case BASE_ITEM_ARMOR : nSlot = INVENTORY_SLOT_CHEST; break;
case BASE_ITEM_BASTARDSWORD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_BATTLEAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_BELT : nSlot = INVENTORY_SLOT_BELT; break;
case BASE_ITEM_CLUB : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_DAGGER : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_DIREMACE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_DOUBLEAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_DWARVENWARAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_GLOVES : nSlot = INVENTORY_SLOT_ARMS; break;
case BASE_ITEM_GREATAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_GREATSWORD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_HALBERD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_HANDAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_HEAVYCROSSBOW : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_HEAVYFLAIL : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_HELMET : nSlot = INVENTORY_SLOT_HEAD; break;
case BASE_ITEM_KAMA : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_KATANA : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_KUKRI : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LARGESHIELD : nSlot = INVENTORY_SLOT_LEFTHAND; break;
case BASE_ITEM_LIGHTCROSSBOW : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LIGHTFLAIL : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LIGHTHAMMER : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LIGHTMACE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LONGBOW : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_LONGSWORD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_MORNINGSTAR : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_QUARTERSTAFF : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_RAPIER : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_RING : nSlot = INVENTORY_SLOT_RIGHTRING; break;
case BASE_ITEM_SCIMITAR : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SCYTHE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SHORTBOW : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SHORTSPEAR : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SHORTSWORD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SICKLE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_SMALLSHIELD : nSlot = INVENTORY_SLOT_LEFTHAND; break;
case BASE_ITEM_THROWINGAXE : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_TOWERSHIELD : nSlot = INVENTORY_SLOT_LEFTHAND; break;
case BASE_ITEM_TRIDENT : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_TWOBLADEDSWORD : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_WARHAMMER : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
case BASE_ITEM_WHIP : nSlot = INVENTORY_SLOT_RIGHTHAND; break;
}
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionEquipItem(oItem, nSlot));
SendMessageToPC(oPC, "You cannot unequip this item - it's cursed!");
}
Modifié par Pstemarie, 10 juillet 2012 - 05:13 .
#18
Posté 10 juillet 2012 - 05:09
if (GetItemCursedFlag(oItem) == TRUE)
to
if (GetLocalInt(oItem, "FLAG_CURSED") == 1)
The variable will be named "FLAG_CURSED" and set to "1" if you want the item to be cursed.
Modifié par Pstemarie, 10 juillet 2012 - 05:11 .
#19
Posté 10 juillet 2012 - 05:11
Edit: Yes pstemarie that's why I use variable instead of cursed flag
Modifié par Krevett, 10 juillet 2012 - 05:12 .
#20
Posté 10 juillet 2012 - 09:20
#21
Posté 10 juillet 2012 - 11:39
When the item is equipped you set the cursed flag to TRUE, then when they try to unequip it (using the script I posted above, for example) they can't because its cursed.
Modifié par Pstemarie, 10 juillet 2012 - 11:40 .





Retour en haut







