# SetByCallerMagnitude for CheckCost function

**URL:** <https://forums.unrealengine.com/t/setbycallermagnitude-for-checkcost-function/1340555>\
**Category:** Programming & Scripting\
**Tags:** Gameplay-Effects, unreal-engine, Gameplay-Ability-System, Blueprint, CPP, question\
**Created:** [October 22, 2023, 8:30am UTC](https://forums.unrealengine.com/t/setbycallermagnitude-for-checkcost-function/1340555 "2023-10-22T08:30:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmperitum](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lmperitum](https://forums.unrealengine.com/u/lmperitum)\
**Post date:** [October 22, 2023, 8:30am UTC](https://forums.unrealengine.com/t/setbycallermagnitude-for-checkcost-function/1340555/1 "2023-10-22T08:30:33Z")

</div>

How can I override the CheckCost function in GameplayAbility and make AssignSetByCallerMagnitude for CostGameplayEffect in it?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/b/e9b922746854c67f48de3564274ccfdbb7aa633d.png)

---

<div class="post-metadata">

**Author:** ![intronaut](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/intronaut/32/465475_2.png) [@intronaut](https://forums.unrealengine.com/u/intronaut)\
**Post date:** [May 3, 2024, 5:58pm UTC](https://forums.unrealengine.com/t/setbycallermagnitude-for-checkcost-function/1340555/2 "2024-05-03T17:58:28Z")

</div>

Hey Imperitum,

have you ever found an elegant solution to this?

Edit: Oh well, seconds after writing this I found something that seems to work.  
I overrode the CheckCost function of the GameplayAbility like you did, but added a line. (Marked in blue)  
Note that the cost value is negative.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/d/d7d8641191909930a1a3e08abdf61cf9c75ac84a.png)

I have no idea if this is in any way a bad way to do this or if this will break things down the road, but it works for me in standalone and client PIE mode.
