Multiple light drain

Why not?

In the player, the player is checking what’s around them. But…

I think what would be best for me is to have the player able to switch lights (depending on the seat he is in) and only by looking at the light switch. Everywhere I see it says I need trigger boxes to do that, but I am starting the game in the car so I can’t use a trigger box (however I do need a trigger box to help find which seat the player is sitting in).

Not sure if I follow the logic. We started with light battery drain and now we’re talking about an entirely differnt system that has nothing to do with it. You surely have a clear vision in your mind but I have only a vague idea at this point regarding what triggers what.

  • player enters seat (how do you select which seat to enter?), there may be no need for a trigger box at all
  • player is in the seat and looks around, if they’re looking directly at a light switch (a static mesh?) that belongs to the seat they’re in, they can interact with this one switch

For the latter, trace along the forward vector to see what you hit - what the player is looking at. You can use components tags to identify which seat you’re in and which switch belongs to which chair. If there are going to be more elements the player interact with in the car, look into how Interface communication works.

Because the player needs to walk into the box for it to work. For example, light does not work at spawn, but when I change seat to move back to that seat where I spawned it then works

If it’s supposed to be automatic (no key press), then an overlapping volume is the way to go, why not. If you start in the seat, you can check what is around, which trigger box you’re in, the nodes mentioned above.

Besides that, you should probably setup some flags for the player so they know which seat they’re in. Since you start in that seat, you can set that flag to be the default. It can be a simple integer value, or a Map variable which could help with communication. There are really too many options.

There was also a tickbox for that behaviour (check overlaps on Begin Play or whatshername) somewhere but I can’t recall where - I think I had it explained by @ClockworkOcean?

edit: I thinks that’s it:

That really seemed like it was going to be my answer but strangely enough it still does not work. Only works when I re-enter the triggervolume

I guess I should try some sort of delayed spawn for my character? Would’nt know how to do that though…

You can give components tags to identify them, lets say the box is the trigger to enter the car:

image

When the game starts, the player check what components are overlapping them, if we find a component that makes sense in this context, you can trigger an action. The same set of nodes that trigger when you normally overlap the trigger can be connected to where the Print String is.

As you can see above, you can use multiple tags which can help identify what’s around us:

Avoid relying on delays, it will quickly turn into a debugging nightmare. If the target audience plays on a :potato: PC and the level takes 30s to load, they may as well be stuck forever.

Thank you very much. I am struggling a little with adding the lights to the car blueprint. My lights are just spotlights I dragged onto the scene (so no blueprint) (is this what a component is?).
How exactly would I add them to be part of the car? as shown in your example:

PointLight(CarSeat1) is the name

I guess I am going to need a step by step on how to do it

The green Add Component button in the upper left, and search for light as there are too many components in there. You can move the components in the hierarchy to attach them to something else.

Perfect, thanks

Should I place this blueprint in the car? adding the boxes to the car also?

The car is the blueprint actor. You create a car actor with any components a car would need:

image

And then place that ready actor in the world, you can place many.


Perhaps you could have a look at the vehicle template, there’s a car there. A drivable car is a bit more than a couple of meshes attached to one another. Unless your car needs no such thing, who knows.

Never made such a thing but if I were tasked with making a car with 4 interactive seats, each with a light switch, I’d create a Seat actor that has those elements:

And then add 4 of those Seat actors to the car via CACs:

Once you have a complete car actor, you can place it in the world:

And if you edit one of them, all of them will reflect those changes. And if you change the functionality of one of those seats, all seats in all cars will also be updated. No need to do any work more than once.


This sounds like a reasonable first step to me. The thing is that I do not know what else is needed further down the line so this may be a dead end. Hard to tell without knowing more.

Where exactly do I place and attach this on my specific trigger box?

Also My battery starts at 0 when I copied the battery drain blueprint. It needs to start at max battery going down only when lights are turned on. Twice as fast when 2 lights are on, 3 X as fast when 3 lights are on and 4 X as fast when 4 are on

Fixed the light problem on player start somehow. Now need to figure out the power draining of the car.

I have copied your light drain blueprint but ingame my progress bar is at 0, it needs to start full.

Maybe my current battery charge or Lights on is set wrong? They are both at 0, if I change the number the progress bar ingame still stuck at 0.

Maybe I need to change something in the progress bars widget?