# Entity Component model using verse scripts?

**URL:** <https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [February 15, 2024, 5:04pm UTC](https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933 "2024-02-15T17:04:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMo75](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PMo75](https://forums.unrealengine.com/u/PMo75)\
**Post date:** [February 15, 2024, 5:04pm UTC](https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933/1 "2024-02-15T17:04:52Z")

</div>

I’ve been messing around in UEFN for a month or so. I come from a Unity and UE background, where you can add reusable scripted components on an actor or game object. For example a health component that you can add to players and npc actors.

Does UEFN have the same concept or does everything created in Verse have to be a device that references other actors? Or is there a better way to model this?

Thanks!

---

<div class="post-metadata">

**Author:** ![tyler.dawson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tyler.dawson](https://forums.unrealengine.com/u/tyler.dawson)\
**Post date:** [February 15, 2024, 8:28pm UTC](https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933/2 "2024-02-15T20:28:38Z")

</div>

Any class you make you can use as a field in any other class. be careful this because the interactions between classes can be strange.  
I made a post about this earlier today. [Using creative\_device classes as an editable requires it to be optional.](https://forums.unrealengine.com/t/using-creative-device-classes-as-an-editable-requires-it-to-be-optional/1691132)

I believe this is the best way make ‘component’ like classes in verse. I’ve also seen people make custom ‘player’ classes that make keeping track of a player’s state a lot easier.

I hope that answers your question.

---

<div class="post-metadata">

**Author:** ![PMo75](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PMo75](https://forums.unrealengine.com/u/PMo75)\
**Post date:** [February 16, 2024, 4:09pm UTC](https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933/3 "2024-02-16T16:09:36Z")

</div>

That’s awesome. I’ll look into that. Do you happen to have a link or example of the custom “player” classes?

Thank you!

---

<div class="post-metadata">

**Author:** ![tyler.dawson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tyler.dawson](https://forums.unrealengine.com/u/tyler.dawson)\
**Post date:** [February 16, 2024, 7:20pm UTC](https://forums.unrealengine.com/t/entity-component-model-using-verse-scripts/1690933/4 "2024-02-16T19:20:41Z")

</div>

> [@PMo75](#):
>
> Do you happen to have a link or example of the custom “player” classes?
> 
> Thank you!

I don’t have a link but here’s the basic idea of the top of my head

```auto
custom_player := class:
    Agent : agent #this could also be player or fortcharacter
    Team : int
    Score : int
    LoadOut : load_out = load_out {} #uses the defalts in a load_out class you make

```

when the game loads you can get a list of all the players then initialize a custom\_player for each and keep track of them in an array or map. There’s also an event for when ever someone joins your game that will let you handle adding new players.
