# Rarity comparison. A simpler way?

**URL:** <https://forums.unrealengine.com/t/rarity-comparison-a-simpler-way/2739012>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite, verse\
**Created:** [July 28, 2026, 10:52pm UTC](https://forums.unrealengine.com/t/rarity-comparison-a-simpler-way/2739012 "2026-07-28T22:52:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abrizzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abrizzer](https://forums.unrealengine.com/u/Abrizzer)\
**Post date:** [July 28, 2026, 10:52pm UTC](https://forums.unrealengine.com/t/rarity-comparison-a-simpler-way/2739012/1 "2026-07-28T22:52:23Z")

</div>

Hello I’m working with custom inventories and items. The player has multiple inventories, where items can be placed and in some UI’s Like a sell/buy I want to get the items count of them by rarity.  
I solved this by checking item rarities with the next code:

```auto
IsRarityValid(Rarity:rarity, RarityType:concrete_subtype(rarity), IncludeSubRarities:logic)<decides>:void=
        if:
            IncludeSubRarities?
            RarityType[Rarity]
        then:
            true?
        else if:
            not IncludeSubRarities?
            Type : concrete_subtype(rarity) = RarityType
            Instance := Type{}
            TryGetRarityAsInt[Rarity] = TryGetRarityAsInt[Instance]
        then:
            true?
        else:
            false?

    TryGetRarityAsInt<public>(Rarity:rarity)<decides><reads>:int=
        if(legendary_rarity[Rarity]):
            4
        else if(epic_rarity[Rarity]):
            3
        else if(rare_rarity[Rarity]):
            2
        else if(uncommon_rarity[Rarity]):
            1
        else if(common_rarity[Rarity]):
            0
        else:
            false?
            -1

```

Is there a simpler way to approach this? I would like to use just **subtype(rarity)** but that doesn’t seem feasible as it’s not posible to compare.

---

<div class="post-metadata">

**Author:** ![Boschkoo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/boschkoo/32/1198267_2.png) [@Boschkoo](https://forums.unrealengine.com/u/Boschkoo)\
**Post date:** [August 18, 2026, 12:06am UTC](https://forums.unrealengine.com/t/rarity-comparison-a-simpler-way/2739012/2 "2026-08-18T00:06:53Z")

</div>

Your two-branch design is already the Verse way. `subtype(rarity)` is not a value you can compare; `concrete_subtype(rarity)` plus a type predicate is.

If you only need “is this rarity X, including custom children of X”:

```auto
IsRarity(Rarity:rarity, RarityType:concrete_subtype(rarity))<decides>:void=
    RarityType[Rarity]

```

That is the whole check. `epic_rarity[Item.GetRarity[]]` is enough for a count-by-rarity UI.

The int map is only useful when you want an order (“rare or better”), because Verse will not give you `Rarity >= rare_rarity`. Keep `TryGetRarityAsInt` for that, drop it for exact buckets.

`IncludeSubRarities` only matters if you defined your own rarities as children of the built-ins. The five stock ones (`common` … `legendary`) are siblings, so `RarityType[Rarity]` is already exact.

I would not fight `subtype`. Store the wanted rarity as `concrete_subtype(rarity)` on the shop widget and filter with the predicate. The int helper stays as a small private function for sort / “at least this tier”.

---

<div class="post-metadata">

**Author:** ![Abrizzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abrizzer](https://forums.unrealengine.com/u/Abrizzer)\
**Post date:** [August 20, 2026, 2:03pm UTC](https://forums.unrealengine.com/t/rarity-comparison-a-simpler-way/2739012/3 "2026-08-20T14:03:08Z")

</div>

Thanks, for the reply.  
I would need to keep it like this then. Because in let’s say I have 5 common and 3 legendary of the same item but different rarity.  
In some UI’s its okay to show “8” common but in others i need to distinguish between them an show them separately as 5 common and 3 legendary.  
Cheers!
