Has anyone found a way to bind to the use event of an item or when their emitter has become active? My standing torch mod, which adds a light source to the emitter, works great; however if the fuel is the angler gel I need to modify the point light to a blueish color instead of the soft yellow/orange. I’ve tried binding to the particle system spawned event, but that doesn’t work. I’ve also tried the on begin event and while it works it will not work on use and just works on first creation of the standing torch. My only other solution is to use particle lights instead of point lights, but particle lights shouldn’t be used for an actual light source as they have issues with collision, etc… Any suggestions?
I’d make a blueprint actor out of it…it can check the angler gel and update the colors however you see fit…it can adjust the particle or it could contain a point light in the blueprint actor that it updates…very flexible if you make it a blueprint actor all it’s own…
Make a blueprint actor out of what?
All my blueprints except for the standing torch it self are child blueprints. The standing torch has a child actor class which is the emitter. The emitter contains the light probe and the emitter becomes active when the standing torch is lit. First issue is even checking for the angler gel, second issue is ensuring the check is done when the standing torch is lit, and finally the last issue is changing the color. I could only get the color change working. I’m unsure if my code to check for angler gel is even working due to second issue.
Two ways i can think of:
You can setup a timer event that checks the “Container Activated” bool,it’s true when the torch is turned on.
You can hook a custom event into the Turn On/Off function through MultiUse. You’ll need to debug the incoming Array of the “Get Multiuse” function to get the “Use Index” for Turn on/off, then add a call to you custom event(to set the light color) for this Use Index to the “Try MuliUse” function.
Wouldn’t that be pretty awful for performance as it’d just be infinitely checking for this.
I’ve been trying to use the “Event BPClient Do Multi Use”, but the index is always 0. I followed the example usages shown in “StorageBox_Small_BlueprintUseTest”, but none of those usages seam to give an index other than 0 in my tests.
Event ClientDoMultiuse will only fire if “Return” is set to true in the “TryMultiUse” function. It’s also only firing for the client that triggered it. You would want to run a multicast event from the server to set the light color for all clients. You can do that trough the “TryMultiUse” function which is running on the server side.
About Timer performance: Im no Unreal Engine expert so i can’t really tell you how expensive they are performance wise. I haven’t read any warnings about using them and you can always include a check to ensure it only runs the color change once. I can’t imagine checking a bool and occasionally changing a light color every few seconds will bring down the performance in an engine that can deal with complex setups even in the tick event. BUT you can go with the multiuse solution in your case i think this is certainly the better way regarding perfomance.
About the color changing: Try to run a check on the used Particle System, it should be a different one for the angler gel. You can set the light color depending on that particle system.
I got the multiuse to work with the test box. Just need to figure out why it doesn’t work with my standing torch, but yeah this seams to be the way to go. Getting close to having the desired affect. I think this will also help in regards to doing a child of the standing torch then dynamically adding the point light to the emitter to avoid having to edit a copy of the standing torch… think I maybe able to kill 2 birds with 1 stone with this usage, lol.
You need to set the flag “Blueprint MultiUse Entries” to true in your Standing Torch Defaults if you haven’t already!
Ah, yup that was it. Unfortunately it looks like it completely wipes out the default Use functionality.
How do your MultiUse events look like? If you only implemented it and did nothing else so far make sure you connect the incoming and return array in the “GetMultiUse” function.
I think I’ll have to use a timer because there can be multiple fuel sources in 1 torch. So lets say I have 20 angler gel and 100 wood. If I only act on the use event then the light gets stuck as blue since it doesn’t bother updating again.
I used the use example storage box and removed the increment stuff. I’m still new to all this so the multiuse maybe a bit too complex for me at this time. For now I think the timer suggestion is best approach (and appears to work!).