Does anyone know how I can identify these for a plugin? Are they BasePlayer, BaseNpc?
Identifying NPC/Murderer (Blaster/Zombie)?
Discussion in 'Rust Development' started by myles., Oct 27, 2017.
-
i would say Npc
Code:5696 - assets/prefabs/npc/murderer/gloweyes.item.prefab 5697 - assets/prefabs/npc/murderer/gloweyes.wearable.prefab 5698 - assets/prefabs/npc/murderer/murderer.population.asset 5699 - assets/prefabs/npc/murderer/murderer.prefab 5700 - assets/prefabs/npc/murderer/murderer_corpse.prefab 5701 - assets/prefabs/npc/murderer/sound/breathing.asset 5702 - assets/prefabs/npc/murderer/sound/breathing.prefab 5703 - assets/prefabs/npc/murderer/sound/death.asset 5704 - assets/prefabs/npc/murderer/sound/death.prefab
-
NPCMurderer
Base Type: NPCPlayerApex / NPCPlayer -
if (entity is NPCMurderer)
return;
Will this return truthy? -
NPCMurderer is in the assembly as a Class, i would just try it , u should see if the compiler accepts it or not :s
-
here is a snip from my plugin where I deal with npc:
else if (entity as BasePlayer != null)
{
if (entity is NPCMurderer) // Murderer (treated the same as zombies)
{
setHitScale(hitInfo, _Zombiemodifiers);
}
else if (entity is NPCPlayer) // Scientists, etc.
{
setHitScale(hitInfo, _NPCmodifiers);
}
else // Player
{
setHitScale(hitInfo, _Playermodifiers);
}
}
Bonus, zombies:
else if (entity as BaseNpc != null)
{
if (entity.ShortPrefabName == "zombie") // Zombie
{
setHitScale(hitInfo, _Zombiemodifiers);
}
else // Animal
{
setHitScale(hitInfo, _Animalmodifiers);
}
} -
Before checking if it is any other kind of NPC or if it is a player -
I would suggest this instead:
if ((entity as BasePlayer != null && entity is NPCMurderer) || entity is NPCPlayerApex)
As it is seems safer to establish they are a BasePlayer before check if they are an NPC.
return; will return null as you have not specified a return value.
return true;
that would return true;
(Wulf just told me about NPCPlayerApex so added it)Last edited by a moderator: Nov 29, 2017