What is preventing my player from receiving damage via this verse code?

I’m having trouble killing my character at the end of a timer using the following verse code (which is a snippet meant to kill the player provided by epic in the Parkour verse tutorial, with print statements for debugging):

    HandleTimerExpired(MaybeAgent:?agent):void=
        Logger.Print("Timer Ended")
        
        if (Agent := MaybeAgent?):
            Agent
            # Eliminate the player
            if: 
                FortCharacter:fort_character = Agent.GetFortCharacter[]
            then:
                    FortCharacter.Damage(500.0)
                    Logger.Print("Die!")

When I check the log during test, “Timer Ended” and “Die!” both print, but the character receives no damage.

Based on all settings I can find, my character should not be invincible. I can fall to my death and be respawned, and all of my respawn functions work just fine.
When the timer ends in my game, it just… ends and disappears. no death, no failure, nothing (other that the print statements to the logger). It’s worth nothing that the player character is in a Baller Vehicle, and that the vehicle is also capable of being destroyed.

Any thoughts on what might be happening?

Thank you for your report! Can you please re-post using the “New Issue” option on the Issues and Bug Reporting forums? Posts with this feature are connected directly into our development team so we can quickly get to them!

For more information, such as how to get the reference ID, please check out the article here: https://create.fortnite.com/news/using-the-creative-and-uefn-bug-reporting-form

Hmm, I would have done it a bit different - here’s my version in case it helps.

I put a NOTE for each of my changes.

It looks ok as you have it, not sure my changes will help.

1 Like

Ah! I get you! I did not realize that “new” button was a drop-down. Will re-post. Thank you!

I tried, and unfortunately this did not work either. Same effect in game, and still writes to the log.

Thank you very much, though! :smile:

Try SetHealth(0.0) instead of Damage

That was a really great suggestion, unfortunately SetHealth is clamped between 1.0 and Max. SetHealth isn’t meant to be able to destroy, and so what happens is:

When the timer ran out, my UI started pulsing as though I was injured to near death, but I did not die. I turned back on the health bar on the HUD Device and ran the test again to be sure, and when the timer ended, my health was set to 1.

So while that didn’t work, it helped me confirm again that the FortCharacter.Damage() call should have. :-/

Thank you very much!

SO it turns out that this call works if I am not in a Baller Vehicle. I tested in and out of a baller using the same script in a fresh island, and being in the vehicle prevented me from being killed.

That doesn’t solve the problem, per se, but it does narrow down what is causing it. Unfortunately, being in that device is part of the game, so hopefully I can find a good way to get rid of the baller when the timer ends so that I can damage the character. Have already tried to Disable and Destroy the baller inside of HandleTimerExpired, but neither has worked. :man_shrugging:

Interesting find! The Respawn() mechanic will kick a player out of a vehicle instantly and then Damage() should work as expected!

1 Like

That was exactly my reasoning, but it didn’t work that way for me, at least not at first. Nothing happened to the baller when I called Respawn() as part of HandleTimerExpired, but I was able to bind Destroy() to the start of Hurry Mode, and that removes the baller allowing Damage() to be called on the player when the timer ends. Then I just re-enable to respawn the baller at player respawn. The timing doesn’t work yet to respawn the player into a new baller as part of the process, but at least I can now end them with the timer and I know it wasn’t the code.

I’m going to mark this “solved” and report that the Baller Spawner is being treated as Invincible even if marked otherwise as a new bug.

Thanks again for your help, @AxelCapek and @robc !

1 Like

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