Does the damage_result instigator or source even work??

This is what is in the code for damage_result


damage_result<native><public> := struct<epic_internal>:
        # Object that was damaged.
        Target<native><public>:damageable

        # Amount of damage applied to `Target`.
        Amount<native><public>:float

        # Player, agent, etc. that instigated the damage to `Target`. Can be false when damage is instigated by code, the environment, etc.
        Instigator<native><public>:?game_action_instigator = external {}

        # Player, weapon, vehicle, etc. that damaged `Target`. Can be false when damage is caused by code, the environment, etc.
        Source<native><public>:?game_action_causer = external {}

But there doesn’t seem to be any way to extract anything from the Instigator or Source even when trying to typecast it to agent or player, it just fails. How can we tell what did the damage?

At least the amount works… but the rest needs to work too!

1 Like

Did you try casting to fort_character ?

1 Like

yes, there seems to be nothing in those objects as far as I can tell

Tried casting to player, agent and fort_character (as you posted in your response on the other thread)

Did this to get an instigator of damage against a creature and it worked for a player. Not sure how I would go about doing it for the storm (especially because it will award elims to players that last damaged someone died in the storm etc).

    OnDamaged(Result:damage_result): void =
        MaybeInstigator := Result.Instigator
        if (Instigator := MaybeInstigator?):
            if (InstagatingAgent := Instigator.GetInstigatorAgent[]):
                ItemGranter.GrantItem(InstagatingAgent)
4 Likes

GetInstigatorAgent??? how do you find these things… ok, I’ll give that a go. Thank you for popping in to help

2 Likes

It seems to give a fort character no matter what. Storm damage, AI damage… everything seems to be a fort character in the instigator…

MaybeInstigator := d.Instigator
        if (Instigator := MaybeInstigator?):
            if (InstagatingAgent := Instigator.GetInstigatorAgent[]):
                Print("this is an actual player shooting us?")
                if(IFC:fort_character = InstagatingAgent.GetFortCharacter[]):
                    Print("found the character")
                    IFC.SetHealth(50.0)

This sets the health of the player getting hit, to 50 if in the storm

In Visual Studio, you can ctrl + click on any Verse device/property/method and it will open up the Verse digests API. This is where you can see a list of all Verse device API calls with comments. Also in the VS explorer panel you can see the other Unreal/Fortnite digest APIs.

Screenshot (247)

3 Likes

ahhh… right!