Hey y’all,
I am trying to write some verse code which ends the round via an end game device which requires an agent to do so. I’m getting only one error here, which is on the GetAgent bit, where it’s telling me “Unknown identifier GetAgent.” I find this odd and puzzling, because I stole those particular few lines of code from a function in another script that works perfectly fine and produces no errors. I’ve tried googling around, reading the documentation, and the Fortnite.digest.verse, but I can’t make heads nor tails of why it’s telling me this or how I can fix it. I’ve pasted the section of the specific part of code I’m concerned with below. This isn’t the full verse file, I have using { /Fortnite.com/Characters } at the top, so that isn’t the problem.
I’m getting a new error here, it underlines the ‘[0]’ with “This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context. The ‘decides’ effect indicates that the invocation calls a function that might fail, and so must occur in a failure context that will handle the failure. Some examples of failure contexts are the condition clause of an ‘if’, the left operand of ‘or’, or the clause of the ‘logic’ macro.”
Strike what I just said, I had removed some lines including the if: then: lines, I added them back in the correct spots and now the error is gone. Sorry for the confusion. I’m getting ready to test it now!
okay! we’re getting somewhere!! the function is working as expected, but the code that’s triggering it isn’t. This function gets called by my custom enemy behavior in the OnEnd() of that verse file. The Score variable is an int that starts at 0. I get the first kill, it prints the score of 1, but the audio device (DeathNoise) isn’t firing. I have it set up as @editable and I am sure the correct device is plugged into the drop-down in uefn. Additional kills are not adding to the score, which I can see as the print out still reads 1.
ScoreAKill<public>():void=
set Score = 1 + Score
set ScoreString = ToString(Score)
Print(ScoreString)
DeathNoise.Play()
if(Score = 100):
AudioDevice.Play()
EndSeqTimer.Start()
EndSeqTimer.SuccessEvent.Subscribe(EndSeq)