The rarity_component is a Scene Graph component used to assign a rarity to an entity. Refer to Working with Entities and Components for how to add a component to your entity.
Class Description
A rarity_component contains a single field, Rarity. It can be used to indicate how common (or rare) an entity is. Fortnite uses established rarities to communicate to players how powerful, valuable, or special items they find in the world are. These are also available to you (listed below in hierarchical order, from most common to most rare):
Common Assault Rifle |
| |
Uncommon Assault Rifle |
| |
Rare Assault Rifle |
| |
Epic Assault Rifle |
| |
Legendary Assault Rifle |
|
Fortnite Items communicate their rarity in the HUD, through colored backgrounds for their Item Icons. These colors are consistent, regardless of what item they represent. It makes it much easier for a Player to know which items are likely to be more valuable than others, when they sort through their inventories. These colors can be found inside the rarity type.
Example
You can add a rarity_component to your entity to give them a rarity that can be compared with other entities.
By adding the rarity_component you can give an entity a Rarity.
Verse: Rarity
Using Verse you can interact with the rarity_component in several ways. One way is to subclass the component and add new fields to it. By default the component only holds a field for Color, but you could create new fields to add new concepts to rarity in your experience.
Another way is to create new, custom rarities that could be selected and used by your entities with a rarity_component. In the example below we make a new component that will add a material to a specific mesh, then change a material parameter on a specific material to have it show the Color found in its rarity_component.
A new static mesh is added to the project called SM_Box, with a single material slot (
Material_0).The mesh is added as a component to a prefab that has a
rarity_component.A new material named M_Rarity is added to the project.
The material has a color parameter named Color.
Verse# Copyright Epic Games, Inc. All Rights Reserved. using { /UnrealEngine.com/Itemization } using { /Verse.org/Colors/NamedColors } using { /Verse.org/SceneGraph } NewRarities<public> := module :
The entities above have the SM_Box component, a rarity_component (each with a different rarity set) and the custom display_rarity_color_component. See how the material parameter has been set to the color inside each of the different rarities.