# How can i make += -= /= etc

**URL:** <https://forums.unrealengine.com/t/how-can-i-make-etc/121454>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [January 22, 2019, 8:32pm UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454 "2019-01-22T20:32:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![golfso66](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@golfso66](https://forums.unrealengine.com/u/golfso66)\
**Post date:** [January 22, 2019, 8:32pm UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/1 "2019-01-22T20:32:00Z")

</div>

Hello everyone. I started using Unreal Engine some days ago and it’s been great so far. I really love the Blueprint system and i enjoy it a lot. I was wondering how can i make a += -= /= \*= operators using Macros? I am not really comfortable using C++ so i don’t know if its possible to make it without it. I haven’t really worked with macros but i think this is the way to make it. Thanks in advice! 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a6627ffa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a6627ffa](https://forums.unrealengine.com/u/anonymous_user_a6627ffa)\
**Post date:** [January 23, 2019, 6:46am UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/2 "2019-01-23T06:46:30Z")

</div>

Hi golfso, is there any specific reasons you would need macros? These functions are already built into the blueprint editor, just search for “math” and you will find all operations for different types of variables.

---

<div class="post-metadata">

**Author:** ![golfso66](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@golfso66](https://forums.unrealengine.com/u/golfso66)\
**Post date:** [January 23, 2019, 7:58am UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/3 "2019-01-23T07:58:52Z")

</div>

> [@anonymous\_user\_a6627ffa](#):
>
> Hi golfso, is there any specific reasons you would need macros? These functions are already built into the blueprint editor, just search for “math” and you will find all operations for different types of variables.

Hello, yeah i just need to do something like for example a Health Pickup. If the player have 53 health he would be able to pick a first aid kit and his health would go to 91 for example. And also i can’t find += in the math section. What i am trying to do is basiclly:

if(HealPickUp == isPicked) {  
health += 25;  
}

---

<div class="post-metadata">

**Author:** ![ambershee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ambershee](https://forums.unrealengine.com/u/ambershee)\
**Post date:** [January 23, 2019, 9:48am UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/4 "2019-01-23T09:48:40Z")

</div>

In Blueprint you would just explicitly Set Health = Get Health + 25. You don’t need += or similar macros.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44df76161](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44df76161](https://forums.unrealengine.com/u/anonymous_user_44df76161)\
**Post date:** [January 23, 2019, 12:17pm UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/5 "2019-01-23T12:17:13Z")

</div>

There is a specific block for +=. look for ++. and you dont need to set the value afterwards either as you pass your variable by reference.

You could also write your own so that it passes the variable by reference to your function and the variable outside the function will be altered with the new values set inside the function.

read this up for bass-by-reference

> **[What does Pass-By-Reference do?](https://forums.unrealengine.com/questions/156052/what-does-pass-by-reference-do.html)**
>
> I’ve been working with UE4 for 1-2 months now so I’m pretty familiar with most of the Blueprint/Event Graph stuff, however I am still a bit confused about the Pass-By-Reference checkbox on function/event inputs. I found plenty of threads here...

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [January 23, 2019, 1:10pm UTC](https://forums.unrealengine.com/t/how-can-i-make-etc/121454/6 "2019-01-23T13:10:43Z")

</div>

Do not make macros for this, make functions, then turn them into pure functions (there is checkbox in function details panel).  
And put those functions in function library. Be bit careful with function libraries to not make dependencies (ie. general purpose library should not reference anything from outside of it).
