Aller au contenu

Photo

Searching for an Item Blueprint


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

#1
Marshall V

Marshall V
  • Members
  • 58 messages
Anyone know how to find an item blueprint in a toolset plugin using C#?

Currently, I'm doing this (grr it got chopped but you get the idea - I have the resref of the item(s) I'm looking for):

foreach (NWN2ItemBlueprint blueprint in NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager.GetBlueprintsOfType(NWN2Toolset.NWN2.Data.Templates.NWN2ObjectType.Item)){    // Now just look at each Item Blueprint till I find a resref I'm looking for break out of the loop.

}

This is a pain in the butt not to mention terribly slow if I have a lot of items and have to do this many times.  I did find this method:

 NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager.FindBlueprint(NWN2Toolset.NWN2.Data.Templates.NWN2ObjectType.Item, new OEIResRef(sResRef));

But that returns the more general INWN2Blueprint and not just an item blueprint.  Anyone know how to use a Find function like this and get back the actual Item blueprint with all the properties?

Thanks!

Modifié par Marshall V, 13 août 2011 - 12:12 .


#2
SkywingvL

SkywingvL
  • Members
  • 351 messages
It looks like NWN2ItemBlueprint derives from INWN2Blueprint. Perhaps you are expected to just cast the result to a NWN2ItemBlueprint if you provided an object type of 'item'?

#3
Marshall V

Marshall V
  • Members
  • 58 messages
Duh.. Yep that worked. Thanks!