You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just wanted to say thanks for the efforts going into this, I've only started looking into creating a mod in the last couple of weeks, I have a quick question if I may, I know it's still early days so if it's the fact that this hasn't been worked on yet, I can go away until it has (I'd love to be able to contribute but have no idea how to get started).
I'm just playing at the moment and I'm trying to loop over my players inventory and have got this far:
auto* player = RE::PlayerCharacter::GetSingleton();
auto name = std::string(player->GetDisplayFullName());
logger::info("Player name: {}", name);
if (player) {
player->ForEachInventoryItem([&](const RE::BGSInventoryItem& a_item) {
auto reference = a_item.object;
if (reference) {
logger::info("Inventory Item: isWeapon: {}, FormID: {}, Object Type name: {}", reference->IsWeapon(),
reference->formID, reference->GetObjectTypeName());
}
return RE::BSContainer::ForEachResult::kContinue;
});
} else {
logger::info("Player not loaded");
}
My question is two part:
I've found from experimentation, that there is only one entry in the foreach loop for each item even if I hold multiple instances of that item. Is it possible to get the count for each inventory item?
Is there a way to get the name of the item - I've investigated the form object but cannot for the life of me figure out how to get the name.
Any help you can give is much appreciated and I look forwards to being able to use any further updates to the library.
CoderSparks
The text was updated successfully, but these errors were encountered:
About getting the name of the item, the method I use is:
Convert the type of the item pointer to the pointer of the class corresponding to FormType according to the object's FormType, for example:
case RE::FormType::kALCH: {
static_assert(RE::FormType::kALCH == RE::AlchemyItem::FORMTYPE);
return item_form->As<RE::AlchemyItem>();
}break;
If the class corresponding to the object's FormType extends from TESFullName, you can use GetFullName() to get its name from it, but for items with modified names (use workbench to rename or with special names), this can only get the original name of the item.
Hi All,
Just wanted to say thanks for the efforts going into this, I've only started looking into creating a mod in the last couple of weeks, I have a quick question if I may, I know it's still early days so if it's the fact that this hasn't been worked on yet, I can go away until it has (I'd love to be able to contribute but have no idea how to get started).
I'm just playing at the moment and I'm trying to loop over my players inventory and have got this far:
My question is two part:
Any help you can give is much appreciated and I look forwards to being able to use any further updates to the library.
CoderSparks
The text was updated successfully, but these errors were encountered: