# How to trigger a function with two events connected?

**URL:** <https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614>\
**Category:** Character & Animation\
**Tags:** unreal-engine, static, functions, UE4, question\
**Created:** [June 12, 2020, 4:18am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614 "2020-06-12T04:18:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vihulym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vihulym](https://forums.unrealengine.com/u/vihulym)\
**Post date:** [June 12, 2020, 4:18am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614/1 "2020-06-12T04:18:22Z")

</div>

Hey guys, so I have another question to ask. Does anyone know how to trigger a function with two connected events? For example, I want to trigger a function (\*\*\*\*insert function here, ex. boost my character’s speed up) while my Mannequin character is overlapping a box and the Spacebar Key is pressed simultaneously. Does anyone know how to pull that off? (Also, I’m trying to pull it off with Static Mesh Components). Can anyone please help? Thanks.

---

<div class="post-metadata">

**Author:** ![Rene\_Zwaan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rene\_Zwaan](https://forums.unrealengine.com/u/Rene_Zwaan)\
**Post date:** [June 12, 2020, 4:35am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614/2 "2020-06-12T04:35:54Z")

</div>

Hey Vihulym,

You can store the result of the spacebar into a variable. Then on the overlap, you check the state of the variable.

 ![304227-space.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/6/b66dce454896c82e3f2349815e4b28a037c670b6.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [June 12, 2020, 10:42am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614/3 "2020-06-12T10:42:45Z")

</div>

Or even like this if you do not want to set up any bools, you can add many conditions this way:

 ![304220-annotation-2020-06-12-114201.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/9/ee9cb0c06bfb260c5dd3de877048424df6bfc23c.jpeg)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [June 12, 2020, 11:14am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614/4 "2020-06-12T11:14:15Z")

</div>

I decided to combine Rene Zwaan and Everynone solutions and create this one, which will work either you pressed the key before or after entering the overlapping box. Unfortunately uses Tick.

 ![304237-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/5/4252fc4fd358a5fbf28c042336a6a7f324de3ce9.jpeg)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [June 12, 2020, 11:26am UTC](https://forums.unrealengine.com/t/how-to-trigger-a-function-with-two-events-connected/466614/5 "2020-06-12T11:26:58Z")

</div>

And here is one without Tick:

 ![304241-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/9/8/d98cba41fb119822c053fc393bc708e42f1094c9.png)
