How do you get "fort_character" from type "?agent"

Solved this by doing the following…

  • Created a new const “Agent” of type “agent”
  • Set “Agent” equal to “QAgent?”
  • Called “GetFortCharacter[]” on the new const “Agent”

Looks like the question mark at the end handles the “false” check

OnTriggered(QAgent: ?agent): void=
  if (QAgent <> false, Agent: agent = QAgent?):
  
      if (FortChar := Agent.GetFortCharacter[]) {
          Print("Killing player")
          FortChar.Damage(100.0)
      }
1 Like