How to reduce stamina when player enters a box ?
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.
asked Sep 22 '15 at 04:10 PM in Blueprint Scripting
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.
answered Sep 22 '15 at 05:21 PM
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.
answered Sep 22 '15 at 06:12 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here