script name: curseditems_oh
what it does: Waits until a PC equips a certain "bait" item and then
replaces the item with a cursed item and will not allow the PC to unequip it
until the item is removed with a DestroyObject function.
okay now for setup instructions:
1) You need 2 items for this to work, the actual cursed item with the bad
properties and a bait item, with properties which will get the PC to equip
it.
2) Go through my script and change all the tags to the ones you have set for
your items, its pretty straightforward. The only thing that is not a tag is
the "cursedarmorofneg" which is the cursed armors resref.
3) Place this in your module's onheartbeat and you should be good to go.
4) To remove the item, just create a basic script that destroys the cursed
item.
Ive tested this and it works fine for me, let me know if you encounter any
problems...enjoy!
NWScript:
void main()
{
object armor = GetObjectByTag("CursedArmor");
object oPC = GetLocalObject(armor, "CursedTo");
if (GetIsObjectValid(oPC))
{
object check = GetItemInSlot(INVENTORY_SLOT_CHEST);
if(check != armor)
{
DestroyObject(armor);
armor = CreateItemOnObject("cursedarmorofneg", oPC, 1);
AssignCommand(oPC, ActionEquipItem(armor, INVENTORY_SLOT_CHEST));
SetLocalObject(armor, "CursedTo", oPC);
SetIdentified(armor, TRUE);
}
else
{
object oArmorBait = GetObjectByTag("CursedArmorBait");
oPC = GetItemPossessor(oArmorBait);
if(GetIsObjectValid(oPC))
{
object checkC = GetItemInSlot(INVENTORY_SLOT_CHEST);
if(checkC == oArmorBait)
{
object newarmor = CreateItemOnObject("cursedarmorofneg", oPC, 1);
SendMessageToPC(oPC, "Armor: " + GetName(newarmor));
AssignCommand(oPC, ActionEquipItem(newarmor, INVENTORY_SLOT_CHEST));
SetLocalObject(newarmor, "CursedTo", oPC);
SetIdentified(newarmor, TRUE);
DestroyObject(oArmorBait);
}
}
}
}
_________________
Bravesfan
"Normal people ... believe that if it ain't broke, don't fix it. Engineers
believe that if it ain't broke, it doesn't have enough features yet."
|