Checking for scientist prefab and differentiating?Solved
I have a kill counter that works like this: 
if (entity.ShortPrefabName == "scientistnpc")
            {
                if ((bool)Config["Count Scientists"] == true)
                
                if (Cachedplayerstats.ContainsKey(killer.userID)) Cachedplayerstats[killer.userID].scientistkills++;
                
            }​

but it doesn't work for cargo scientists. I assume its becuase they aren't the same prefab as oil scientists. Can somebody help me fix this?

you can check scientists with classes:
if (entity is ScientistNPC || entity is Scientist || entity is HTNPlayer) { }​
5df88d179ce26.jpg AVOCoder
you can check scientists with classes:
if (entity is ScientistNPC || entity is Scientist || entity is HTNPlayer) { }​

which prefab is the cargo scientist tho?

because in the prefab list, there are loads of scientists
5ee8d1e1c84dc.png Kingfoo55

which prefab is the cargo scientist tho?

In your case, you need to calculate all killed scientists on all map by player.

My solution (check by class, but not by prefabname) will help you issue.

You can find scientist's prefab by class condition and print value in console
5df88d179ce26.jpg AVOCoder

In your case, you need to calculate all killed scientists on all map by player.

My solution (check by class, but not by prefabname) will help you issue.

You can find scientist's prefab by class condition and print value in console

what class is the cargo scientist tho?

5ee8d1e1c84dc.png Kingfoo55

what class is the cargo scientist tho?

Probably same as other's. You can just check by distance, or check parent of that player (should be cargo).

on cargoship:

class HTNPlayer, name 'scientist_astar_full_any' (1707.4, 6.5, -2073.3)
assets/prefabs/npc/scientist/htn/scientist_astar_full_any.prefab

class HTNPlayer, name 'scientist_turret_any' (1689.7, 18.5, -2037.3)
assets/prefabs/npc/scientist/htn/scientist_turret_any.prefab

class HTNPlayer, name 'scientist_turret_lr300' (1581.1, 27.6, -2052.7)
assets/prefabs/npc/scientist/htn/scientist_turret_lr300.prefab

on oilrig

class ScientistNPC, name 'scientistnpc' (2547.3, 18.0, -1574.8)
assets/rust.ai/agents/npcplayer/humannpc/scientist/scientistnpc.prefab

class ScientistNPC, name 'heavyscientist' (2547.7, 18.0, -1575.8)
assets/rust.ai/agents/npcplayer/humannpc/heavyscientist/heavyscientist.prefab​

Merged post

on cargoship will need additional to check parent, how said @Orange
5ba216a6d7f65.png Orange

Probably same as other's. You can just check by distance, or check parent of that player (should be cargo).

How do you check by parent?

Merged post

Fixed it. Thanks for the help guys. :)
Locked automatically