Jump to content

Recommended Posts

Posted

Curious if anyone knows if there's an easy way to listen to certain Campfire events--e.g. to have an onevent in my mod that detects when the player has cooked something on the fire or cooked something using the cooking pot. I've used RegisterForModEvent to catch the deploying of tent (onobjectremoved), but I don't see a way to track other things. Ideally I would be able to:

1) track when the player has cooked anything using fire / cookpot

2) track when the player has created a fire

Thus far my workaround for (2) is a FindClosestReference that points to a formlist full of campfire fire forms within 800 units and in my onupdates check for this (for my purposes it doesn't matter if we created the fire or not, just that there's a fire nearby. This seems to work just fine but is not ideal obviously.

 

Posted

If you're using skse, can use my papyrus functions mod: https://www.nexusmods.com/skyrimspecialedition/mods/65410?tab=description to detect whenever the player activates something in game.

Event OnInit()
    ;register this script (self) for when the player activates anything
    DbSkseEvents.registerFormForGlobalEvent("OnActivateGlobal", self, PlayerRef, 0)
Endevent

Event OnActivateGlobal(ObjectReference ActivatorRef, ObjectReference ActivatedRef)
    ;detect if ActivatedRef is a fire, maybe with keyword or baseobject comparison, then do something
EndEvent

 

Posted

You might also use the "Craft Item" SM Event to detect when food is cooked.  I use it for potions at the alchemy station, but it should work the same.

Posted
8 hours ago, xkkmEl said:

You might also use the "Craft Item" SM Event to detect when food is cooked.  I use it for potions at the alchemy station, but it should work the same.

Do you mean OnItemCrafted (skse ?) using a script on playeralias ? Or something totally different ? If you mean in the CK SM event node, I'm scared. it's a mysterious cthonian ooze in there (for me).

10 hours ago, dylbill said:

If you're using skse, can use my papyrus functions mod: https://www.nexusmods.com/skyrimspecialedition/mods/65410?tab=description to detect whenever the player activates something in game.

Event OnInit()
    ;register this script (self) for when the player activates anything
    DbSkseEvents.registerFormForGlobalEvent("OnActivateGlobal", self, PlayerRef, 0)
Endevent

Event OnActivateGlobal(ObjectReference ActivatorRef, ObjectReference ActivatedRef)
    ;detect if ActivatedRef is a fire, maybe with keyword or baseobject comparison, then do something
EndEvent

 

Interesting. Thanks for the head's up on this option. Not sure it fits here because you can activate a cookpot or stones but not generate a fire or cook anything - info about which I need to get access to.

Posted

Gotcha, my mod does include a crafting event too. 

;workbench types are:
;None = 0,
;CreateObject = 1,
;SmithingWeapon = 2,
;Enchanting = 3,
;EnchantingExperiment = 4,
;Alchemy = 5,
;AlchemyExperiment = 6,
;SmithingArmor = 7
;benchSkill will be an actor value such as "smithing", "enchanting" ect.
Event OnItemCraftedGlobal(Form itemCrafted, ObjectReference benchRef, int count, int workBenchType, string benchSkill)
EndEvent

For detecting lighting or putting out fires, I'd recommend using animation events. The fire refs probably have them. 

You can still use the OnActivateGlobal event. If the ActivatedRef is a fire, register for the animation event. 
To find which animation events are available, you can use my LogAllAnimations function: 
DbSkseEvents.LogAllAnimations(ActivatedRef).
logs to 'info' level, so make sure [LOG] iMinLevel is 2 or less in Data/Skse/Plugins/DbSkseFunctions.ini
Log path is C:/Users/YourUserName/Documents/My Games/Skyrim Special Edition/SKSE/DbSkseFunctions.log

Posted
4 hours ago, csbx said:

Or something totally different ? If you mean in the CK SM event node, I'm scared. it's a mysterious cthonian ooze in there (for me).

SM Event nodes are not that scary.  It's the vanilla way of doing things, though Dylbill's magic event is simpler.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...
OSZAR »