Damaged Events are Bugged and will give Incorrect Instigators

Reference ID

0c785e16-4866-ffe9-74c2-8e86b0357ecf

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

If you are dealt damage via Verse code the instigator will be the fort_character even though in Fortnite.Digest.Verse it states for the Instigator “Player, agent, etc. that instigated the damage to Target. Can be false when damage is instigated by code, the environment, etc.”

Steps to Reproduce

  1. Create a verse file and make the verse code run a function when a fort_character is damaged (Using DamagedEvent )
  2. Deal damage to a fort_character without passing a instigator
  3. With the function the DamagedEvent is subscribed to, get the Instigator fort_character using “fort_character[DamageResult.Instigator?]” (Where the damage_result is named “DamageResult” in the function)
  4. Use any kind of method to verify that it is indeed the same fort_character as the one who was the DamageResult.Target

Expected Result

As the Fortnite.Digest.Verse states the “Instigator” should be false since the damage was instigated by code

Observed Result

The “Instigator” is the same as the “Target” despite never mentioning that.

Platform(s)

windows

Island Code

6242-6918-1114

Additional Notes

Video showing the bug: https://youtu.be/bhUQHV7OmEA

In the video the way I called the damage event from verse was by when a player dealt damage for verse to by itself do 5 damage, And then using some Hud Message Devices to show the 3 first damaged events
Verse Code used in the video:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/FortPlayerUtilities }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.


game_manager := class(creative_device):
    StM<localizes>(TargetAgent:agent,DamageDealtByAgent:agent,Amount:float):message="'{DamageDealtByAgent}' dealt to '{TargetAgent}' {Amount} damage"
    var MaxTimesFuncCanRun : int = 0
    @editable ElimLog : []hud_message_device = array{}
    OnBegin<override>()<suspends>:void=
        
        Players := GetPlayspace().GetPlayers()
        for(Player:Players): # Registers Everyone to the HandlePlayerHit Function
            if(FC:=Player.GetFortCharacter[]):
               FC.DamagedEvent().Subscribe(HandlePlayerHit)

    HandlePlayerHit(DamageResult : damage_result) : void =
        Target := DamageResult.Target
        Amount := DamageResult.Amount
         
        set MaxTimesFuncCanRun += 1 # Used to prevent Infinite loops of the charactar damaging themselves.
        if(HUDMSG:=ElimLog[MaxTimesFuncCanRun-1],TargetAgent:=fort_character[Target].GetAgent[],DamageDealtByAgent:=fort_character[DamageResult.Instigator?].GetAgent[]):
            HUDMSG.Show(StM(TargetAgent,DamageDealtByAgent,Amount)) # A log that will show in-game in order the Damaged Events Who was Damaged, how much and by who

        if (DamagedCharacter := fort_character[Target],MaxTimesFuncCanRun<=3): # This will make the character who was damaged to get slightly more damage
                DamagedCharacter.Damage(5.0)

Additionally I found out that the “Source” from the damage result will also be the fort_character that was damaged if the damage was done via verse code in which again the digest states that if the damage was caused by code it would’ve been false

I made some small changes to the previous code so the Damage log will show if the Source is a fort_character (or if its not).
As it can be seen from the video when someone is damaged via verse code it will have the Damaged fort_character be the same as the source while if a player was damaged via etc a weapon that won’t be the case

For anyone reading this there’s an easy to workaround this.

On the damaged event function you can put some code like this to distinguish normal player damage from code

if(TargetFC:=fort_character[DamageResult.Target],InstigFC:=fort_character[DamageResult.Instigator?],not TargetFC=InstigFC):

Obviously it has its flaws like how it’ll ignore self-inflicted damage from a rocket even though it was from a real player.