Hi,
This is from an old post of mine, which may contain some info useful for you.
Cheers,
Lance.
Hi All,
I have found the answers I was looking for! Yeh!
Here is the information for all those interested in the procedure:
======================================
1) When a creature is placed or spawned into an area without a dedicated AI script placed on it by the builder, then the creature is assigned a default AI Script called, "hench_o0_ai". This is done whenever the function HenchDetermineCombatRound is called.
2) HenchDetermineCombatRound is called (in my scripts and most likely the defaults) from a number of hooks, and so the timing of when all the items are identified for the creature varies depending upon whether the creature is spawned or already placed.
3) When this script fires, and if the creature does not have the variable "HenchAutoIdentify" set to one on them, then (at some point) it fires a function called HenchIdentifyWeapons, which does what it says and identifes everything the creature has on them. (It then sets the variable to 1 as all done.)
4) Therefore, depending when HenchDetermineCombatRound calls HenchIdentifyWeapons determines when items carried are made all identified. In a PLACED creature, the function is not called until quite some time after my own SPAWN script has made everything unidentifiable. Therefore, items are changed back to identified by the time I loot the corpse. A SPAWNED creature fires this function immediately, which meant my own SPAWN script was contesting for the ID of items at the moment of SPAWN. TIMING determined wether my own SPAWN code fired before or after the ID of some items that the HenchIdentifyWeapons did as my own code was firing. This is why some items remained identified and others were unidentified.
So, if you need to stop the creature from auto-identifying the items they carry, make sure you set the "HenchAutoIdentify" variable to one on them. Although it does do a couple of other minor things. (See script excerpt below from "hench_o0_ai") Alternatively, make sure the call to change identified objects comes after the creature has done the following script, which, at the latest, will most likely be when they are attacked.
if (!GetLocalInt(OBJECT_SELF, "HenchAutoIdentify"))
{
SetLocalInt(OBJECT_SELF, "HenchAutoIdentify", TRUE);
if (iAmMonster || (GetAssociateType(OBJECT_SELF) != ASSOCIATE_TYPE_NONE))
{
HenchIdentifyWeapons(); // < THE OFFENDING FUNCTION
if (GetHenchOption(HENCH_OPTION_ENABLE_AUTO_BUFF) &&
(GetAssociateType(OBJECT_SELF) == ASSOCIATE_TYPE_NONE) &&
!GetHasEffect(EFFECT_TYPE_SPELL_FAILURE) && !GetHasEffect(EFFECT_TYPE_SILENCE))
{
// HenchQuickCastBuffs(GetHenchOption(HENCH_OPTION_ENABLE_AUTO_MEDIUM_BUFF));
}
if (GetHenchOption(HENCH_OPTION_ENABLE_EQUIPPED_ITEM_USE))
{
HenchAllowUseofEquippedItemSpells();
}
if (GetHenchOption(HENCH_OPTION_ENABLE_ITEM_CREATION) &&
(GetRacialType(OBJECT_SELF) != RACIAL_TYPE_UNDEAD) &&
(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 6) &&
GetCreatureUseItems(OBJECT_SELF))
{
HenchCreateItemsToUse();
}
HenchDetermineCombatRound(oIntruder, TRUE); // redo combat round
return;
}
}