# Issue with documentation tutorial: "Create your own NPC Medic"

**URL:** <https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660>\
**Category:** Feedback & Requests\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [January 26, 2024, 12:53pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660 "2024-01-26T12:53:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SatoriFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/satorifn/32/720436_2.png) [@SatoriFN](https://forums.unrealengine.com/u/SatoriFN)\
**Post date:** [January 26, 2024, 12:53pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/1 "2024-01-26T12:53:07Z")

</div>

For the “Create your own NPC Medic” tutorial on the documention, in the queue.verse code that the documentation provides, there is a script error. Line 5 for “(t:type)”.

See error from UEFN: _queue.verse(5,14, 5,22) : Script error 3502: Can’t access a function from a preceding type._

Any potential solutions?

Link: [Create your own NPC Medic](https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-npc-medic-in-verse)

Full code below:

```auto
list(t:type) := class:
    Data:t
    Next:?list(t)

queue<public>(t:type) := class<internal>:
    Elements<internal>:?list(t) = false
    Size<public>:int = 0

    Enqueue<public>(NewElement:t):queue(t) =
        queue(t):
            Elements := option:
                list(t):
                    Data := NewElement
                    Next := Elements
            Size := Size + 1

    Dequeue<public>()<decides><transacts>:tuple(queue(t), t) =
        List := Elements?
        (queue(t){Elements := List.Next, Size := Size - 1}, List.Data)

    Front<public>()<decides><transacts>:t = Elements?.Data

CreateQueue<public><constructor>(InData:t where t:type) := queue(t):
    Elements := option:
        list(t):
            Data := InData
            Next := false
    Size := 1

```

---

<div class="post-metadata">

**Author:** ![Stevie-Moon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/stevie-moon/32/701656_2.png) [@Stevie-Moon](https://forums.unrealengine.com/u/Stevie-Moon)\
**Post date:** [January 26, 2024, 2:04pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/2 "2024-01-26T14:04:10Z")

</div>

@SatoriFN Thank you for your feedback. While I cannot guarantee a response, I can confirm that this has been forwarded to the appropriate team.

---

<div class="post-metadata">

**Author:** ![SatoriFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/satorifn/32/720436_2.png) [@SatoriFN](https://forums.unrealengine.com/u/SatoriFN)\
**Post date:** [January 31, 2024, 7:39pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/3 "2024-01-31T19:39:50Z")

</div>

Solution:

The code provided in the tutorial has to be in the same .verse file with the queue class code preceding the code found in medic\_example.verse. Though not always ideal, it does work.

See this forum post for a previous run in of this issue: [Unusable Verse modules](https://forums.unrealengine.com/t/unusable-verse-modules/1367579)

---

<div class="post-metadata">

**Author:** ![Daigoro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daigoro](https://forums.unrealengine.com/u/Daigoro)\
**Post date:** [January 31, 2024, 7:42pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/4 "2024-01-31T19:42:10Z")

</div>

Yes, never use generic classes or type aliases across files. It is a ticking bomb and will randomly work or fail.

---

<div class="post-metadata">

**Author:** ![Microcosms](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/microcosms/32/1196416_2.png) [@Microcosms](https://forums.unrealengine.com/u/Microcosms)\
**Post date:** [January 31, 2024, 10:06pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/5 "2024-01-31T22:06:20Z")

</div>

@SatoriFN This is a tricky problem with the current compiler. Parametric classes like the `queue` are not currently usable outside of their file, but putting the file that calls the generic class in a submodule resolves this. Check step 2.6 in the “Healing Characters inside a volume” of the medic tutorial, that’s the part that covers moving the `medic_example` into its own separate submodule. In a future version of Verse this step should be unnecessary - parametric classes like `queue.verse` will be useable in other files regardless of your file structure. You could also implement `queue.verse` in the file that calls it directly but as you said it’s not always ideal. Check if the file structure in the image I attached resolves the error.

 ![SubmoduleQueue](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/9/be902d776fa6a89d0dfd9dec9352d8339ce0e5c1.png)

---

<div class="post-metadata">

**Author:** ![SatoriFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/satorifn/32/720436_2.png) [@SatoriFN](https://forums.unrealengine.com/u/SatoriFN)\
**Post date:** [February 2, 2024, 12:53pm UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/6 "2024-02-02T12:53:47Z")

</div>

Hi @Microcosms Thanks, this is very helpful. With the new file structure, I don’t have any errors and the medic functions properly.

Thanks for the info about a future version when parametric classes will be useable regardless of file structure–exciting!

---

<div class="post-metadata">

**Author:** ![LionUnchained](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lionunchained/32/1039015_2.png) [@LionUnchained](https://forums.unrealengine.com/u/LionUnchained)\
**Post date:** [March 14, 2024, 7:30am UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/7 "2024-03-14T07:30:46Z")

</div>

Was this fixed in the last update?

---

<div class="post-metadata">

**Author:** ![devil\_dog1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@devil\_dog1](https://forums.unrealengine.com/u/devil_dog1)\
**Post date:** [May 3, 2024, 1:30am UTC](https://forums.unrealengine.com/t/issue-with-documentation-tutorial-create-your-own-npc-medic/1643660/8 "2024-05-03T01:30:19Z")

</div>

THANK YOU! This corrected the issues for me too. I apologize, I really believed I followed the tutorial exactly as written. I am noob. I am learning how to program.
