# Agent not working in Verse

**URL:** <https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 13, 2024, 3:06pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188 "2024-02-13T15:06:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrazyOno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyOno](https://forums.unrealengine.com/u/CrazyOno)\
**Post date:** [February 13, 2024, 3:06pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/1 "2024-02-13T15:06:28Z")

</div>

Hey i am new in verse and followed a video about how to get the Player who damaged someone and the example in the video was how to send back damege to the Damage dealing Player with “FortCharacterInstigator.Damage(2.0)” and now i wanted my trackers value the Damage dealing player and used

```auto
 HandlePlayerHit ( DamageResult : damage_result ) : void =
        Target := DamageResult.Target
        Amount := DamageResult.Amount
        if (FortCharacterWhoWasHit := fort_character[Target]):
        if (Instigator := DamageResult.Instigator?, Agent := Instigator.GetInstigatorAgent[], FortCharacterInstigator := Agent.GetFortCharacter[]):
            TargetValue7 := Tracker8.GetValue(FortCharacterInstigator)
            TargetValue6 := Tracker7.GetValue(FortCharacterInstigator)
            TargetValue5 := Tracker6.GetValue(FortCharacterInstigator)
            TargetValue4 := Tracker5.GetValue(FortCharacterInstigator)
            TargetValue3 := Tracker4.GetValue(FortCharacterInstigator)
            TargetValueNew := Tracker3.GetValue(FortCharacterInstigator)
            TargetValue2 := Tracker2.GetValue(FortCharacterInstigator)
            TargetValue := Tracker.GetValue(FortCharacterInstigator)"

```

for it but here FortCharacterInstigator is marked red. Would be happy over any reply 🙂

---

<div class="post-metadata">

**Author:** ![The3v0luti0n](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/the3v0luti0n/32/897083_2.png) [@The3v0luti0n](https://forums.unrealengine.com/u/The3v0luti0n)\
**Post date:** [February 13, 2024, 6:11pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/2 "2024-02-13T18:11:51Z")

</div>

If you hover your mouse over the red error, what does it say the error is?

---

<div class="post-metadata">

**Author:** ![giovauefn](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/giovauefn/32/1211471_2.png) [@giovauefn](https://forums.unrealengine.com/u/giovauefn)\
**Post date:** [February 13, 2024, 8:10pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/3 "2024-02-13T20:10:18Z")

</div>

The damage could be done by some world object, so you must tell him that it could not be an agent.  
To do this, we use [Option](https://dev.epicgames.com/documentation/en-us/uefn/option-in-verse).  
This is the fix:

```auto
HandlePlayerHit ( DamageResult : damage_result ) : void =
        Target := DamageResult.Target
        Amount := DamageResult.Amount
        if (FortCharacterWhoWasHit := fort_character[Target]):
        if (Instigator := DamageResult.Instigator?, Agent := Instigator?.GetInstigatorAgent[], FortCharacterInstigator := Agent.GetFortCharacter[]):
            TargetValue7 := Tracker8.GetValue(FortCharacterInstigator)
            TargetValue6 := Tracker7.GetValue(FortCharacterInstigator)
            TargetValue5 := Tracker6.GetValue(FortCharacterInstigator)
            TargetValue4 := Tracker5.GetValue(FortCharacterInstigator)
            TargetValue3 := Tracker4.GetValue(FortCharacterInstigator)
            TargetValueNew := Tracker3.GetValue(FortCharacterInstigator)
            TargetValue2 := Tracker2.GetValue(FortCharacterInstigator)
            TargetValue := Tracker.GetValue(FortCharacterInstigator)"

```

I have simply added a ? after Instigator:

```auto
Agent := Instigator?.GetInstigatorAgent[]

```

---

<div class="post-metadata">

**Author:** ![CrazyOno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyOno](https://forums.unrealengine.com/u/CrazyOno)\
**Post date:** [February 16, 2024, 1:53pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/4 "2024-02-16T13:53:04Z")

</div>

Hey this is the problem hope this helps you

 ![Bild_2024-02-16_145258776](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/e/3de857cacc13f4f0c42cb5d3cd461ef476aaeda8.png)

---

<div class="post-metadata">

**Author:** ![CrazyOno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyOno](https://forums.unrealengine.com/u/CrazyOno)\
**Post date:** [February 16, 2024, 1:54pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/5 "2024-02-16T13:54:47Z")

</div>

Sorry for my late respond. I have checked your tip and added the “?” and now the “?” and the “FortCharacterInstigator” are marked red

 ![Screenshot 2024-02-16 145321](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/1/4816b0ef6d745fd5b6b40b6991158a72d813d139.png)

---

<div class="post-metadata">

**Author:** ![The3v0luti0n](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/the3v0luti0n/32/897083_2.png) [@The3v0luti0n](https://forums.unrealengine.com/u/The3v0luti0n)\
**Post date:** [February 16, 2024, 2:00pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/6 "2024-02-16T14:00:24Z")

</div>

The Tracker’s GetValue function expects an Agent, not a FortCharacter. So either give it a parameter of type Agent, or you could use the Player as well. Either one should work.

---

<div class="post-metadata">

**Author:** ![CrazyOno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyOno](https://forums.unrealengine.com/u/CrazyOno)\
**Post date:** [February 16, 2024, 2:03pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/7 "2024-02-16T14:03:15Z")

</div>

How do i need to rewrite my script to make the FortCharacter an Agent?

---

<div class="post-metadata">

**Author:** ![giovauefn](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/giovauefn/32/1211471_2.png) [@giovauefn](https://forums.unrealengine.com/u/giovauefn)\
**Post date:** [February 16, 2024, 5:05pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/8 "2024-02-16T17:05:53Z")

</div>

My bad, didn’t see you put already the ? When defining Instigator. Revert that thing I said

---

<div class="post-metadata">

**Author:** ![giovauefn](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/giovauefn/32/1211471_2.png) [@giovauefn](https://forums.unrealengine.com/u/giovauefn)\
**Post date:** [February 16, 2024, 5:06pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/9 "2024-02-16T17:06:36Z")

</div>

Just put Agent inside the brackets

---

<div class="post-metadata">

**Author:** ![The3v0luti0n](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/the3v0luti0n/32/897083_2.png) [@The3v0luti0n](https://forums.unrealengine.com/u/The3v0luti0n)\
**Post date:** [February 16, 2024, 6:04pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/10 "2024-02-16T18:04:22Z")

</div>

TargetValue := Tracker.GetValue(Agent)

---

<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:** [March 17, 2024, 6:05pm UTC](https://forums.unrealengine.com/t/agent-not-working-in-verse/1686188/11 "2024-03-17T18:05:24Z")

</div>

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