craynaar Posted November 7, 2023 Share Posted November 7, 2023 (edited) I'm trying to get the form type or ID of an object that gets "activated' by the player. every time I output it to the logger I get "REFR" for everything and not "WEAP" for weapon or "BOOK" for books or "DOOR" for doors ect. RE::BSEventNotifyControl ProcessEvent(const RE::TESActivateEvent* event, RE::BSTEventSource<RE::TESActivateEvent>*) override { auto eventObject = event->objectActivated.get()->GetSavedFormType(); auto formIntoString = RE::FormTypeToString(eventObject); auto eventObjectName = event->objectActivated.get()->GetName(); logger::info("{} activated of form: {}", eventObjectName,formIntoString); return RE::BSEventNotifyControl::kContinue; } This is what I'm trying to do. GetName() works just fine. But I'm trying to filter for one specific group of objects (in my case, FLOR for Flora).I'm not sure how to pull that identifier out of the event object. I've tried multiple functions but they either don't compile, or give REFR for everything as well. Edited November 7, 2023 by craynaar Link to comment Share on other sites More sharing options...
craynaar Posted November 7, 2023 Author Share Posted November 7, 2023 I got it to work with this line auto eventObject = event->objectActivated.get()->data.objectReference->GetFormType(); but apparently Snowberries are of form TREE and Ninroots are of form ACTI... Link to comment Share on other sites More sharing options...
dylbill Posted November 7, 2023 Share Posted November 7, 2023 To get base form type you'll want to use GetBaseObject() Link to comment Share on other sites More sharing options...
PeterMartyr Posted November 8, 2023 Share Posted November 8, 2023 I think you're forgetting basic casting principles, casting one way working fine, casting the other way does not.... considering this is random harvesting, to successful cast the other way, you need to be 100% sure, which your not. Good luck. Link to comment Share on other sites More sharing options...
Recommended Posts