# Can I group conditional buttons together?

**URL:** <https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [July 10, 2024, 1:05pm UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817 "2024-07-10T13:05:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gir1kisser](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gir1kisser/32/956742_2.png) [@gir1kisser](https://forums.unrealengine.com/u/gir1kisser)\
**Post date:** [July 10, 2024, 1:05pm UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/1 "2024-07-10T13:05:36Z")

</div>

I want to detect when a player is holding one of the items within a few different conditional buttons. Is it possible to group them together and call IsHoldingItem for all of them, or do I need to list them all separately?

---

<div class="post-metadata">

**Author:** ![O\_R\_A](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@O\_R\_A](https://forums.unrealengine.com/u/O_R_A)\
**Post date:** [July 10, 2024, 2:17pm UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/2 "2024-07-10T14:17:34Z")

</div>

You could store reference to each button in an array and iterate through it whenever you need to make that check.

---

<div class="post-metadata">

**Author:** ![gir1kisser](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gir1kisser/32/956742_2.png) [@gir1kisser](https://forums.unrealengine.com/u/gir1kisser)\
**Post date:** [July 11, 2024, 12:30pm UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/3 "2024-07-11T12:30:00Z")

</div>

I’m still pretty new to Verse so I’m not really sure how to do that if you could help? I’ve read through a lot of documentation, but I can’t seem to figure it out.

---

<div class="post-metadata">

**Author:** ![swaggod](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/swaggod/32/1051181_2.png) [@swaggod](https://forums.unrealengine.com/u/swaggod)\
**Post date:** [July 11, 2024, 6:04pm UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/4 "2024-07-11T18:04:42Z")

</div>

This function here will return true if Agent is holding any items in any of the buttons in array Buttons

```auto
@editable Buttons: []conditional_button_device = array{}
IsHoldingAnyItems(Agent: agent): logic = 
    for(Button: Buttons):
        if(Button.IsHoldingItem[Agent] = true):
            return true
    return false

```

---

<div class="post-metadata">

**Author:** ![gir1kisser](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gir1kisser/32/956742_2.png) [@gir1kisser](https://forums.unrealengine.com/u/gir1kisser)\
**Post date:** [July 12, 2024, 5:53am UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/5 "2024-07-12T05:53:12Z")

</div>

Oh my god I was working on this super late and forgot to reference the agent when calling the method, and I had no idea what this error meant:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/4/9/74902fd194a1cd2a3efdfdc68900244cf555776d.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/c/d1c176d4e742dc6fbcb8300a31f6d0c5546457c9.png)

Which led to me spending a TON of time trying to find workarounds, but still dealing with the IsHoldingNormalWeapon method always returning false and having no idea why. So thank you very much for helping me out, and sorry for the late reply, because I should’ve had this done and working yesterday lol.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [August 11, 2024, 5:53am UTC](https://forums.unrealengine.com/t/can-i-group-conditional-buttons-together/1932817/6 "2024-08-11T05:53:37Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
