Zorkaz Posted October 1, 2023 Share Posted October 1, 2023 Is there a script command to check if a plant can be harvested? Like Event OnActivate....If Plant.IsHarvestable().... Link to comment Share on other sites More sharing options...
LarannKiar Posted October 1, 2023 Share Posted October 1, 2023 Not that I know of. But the Flora form is a special type of Activator.. did you try Plant.IsActivationBlocked()? Link to comment Share on other sites More sharing options...
RaidersClamoring Posted October 1, 2023 Share Posted October 1, 2023 Flora objects have ActorValues associated with them, "Food", if they are that type of harvestable object. So you could try GetBaseValue(ActorValue akAV) or GetValue(ActorValue akAV), if you're OK with potential log litter: "returns 0 and logs an error if the value is unknown".This is an objectreference function not an actor function.All Flora should be harvestable, so a wider scope could help too if you are checking against any plantlike object.if SomeForm is Flora... Link to comment Share on other sites More sharing options...
Zorkaz Posted October 1, 2023 Author Share Posted October 1, 2023 What I meant was checking if the flora has been harvested.Because the activation script still works even if you have harvested it. Somewhere must be a perk associated with this, since the activation button disappears, even though the activation of a flora object is still possible. Link to comment Share on other sites More sharing options...
RaidersClamoring Posted October 6, 2023 Share Posted October 6, 2023 What I meant was checking if the flora has been harvested.Because the activation script still works even if you have harvested it. Somewhere must be a perk associated with this, since the activation button disappears, even though the activation of a flora object is still possible. You would then check whether the food value is 0.0 or not for that Flora object. Link to comment Share on other sites More sharing options...
niston Posted October 6, 2023 Share Posted October 6, 2023 This is an engine level feature: TESProduceForm::SetHarvested(TESObjectREFR *,bool) // offset 0x162870which calls (among other things) TESForm::SetEmpty(bool) // offset 0x1540D0This then either sets or clears a formFlag (0x2000 IIRC) in the TESForm. The engine probably hides the activation prompt when this flag is set on a TESProduceForm type reference. There is no GetHarvested() or even GetEmpty() in the engine as far as is currently known.Perhaps one of the script extender people can add it and make the flag status accessible to Papyrus. But maybe, just maybe, a condition function might exist to check the flag, say "IsEmpty"? Idk. Wouldn't bank on it. Link to comment Share on other sites More sharing options...
LarannKiar Posted October 8, 2023 Share Posted October 8, 2023 (edited) This is an engine level feature: TESProduceForm::SetHarvested(TESObjectREFR *,bool) // offset 0x162870which calls (among other things) TESForm::SetEmpty(bool) // offset 0x1540D0This then either sets or clears a formFlag (0x2000 IIRC) in the TESForm. The engine probably hides the activation prompt when this flag is set on a TESProduceForm type reference. There is no GetHarvested() or even GetEmpty() in the engine as far as is currently known.Perhaps one of the script extender people can add it and make the flag status accessible to Papyrus. But maybe, just maybe, a condition function might exist to check the flag, say "IsEmpty"? Idk. Wouldn't bank on it. Amazing, nice find! :smile: Unfortunately I haven't found a native IsHarvested() function either.. I doubt it exists but I'm not that good with assembly especially when it comes to functions so I can't be sure.. I was able to trace back the bytes from the memory addresses where the "IsHarvested" flag is stored for Object References.. it's working with ( CallFunction "ObjectReference.SetHarvested" True/False). Will need to test it a bit further with different kinds of Flora references but I think I can add it to the script extender in the next update. Edited October 8, 2023 by LarannKiar Link to comment Share on other sites More sharing options...
niston Posted October 8, 2023 Share Posted October 8, 2023 @Zorkaz If this is purely for custom flora objects, you could make a workshopobjectscript derivate that tracks the setharvest() bool and exposes it as a read-only property. @LarannKiar Great work! Glad to see you make good use of the info. Link to comment Share on other sites More sharing options...
Zorkaz Posted October 9, 2023 Author Share Posted October 9, 2023 Thanks for all the input. It was intended for the base flora that used a attached script.Basically I wanted to achieve something similar to Starfield and the Botanist perk, where you would get additional different items from flor as you leveled a perk up. Link to comment Share on other sites More sharing options...
Recommended Posts