Aller au contenu

Photo

Best way to magic creature loot (keep it not identified)


  • Veuillez vous connecter pour répondre
17 réponses à ce sujet

#1
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
I'm having a bit of a problem with a magic weapon on an enemy creature. 

I spawn the creature into the zone and spawn the item on the creature. I equip the item in the creature's right hand. All of that works and the creature uses the weapon in battle. 

When I spawn the creature and weapon, I use this line: 

SetIdentified(oItem, FALSE);


But when I kill the creature and go to loot it's corpse, the weapon is already identified. I don't have to make a Lore check or anything - it's just identified. 

What's the best way to handle this? I want magical items to be unidentified... 

Also, I checked the blueprint - the Identified Flag is set to false. I'm not sure what else to configure. 

#2
rjshae

rjshae
  • Members
  • 4 497 messages
Does the creature looting the corpse have any ranks in the Lore skill? If so, then I believe they auto-identify. Lore/identify is totally borked in NWN2. I think they must be doing something like a "take 20" roll on each Lore-based Identify.


Mmm... I wonder what would happen if you gave an item a fake, very high level power that gets stripped off by the on-acquire script when the character's Lore level is high enough? Like a level 30+ fake power. Haven't tried that approach...

Modifié par rjshae, 29 avril 2013 - 10:36 .


#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
SetIdentified() is a one-way street. You can identify an item with it, but you can't un-identify an item again. If the creature is identifying the item with its lore skill (or in some other way), then it's identified for good.

You could set the item the creature is using to not be dropped at all, then have an OnDeath script create a new item into its inventory when it dies. Hopefully dead creatures can't identify anything (but I wouldn't rule that out).

#4
ColorsFade

ColorsFade
  • Members
  • 1 270 messages

DannJ wrote...

SetIdentified() is a one-way street. You can identify an item with it, but you can't un-identify an item again.



Mabye not entirely true. I was able to un-identify the object with it an OnDeath script: 

object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);
SetIdentified(oItem, FALSE);


DannJ wrote...
If the creature is identifying the item with its lore skill (or in some other way), then it's identified for good.


If that's true, then the creature must not be identifying it with lore skill. But I think I need to ensure zero lore skill check to verify. 

DannJ wrote...
You could set the item the creature is using to not be dropped at all, then have an OnDeath script create a new item into its inventory when it dies. Hopefully dead creatures can't identify anything (but I wouldn't rule that out).


That was my next trick to try. 

At present, the above code works. But I want something standard for all cases. 

#5
Dann-J

Dann-J
  • Members
  • 3 161 messages
That's interesting. I was unable to un-identify items while they were in the inventory of a party member who had already identified them. I had to completely rethink my scripting approach at the time (although the alternative approach proved to be better anyway, so it all worked out in the end).

It would seem to be possible once they're dead though. It's good to hear that NWN2 lore checks aren't so baulked that dead creatures can identify things!

Modifié par DannJ, 30 avril 2013 - 11:09 .


#6
Morbane

Morbane
  • Members
  • 1 883 messages
make the equipped wep not droppable

have one in the inventory unid'd

#7
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
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;
}
}

#8
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
Lance! Thank you!

That was incredibly informative, and also helped me secure the most efficient manner to handle magical equipment. I no longer have to deal with duplicates.

Since I spawn almost all of my enemies into areas with scripts, it was very easy to set the HenchAutoIdentify=TRUE variable on the creature in the properties pane and prevent them from identifying the weapon after being spawned. I was then able to set the item on the creature to droppable. It drops, unidentified, as I hoped it would. This allowed me to remove the duplicate copy from the creature that was being created on their death via a DeathScript. Now I have one item on the creature, equipped, unidentified, and droppable. Perfect!

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi ColorsFade,

Glad I was able to help. I know how much of an issue it was to me too. ;)

One thing to bear in mind as well, is that creatures cannot use unidentified items, so if you make them unidentified, they will NOT use the item against the PC.

I messed around with the scripts so that the monster "could" and "does" identify the item (so they can use it), but then made it unidentified at the time it was looted from the creature. The whole procedure was a little more involved than first seen, but if you understand the above, and are reasonable scripter, then you will be able to get around the issue too (if you need to).

EDIT: Here is a link to the full post and discussion if it is any help: http://social.biowar.../index/14514569

Cheers,
Lance.

Modifié par Lance Botelle, 02 mai 2013 - 01:54 .


#10
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've equipped plenty of unidentified weapons/armour on creatures, made them droppable, and had them drop as unidentified when the creature died. The creatures seemed to use them just fine - provided you don't disarm them (in which case, they can't re-equip them).

Shaar Moan is full of creatures wearing and using unidentified items (some of them encounter-spawned, some of them placed).

Modifié par DannJ, 02 mai 2013 - 11:03 .


#11
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
My experience is the same as DannJ's. The creature uses the item just fine.

I had issues with creatures not using items before, but it was only because they didn't have a proper required Feat (like Martial Weapon Prof, etc.).

In this particular case, the Kobold in question uses the magic club.

Now - a tangential question: is the club's magical properties in play during combat? I'm guessing they are, but I need to check. Possibly by adding a property that fires on hit; that would be a way to test it.

If an item has to be identified for the properties to work while the creature is wielding it, then I'm back to the two-item way of doing things. But that's cool, because I know how to do it now.

#12
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
Just tested with a gnarly weapon (on hit casts Call Lightning). Oh... it worked. Unidentified, the NPC used it quite well.

So there you go.

#13
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
I think creatures can't equip unidentified objects, but they'll still work if equipped in the toolset, and the creature never unequips them for any reason. I've even had gnomes using polearms without monkey grip using that trick.

#14
Morbane

Morbane
  • Members
  • 1 883 messages
just a side note:
if you give a potential companion an unidentified item as equipped - they have it so, until they join the party - then it is in their inventory - perhaps this method might tweak that somehow - not sure why it would need to be though :}

#15
kevL

kevL
  • Members
  • 4 070 messages

Morbane wrote...

just a side note:
if you give a potential companion an unidentified item as equipped - they have it so, until they join the party - then it is in their inventory - perhaps this method might tweak that somehow - not sure why it would need to be though :}

there are a couple of more functions calls in the AI like Lance pointed out. iirc, when default Behaviors ( companions & associates ) are set, either/or equipped items & inventory items get identified.

#16
Dann-J

Dann-J
  • Members
  • 3 161 messages
Interestingly, if I equip a droppable unidentified item on a non-hostile creature in the toolset (NPC or potential companion), then it gets auto-identified. However doing the same on a hostile creature seems to keep it unidentified. It seems that hostiles get treated differently to non-hostiles.

#17
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
What faction are you using for non-hostiles DannJ?

I have two factions I am using. One is a custom neutral, and the other is hostile. In my situation, I have my enemies set to the custom neutral first, then change them to hostile after a cut scene. The item equipped in the main hand of the leader is still unidentified.

So I wonder if' it's not just hostile, but if maybe a specific default faction causes identification?

#18
Dann-J

Dann-J
  • Members
  • 3 161 messages
At the start of Shaar Moan is a Buldamar enforcer who has a katana and some custom studded leather armour that are both unidentified on his placed instance. If the initial conversation goes pear-shaped and he attacks, then he eventually drops both items as identified (depending on what you choose to do with the bodies afterward).

I think from memory I started him off as a Defender. Come to think of it, the NPC with the companion scripts I used in testing was probably Defender to begin with as well. You may be right - it might not be hostiles that are treated differently. It might be something unique to defenders.