Would anyone have an idea on how I would set this feature up. I have an item in my game that is night vision. What I am trying to do is set a duration of a maximum 30 seconds for when the night vision is on. So anytime the player activates them on it would set a timer counting down from thirty. Then when it hits 0 the item turns off. Now I already have something set up using int with a custom function that subtracts 1 int from the maximum 30 int which works as intended but what has stumped me is setting the rate for how it counts down. What I am use to doing is using the set timer by custom event node but the issue is the night vision is an item with its functionality made within an inventory system with a function which I cannot make a custom event inside of it nor will calling that event work either so could someone help with something else I could maybe use or a different way of setting this up without using the set timer by event node?
I think you’ll find, the timing of this needs to happen in the player.
I have an item in my game that is night vision.
So what is the Night Vision? It’s not an object? If it’s not, then I concur - if there’s only 1 night vision and it’s related to the player, have the timer work inside the PlayerBP.
Btw, you can start a timer event inside a function, you need to delegate the event like so:
The event can be in another object, too - once you provide a target Object instance.
Or like so:
The night vision has its seperate bp that is an actor class. This item spawns in game and can be picked up but the set up is done within its own function for my inventory so would what you showed above still work?
Just have the timer in the NightVision actor. Set up functionality to control it and call it there.
That’s unless you Destroy
that actor when you pick it up and only indicate in the inventory that you have it.
How does it really work?
- player has no NV
- player picks-up NV
- was the NV actor destroyed?
If no, keep the timer in the NV.
so would what you showed above still work?
Yeah, but there’s no need. Set up the timer in the main graph, like you’d do with everything else.
So basically, the player has nothing in their inventory, the player then finds the nv, then the player picks it up which destroys the nv actor and put it in the players inventory which then I am using arrays and enums to store the items info which then has a separate function hooked into my inventory system which is the nv function which is where I am able to have the nv turn on and off.
If you destroy it, and only create smoke & mirrors that the player still has it, then do it all in the playerBP. An actor that was destroyed cannot do anything anymore.