hereami Posted January 23, 2023 Share Posted January 23, 2023 (edited) Hello. That's weird. Probably doing it wrong or missed something? None of seemingly suitable Conditions work. Like GetEquipped (potions can be equipped/unequipped, right?), WornHasKeyword (ehmm..), HasSpell, SpellHasKeyword, HasMagictEffectKeyword, GetSpellUsageNum etc. Didn't try EPMagic, but those are meant for EntryPoints only, i suppose. I mean exact Potion ID and keywords attached to it, not detecting indirectly by effects it has. Edited January 23, 2023 by hereami Link to comment Share on other sites More sharing options...
LarannKiar Posted January 23, 2023 Share Posted January 23, 2023 When you equip a potion, it gets "consumed" (removed from the actor's inventory) so you would need to set up a Magic Effect (with Duration) to determine how long the actor will be effected by the potion after consuming it. Link to comment Share on other sites More sharing options...
Fantafaust Posted January 23, 2023 Share Posted January 23, 2023 There are probably some things we'll need to know in order to help you with this:what's the end goal?andis it a new potion or pre-existing? You can detect consumable usage by placing a script on the player that checks for the specific consumable, but if we don't know what you want to do I can't definitively recommend that since it won't detect when the effect ends. You can add a script to the potion for the effect part, but if it's pre-existing you probably don't want to modify it so you can avoid conflicts with other mods/vanilla functionality. Link to comment Share on other sites More sharing options...
RaidersClamoring Posted January 23, 2023 Share Posted January 23, 2023 One way I don't see used often but it seems really nifty is flagging a script as "Conditional", setting up a bool property in said script named for instance "PlayerIsConsuming" (with an onEquip and a game-time timer controlling it) and then using this as a CK-condition function. It will be under "VM-variable". Link to comment Share on other sites More sharing options...
hereami Posted January 23, 2023 Author Share Posted January 23, 2023 Thanks for responses! Particular goal is to identify consumed food presence at any given time and without additional measures taken. In my case i can append a custom Effect to a custom consumable, no problems here, but it's a reduntant addition, because Item needs only a single RestoreHealthFood effect, which must be vanilla by mod's logic, while hypothetic GetEquipped(Beer), for example, could be perfect, and not just checking for generic Alcohol effects from unidentified sources, also would suit more complex goals. OnItemEquipped/Unequipped could maybe work, but would expiration count as Unequip? Though still not so versatile solution, e.g. won't help with a random npc. Potion as item may be consumed and ceases to exist in world, but spell-ish part of it stays equipped from game perspective and still can be Unequipped, though doesn't seem to have a native way to detect its presence, bit strange. That's why i think, that missed something obvious. Link to comment Share on other sites More sharing options...
DlinnyLag Posted January 23, 2023 Share Posted January 23, 2023 (edited) Thanks for responses! Particular goal is to identify consumed food presence at any given time and without additional measures taken. In my case i can append a custom Effect to a custom consumable, no problems here, but it's a reduntant addition, because Item needs only a single RestoreHealthFood effect, which must be vanilla by mod's logic, while hypothetic GetEquipped(Beer), for example, could be perfect, and not just checking for generic Alcohol effects from unidentified sources, also would suit more complex goals. OnItemEquipped/Unequipped could maybe work, but would expiration count as Unequip? Though still not so versatile solution, e.g. won't help with a random npc. Potion as item may be consumed and ceases to exist in world, but spell-ish part of it stays equipped from game perspective and still can be Unequipped, though doesn't seem to have a native way to detect its presence, bit strange. That's why i think, that missed something obvious. As I can see consumables always dissapper after equipping. So "unequip" is not applicable at all.Actually, activation (not equipping) of consumable causes OnItemEquipped event firing. So, to detect that some actor "consumes" some consumable you can:1) Subscribe for OnItemEquipped event on desired actor RegisterForRemoteEvent(a, "OnItemEquipped") 2) add a handler of the event Event Actor.OnItemEquipped(Actor a, Form consumableForm, ObjectReference consumableInstance) ; if consumableForm = "appropriate consumable" ; process it endEvent To apply magic effect on actor in event handler you should create a Spell in CK and (depending on spell type)1) cast this spell like: MySpell.Cast(None, a) or 2) add this spell a.AddSpell(MySpell, false) Added spells can be removed by RemoveSpell. Edited January 23, 2023 by DlinnyLag Link to comment Share on other sites More sharing options...
hereami Posted January 23, 2023 Author Share Posted January 23, 2023 (edited) As I can see consumables always dissapper after equipping. So "unequip" is not applicable at all. But HC_Manager says:potion Property HC_EncumbranceEffect_OverEncumbered const auto mandatory; remove encumbrance effectPlayerRef.UnEquipItem(HC_EncumbranceEffect_OverEncumbered, abSilent = true) Probably so, though can't know, when it expires. Also perk entry like Mod Incoming Spell could trigger a fragment maybe. Edited January 23, 2023 by hereami Link to comment Share on other sites More sharing options...
Fantafaust Posted January 24, 2023 Share Posted January 24, 2023 Particular goal is to identify consumed food presence at any given time and without additional measures taken. Yes, but why are you needing to do that, I don't understand the purpose. Why would you need to know what an npc has eaten, for example? Link to comment Share on other sites More sharing options...
hereami Posted January 24, 2023 Author Share Posted January 24, 2023 Particular goal is to identify consumed food presence at any given time and without additional measures taken. Yes, but why are you needing to do that, I don't understand the purpose. Why would you need to know what an npc has eaten, for example? How - that's superior to Why, ain't it ;) Also, even if bypassable, still bit disappointing, that something Equipped isn't valid for GetEquipped. Actually, my Actor eats regular food and its duration is extended significantly by a perk. May change mood, depending on what's eaten. Like that, for package needs mainly. Maybe will do similar for Companions, it was a great feature in New Vegas, when they consumed drinks (and food?) just by themselves. Link to comment Share on other sites More sharing options...
Fantafaust Posted January 24, 2023 Share Posted January 24, 2023 How - that's superior to Why, ain't it ;) Not if I'm trying to give you ways to do what you want but can't because I don't actually know what it is you want to do lolI can very easily detect a specific person eating a specific thing, but any random person? not really Also, even if bypassable, still bit disappointing, that something Equipped isn't valid for GetEquipped. iirc there's no slot for consumables so even though it is "equipped" it would never return anything we could see. It happens instantly too, so it wouldn't help you anyways. SKSE had a way to check if the player had a specific magic effect but F4SE has no such function. Actually, my Actor eats regular food and its duration is extended significantly by a perk. May change mood, depending on what's eaten. Like that, for package needs mainly. If it's just one npc, couldn't you just make copies of the food with the intended extra effect, and you put a script on the actor via ReferenceAlias on a Quest so when they receive the vanilla food, the script swaps it with the mod version? If it's more than one NPC that can quickly get tedious though. Link to comment Share on other sites More sharing options...
Recommended Posts