I set an item as plot and undroppable and it lost undroppable flag when being painted (when use Dye Leather / Dye Cloth).
There is how to block use dye on undroppable itens?
I set an item as plot and undroppable and it lost undroppable flag when being painted (when use Dye Leather / Dye Cloth).
There is how to block use dye on undroppable itens?
Conversely, if the item is supposed to be undroppable, why not just set it as plot as well so that it cannot even be dyed/altered to begin with?
1)I have no custom script of dye.
2) Very well. I forget to say, my item is marked as PLOT ITEM and UNDROPPABLE ITEM. Dye is allowing players give or drop my plot itens to others players (like an armor, helmet, etc).
The default scripts delete local variables when copying the object. This might also affect flags. Try putting a third parameter of TRUE into CopyObject(). If this does not work use GetItemCursedFlag() and SetItemCursedFlag() to transfer the droppable status.
Just to clarify, you are marking an item undroppable (cursed) from the properties tab in the Toolset when creating/modifying the item, and not from the NPCs inventory in the Toolset (this droppable flag causes the item not to be dropped by the creature when it dies and has no impact on whether or not players can drop the item on the ground).
Hi,
don't know which dye script you use, but what I would add to your script is (if it doesn't exist):
Check if there is a our more of these flags, and if they exist on the original, set them to the copy too.
Don't have any code snippets around, but I could add them next morning (it's around nine a clock, and I'm right at home from a trip from north to south)...
I found the script used on 'UseDye' in nwn wikia (http://nwn.wikia.com/wiki/Dye_kit). This is intersting:
(script: x2_s2_dyearmor) dyeing an item causes it to lose its local variables. This can be changed by editing x2_s2_dyearmor, looking for "CopyItem", and adding TRUE as an additional parameter.
I added the bellow code to fix (on start of void main):
if ((GetPlotFlag(oTarget) == TRUE) || (GetDroppableFlag(oTarget) == FALSE))
{
FloatingTextStringOnCreature("Invalid Target, must select a droppable and non plot item",oPC);
return;
}
Thank you WhiZard, kalbaern and dunahans.
The default scripts delete local variables when copying the object. This might also affect flags. Try putting a third parameter of TRUE into CopyObject(). If this does not work use GetItemCursedFlag() and SetItemCursedFlag() to transfer the droppable status.
Are you refering to change
object oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE);
to
object oNew = CopyObject(oTarget, GetLocation(oPC), oPC, GetTag(oTarget));
or
object oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE); SetPlotFlag(oNew, GetPlotFlag(oTarget)); SetDroppableFlag(oNew, GetDroppableFlag(oTarget)); DestroyObject(oTarget);
or is better do this
if ((GetPlotFlag(oTarget) == TRUE) || (GetDroppableFlag(oTarget) == FALSE))
{
FloatingTextStringOnCreature("Invalid Target, must select a droppable and non plot item",oPC);
return;
}
?
Are you refering to changeobject oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE);to
object oNew = CopyObject(oTarget, GetLocation(oPC), oPC, GetTag(oTarget));or
object oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE); SetPlotFlag(oNew, GetPlotFlag(oTarget)); SetDroppableFlag(oNew, GetDroppableFlag(oTarget)); DestroyObject(oTarget);or is better do this
if ((GetPlotFlag(oTarget) == TRUE) || (GetDroppableFlag(oTarget) == FALSE)) { FloatingTextStringOnCreature("Invalid Target, must select a droppable and non plot item",oPC); return; }?
This is the format, but GetDroppableFlag()/SetDroppableFlag() are not the functions you are looking for. They determine if an NPC will drop the item when it dies. You specifically need GetItemCursedFlag()/SetItemCursedFlag().
This is the format, but GetDroppableFlag()/SetDroppableFlag() are not the functions you are looking for. They determine if an NPC will drop the item when it dies. You specifically need GetItemCursedFlag()/SetItemCursedFlag().
Thank you very much remembering. Quickly response. Is that I was missing here! I'll fix it right now! Again, many thanks.
object oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE);
SetPlotFlag(oNew, GetPlotFlag(oTarget));
SetItemCursedFlag(oNew, GetItemCursedFlag(oTarget));
DestroyObject(oTarget);
This option is the one is the one that should do it. Note that there is another CopyItem() toward the beginning of the script which also needs fixing.
EDIT: changing droppable to cursed function
Looks like CopyItem does not copy undroppable (Cursed in script editor) flag. It does copy plot flag though.
And btw the local variable issue was fixed in 1.70 already. Thats 4 years ago.
The code from Whizard will not fix the issue (not that he is wrong, just that there are three copies created), this code will fix it. I underlined and marked changes and new lines.
//::///////////////////////////////////////////////
//:: Dye Item Spellscript
//:: x2_s2_dyearmor
//:: Copyright © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Spellscript for all Dye: Material Spells
Some Notes:
The color of the dye is taken from the
last two letters of the item's tag
The colortype which to change (cloth1, cloth2,
leather1, ...) is determined by the spell ID
Restrictions:
- you cannot dye armor in combat
- you can only dye armor && helmets
- you can only dye items in your inventory
- you can now dye cloaks as well
- the IPWork container (see x2_inc_itemprop)
must be set up for this to work properly
*/
//:://////////////////////////////////////////////
//:: Modified: Georg Zoeller, 24/03/2006 - Cloaks
//:: Created By: Georg Zoeller
//:: Created On: 2003-05-10
//:://////////////////////////////////////////////
/*
Patch 1.72
- fixed not copying local variables when dyeing an item
- fixed losing undroppable flag when dyeing an item
*/
#include "x2_inc_itemprop"
const int DYE_MAX_COLOR_INDEX = 175;
// Maps the Spell ID to the appropriate ITEM_APPR_ARMOR_COLOR_* constant
int GetApprArmorColorFromSpellID(int nID)
{
switch (nID)
{
case 648 : return ITEM_APPR_ARMOR_COLOR_CLOTH1;
case 649 : return ITEM_APPR_ARMOR_COLOR_CLOTH2;
case 650 : return ITEM_APPR_ARMOR_COLOR_LEATHER1;
case 651 : return ITEM_APPR_ARMOR_COLOR_LEATHER2;
case 652 : return ITEM_APPR_ARMOR_COLOR_METAL1;
case 653 : return ITEM_APPR_ARMOR_COLOR_METAL2;
}
return 0;
}
void FinishDyeScript(object oPC, object oTarget, int bEquipped, int nSlot)
{
// Move the armor back from the IP Container
object oNew = CopyItem(oTarget, oPC, TRUE);
SetItemCursedFlag(oNew, GetItemCursedFlag(oTarget));
DestroyObject(oTarget);
//----------------------------------------------------------------------------
// We need to remove all temporary item properties here
//----------------------------------------------------------------------------
IPRemoveAllItemProperties(oNew,DURATION_TYPE_TEMPORARY);
// Reequip armor if it was equipped before
if (bEquipped)
{
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oNew,nSlot));
}
}
void main()
{
// declare major variables
object oItem = GetSpellCastItem(); // The "dye" item that cast the spell
object oPC = OBJECT_SELF; // the user of the item
object oTarget = GetSpellTargetObject();
string sTag = GetStringLowerCase(GetTag(oItem));
// Determine the color to edit from the spell ID
int nColorType = GetApprArmorColorFromSpellID(GetSpellId());
if (GetIsInCombat(oPC)) // abort if in combat
{
FloatingTextStrRefOnCreature(83352,oPC); //"This item cannot be used in combat"
return;
}
if ( GetObjectType(oTarget) != OBJECT_TYPE_ITEM || oTarget == OBJECT_INVALID)
{
FloatingTextStrRefOnCreature(83353,oPC); //"Invalid Target, must select armor or helmet"
return;
}
int nBase = GetBaseItemType(oTarget);
// GZ@2006/03/26: Added cloak support
if ( nBase != BASE_ITEM_ARMOR && nBase != BASE_ITEM_HELMET && nBase != BASE_ITEM_CLOAK )
{
FloatingTextStrRefOnCreature(83353,oPC); //"Invalid Target, must select armor or helmet"
return;
}
if (GetItemPossessor(oTarget) != oPC)
{
FloatingTextStrRefOnCreature(83354,oPC); //"target must be in inventory"
return;
}
// save if the item was equipped before the process
int bEquipped;
int nSlot;
if (nBase == BASE_ITEM_HELMET )
{
nSlot = INVENTORY_SLOT_HEAD;
bEquipped = (GetItemInSlot(nSlot,oPC) == oTarget);
}
// GZ@2006/03/26: Added cloak support
else if (nBase == BASE_ITEM_CLOAK )
{
nSlot = INVENTORY_SLOT_CLOAK;
bEquipped = (GetItemInSlot(nSlot,oPC) == oTarget);
}
else
{
nSlot = INVENTORY_SLOT_CHEST;
bEquipped = (GetItemInSlot(nSlot,oPC) == oTarget);
}
// GZ@2006/03/26: Added new color palette support. Note: Will only work
// if craig updates the in engine functions as well.
int nColor = 0;
// See if we find a valid int between 0 and 127 in the last three letters
// of the tag, use it as color
int nTest = StringToInt(GetStringRight(GetTag(oItem),3));
if (nTest > 0 && nTest <= DYE_MAX_COLOR_INDEX )
{
nColor = nTest;
}
else //otherwise, use last two letters, as per legacy HotU
{
nColor = StringToInt(GetStringRight(GetTag(oItem),2));
}
// move the item into the IP work container
object oNew = CopyItem(oTarget, IPGetIPWorkContainer(), TRUE);
int nCursed = GetItemCursedFlag(oTarget);
DestroyObject(oTarget);
// Dye the armor
oTarget = IPDyeArmor(oNew,nColorType, nColor);
SetItemCursedFlag(oTarget,nCursed);
DelayCommand(0.01f,FinishDyeScript(oPC,oTarget,bEquipped,nSlot));
}
Excelent CPP getting into this! Updating my script of dye armor in 3... 2... 1...
Note that the same problem of cursed flag will still exist for craft armor and craft weapon when a player is modifying the appearance, although there the plot flag will block the appearance change.
Note that the same problem of cursed flag will still exist for craft armor and craft weapon when a player is modifying the appearance, although there the plot flag will block the appearance change.
You are correct, plot flag block the appearance change but still crafting an appearance can be used to remove "cursed" item from character. Problem is that its not 100% possible to fix this other than blocking the appearance change for such item because there is a full inventory issue.
Problem is that its not 100% possible to fix this other than blocking the appearance change for such item because there is a full inventory issue.
I wasn't even going to go there, but the full inventory issue applies just as much to the dyes as the appearance change from crafting as all weapons/armor can be equipped.
Cursed items are being dropped on unequip if the inventory is full. Someone knows how fix it? or a solution ![]()
No solution besides forcing the character to drop some gear and pick up the cursed items. This problem is hard-coded, and one reason why the only items to safely give the cursed flag to are those that cannot be equipped.
I wasn't even going to go there, but the full inventory issue applies just as much to the dyes as the appearance change from crafting as all weapons/armor can be equipped.
yea right... its too simple to exploit the undroppable flag
Cursed items are being dropped on unequip if the inventory is full. Someone knows how fix it? or a solution
I was already looking into it, it is definitely possible to fix this via nwnx but so far I havent found a way, maybe later...