The additionalequipment
keyvalue (Weapons) can take on the string values “weapon_glock”, “weapon_mp5”, “weapon_shotgun”, “weapon_rpg”, and 0 which represents random. When loading a map for the first time, this seems to function correctly. However, all subsequent loads will not give a valid weapon.
Each load seems to attempt to spawn a random string as an entity, which to me looks like a use-after-free from the array indexed to give a random weapon. This causes the NPC to be spawned without a weapon.
I created a map to test this theory, which you can find here (vmf) and here (bsp).
Simply load this map after a fresh restart, and the grunt will spawn with a random weapon. Load it again (without a save load, change the map fully) and he will not have a weapon. The console will reveal messages like such:
Attempted to create unknown entity type ACT_VM_FIZZLE!
Couldn't create weapon ACT_VM_FIZZLE to give NPC .
Sometimes even producing unprintable characters appearing as question marks.
An entity like this appears in map bm_c2a4f
with hammerid 932430
named hall_grunt
.