Bug when creating multiple enemy types

0 favourites
  • 4 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • 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!

    Tagged:

  • There's no real need to check this every tick and my guess is it's not running for each soldier so it just applies to the first one. I would set everything in position when the enemy is created and pin it then you just do it once. All of the actions from that every tick can probably be moved above to the enemy on created block and that's all you need. You would know it is picking the enemy correctly, the one created.

  • I am very grateful for your help Lionz. I'll try that tonight and report back.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It works. Was that really all it was... I probably have a bunch of other mistakes like this one. I'll have to review a lot. Don't know if you had a look, but let me know if anything else caught your eye. I've added you to my list of people to credit. Again big thanks Lionz!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)