How to reduce stamina when player enters a box?

Hi folks

I am planning to have something like a poison gas surrounding a mesh. So i created a box and have it as a child of the mesh.

I then setup the onbeginoverlap and the necessary nodes but it does not work. Already have the overlap settings in the box and mesh to true. It is the same graph i used on an object but when i tried the graph on an object, the overlap works.

So anyone can help me or maybe give me an example of a simple graph where the player enter the box with gas, has his stamina reduced the longer he stays there.

Thank you

Hi man , on begin overlap , its an event that occur just one time, when you enter the trigger.
once you are in there the event does not fire enymore, unitl you exit, then he cast, on end overlap.

There are several ways to to this , that all occur to different problem , here a working example,
you can set a variable to the char/enemy/player who enter in the trigger, using the cast to method.
So in the Char/enemy/player you can check at every thick , if you are in the damage area.
if yes , you just detract the right damage of life, or stamina in your case.

Its pretty simple,
you can also create a custom event, like, FIREevent or FOG event.
that check your variable , and then reduce your life , your breath or your stamina.

Basically, add a Collision Component to your gas cloud object. Also add a variable to keep track of which character is currently inside the cloud. When the player enters the cloud, set the variable to the player. When he leaves, reset it to None.

In the event tick, if there’s currently a valid target in the cloud, reduce their stamina.

Should it ever be possible for more than one target to be affected by the cloud, you could also keep track of a list of targets.

Thank you for the kind reply.

I have gotten it to work on a player one time if he stays in the cloud, but not continously in the gas.

Seems like i cant use Cast To PlayerController node as i had a string trigged when casting failed.

Can you suggest other nodes to use ?

Thank you so much for the prompt reply.

Let me give it a try.

What Cast to PlayerController node? I didn’t use the controller in my solution. You need to cast to your character Blueprint because only actors of that time will have stamina that can be reduced.