# Bind a function to a delegate with preset params

**URL:** <https://forums.unrealengine.com/t/bind-a-function-to-a-delegate-with-preset-params/794410>\
**Category:** C++\
**Tags:** UE-5, unreal-engine, CPP, question\
**Created:** [March 19, 2023, 10:52pm UTC](https://forums.unrealengine.com/t/bind-a-function-to-a-delegate-with-preset-params/794410 "2023-03-19T22:52:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Otter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Otter](https://forums.unrealengine.com/u/Otter)\
**Post date:** [March 19, 2023, 10:52pm UTC](https://forums.unrealengine.com/t/bind-a-function-to-a-delegate-with-preset-params/794410/1 "2023-03-19T22:52:23Z")

</div>

Hey all,

I’m setting up a stamina system and I’m trying to work around how I can bind a function with parameters to a delegate.

In my code, I declare the delegate:

```auto
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStaminaDepleted);

UPROPERTY(BlueprintAssignable)
FOnStaminaDepleted OnStaminaDepleted;

```

I have the sprint function (among many I’ll make down the line) that I want to be called with the value automatically set to false.

```auto
void Sprint(bool ToggleAbility);

```

I’m sure there must be a way to bind a function with an param to param-less delegate and preset it so that whenever the delegate is broadcast, it calls the function and passes false to it.

Any help would be appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [March 20, 2023, 10:15am UTC](https://forums.unrealengine.com/t/bind-a-function-to-a-delegate-with-preset-params/794410/2 "2023-03-20T10:15:31Z")

</div>

I don’t think this is possible with a dynamic delegate.  
Those only support binding to UFunctions as they are called by name and via ProcessEvent, which expects all function parameters to be packed in.

Only with a non-dynamic delegate you could bind to a Lambda.

---

<div class="post-metadata">

**Author:** ![Otter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Otter](https://forums.unrealengine.com/u/Otter)\
**Post date:** [March 21, 2023, 4:44am UTC](https://forums.unrealengine.com/t/bind-a-function-to-a-delegate-with-preset-params/794410/3 "2023-03-21T04:44:43Z")

</div>

Hmmmm…Could be an issue, since non-dynamic delegates don’t support BP integration.

Thank you nonetheless.
