How do i check to see if the Agent sent from an EliminatedEvent is False?

Hello, I’ve been stuck on this for hours now. I have a creature that spawns when entering an area and when you exit it despawns the problem is when it despawns it still triggers the elimination manager and drops the item. I only want the item to drop when eliminated by a player.

OnCreatureDespawn(Player: ?agent): void =

    if(Player?):
        Print("No camp reward")
    else:
        Print("Camp reward")

In your OnCreatureDespawn, I wouldn’t name that argument “Player” because we don’t know what it is that caused this. Just call it Agent : ?agent

Then, what I would try is casting the object to a player. If it succeeds, you know you have a player that caused the DeSpawn, otherwise it was something else.

ie

OnCreatureDespawn(Agent : ?agent) : void=
if (Player := player[Agent?]):
    # The agent was a player
    Print("No camp reward")
else:
    Print("Camp reward")

I didn’t test this, but should probably work with some fiddling.

1 Like

Thanks for the quick reply and suggestion ill give it a try

Thank you so much!!!

1 Like