Alright, I have a bug with my NPC of type C which I am having trouble pin-pointing the cause and resolving. I'm starting to think I may have misunderstood how to create various NPC types (NPC_A, NPC_B and NPC_C) with the default one (NPC_Soldier). My idea was to use the default NPC_Soldier and rely on local variables to set the parameters of each type (HP, fire rate, speed, LOS, etc.). Everything seemed to be working fine until I added equipment to the NPC_C (gas mask and bag).
I made a video showing the bug (see the NPC_C on the far right when I'm killing the others).
https://youtu.be/AnVuDFjVhgA
The gas mask and the bag are in the NPC_Soldier container, so every instance of NPC_Soldier has it, but I set it to invisible if NPC_Soldier.type != to c. I wanted to avoid doing this at first because it creates many useless invisible objects. Unfortunately, I wasn’t able to get it working without adding the gas mask and bag to the NPC_Soldier container. I suspect this could be at the root of my issue.
If you're willing to have a look, lines of interest are [317, 318, 319] [457, 458, 45] [472, 473, 474, 475] and the NPC_Clean_Up_Dead function on line 649.
Here is my full .capx: http://dforms.ca/mgc/download/MGC-v157-bug.c3p
And you can play it here: http://dforms.ca/mgc/
Note, you can use the Dev Menu by pressing ESC (Dev Mode, God Mode and more). Turn your audio down!
It's my first game and I learned how to use Construct 3 while building it so it's obviously not perfect. I'm hoping to keep improving, but this issue is very discouraging. I've been able to fix most issues on my own. This one is kicking my ass.
Thank you in advance! If I manage to finish this game, I'll make sure to give credit to everyone who helped.
Any feedback is welcome!