Scoring system problem

I am trying to create scoring system for eliminations.
I ran into problem while having to call my method “IncreasePlayerScore”.
The problem is “This function parameter expects a value of type tuple(agent,int), but this argument is an incompatible value of type tuple(?agent,int).”,
I guess I should cast ?agent to agent.
How can I do it?

Can you show us your code?

Here is the code

I’m pretty sure you can do this by storing the ?agent in an agent during an if-statement, since that’s a failure context.

Something like:

if ( MyAgent := Agent? ):
    IncreasePlayerScore(MyAgent, EliminationScore)

It basically fails if Agent is null, and skips the function call. If it succeeds, it calls it with a non-nullable variable type.

1 Like

Not working

I think what Xaert posted should work. What fails when you include his code?

Oh yeah it’s working :sweat_smile: