Metallian 94's Forum Posts

  • Thank you both for help, blackhornets reply solved it! While fixing it as you told, I finally got the way how timers work. I had difficulties understanding them and avoided them but not anymore. Ill also keep in mind what you said about Trigger once and Wait, that was also new.

  • Hi, I faced two problems during the development of my big project. Basically both of them solve a problem of the other, but then add in their own flaws.

    I recently made changes to this event handling enemy deaths, because I tried to make a system, where every time I kill one enemy, 1 point is added to a special meter variable. This caused the first problem: on each enemy death, instead of adding just one, the special meter variable added an enormous amount of numbers, much more than it shoud have. I figured out that it was probably because the event was of the kind which has to be told to trigger once.

    I added this trigger once condition you see in my code and it solved the counting confusion. However it created a new issue.

    Now whenever, I faced a bigger amount of enemies (around 10), at some point they stopped being destroyed. I took a look at the debug and according to it, the enemies did take damage, but it had went under zero and added minus values, without destroying the enemies.

    As you can see in this pic, when I toggle disabled that "trigger once" it solves one problem and adds another and when I enable it, the same happens the other way.

    I dont know which way I should fix and stick into, but I hope youll be able to help me with either one.

  • It seems I fully solved the problem! Along with using On destroyed to make multikilling functional, I also found out that the extra number was a result of C2 being unable to catch up with my events, it was solved by adding a "wait 0.2" action.

    Thanks for all the help Plinkie!

  • Did you mean an "on enemy destroyed" boolean instance variable for enemies, that would be set true every time the enemy hp goes 0 and Id replace the 10th, 11th etc events conditions, with ones that say: if that boolean is set and without trigger once conditions with it?

    Because I tried that and without the trigger once conditions, the counting of WEC at one enemy kill starts to be repeated and gets messed up, but when I put the trigger onces back, it counts normally but again doesnt recognise idividuals, when killing multiple enemies at the same time.

  • Theres still something wrong with this. So once the other issues were fixed, I faced problems with getting WaveEnemyCounter to work. Originally I had set it to the number equal to the number of the enemies, subtract 1 whenever an enemy is killed, and once it would reach to zero Id change the wave (along with its variable, ArenaWaveCounter).

    First everything seemed to be right. As I killed enemies of wave 1, the number went down (there are only 2 enemies in the first wave but still), but once it reached zero, the debug showed that WEC had turned to -1. To fix at least the problem, I decided to turn the enemy counting logic upside down, meaning that instead of setting it to a higher value and subtracting from it till zero, I would set it to zero to begin with and add to it, making the wave transition to happen when WEC is something like 2. But turning the logic upside down, did so as well for the problem I had. Now for some reason when its time for wave shift WEC becomes 1 in debug.

    It means that at the beginning of any counting situation, C2 thinks I killed an enemy, before I actually did anything. I came up with one solution. Because C2 will add that extra number anyway, I kinda fooled it By setting WEC to -1, when its time to change the wave.

    It works for now, but I dont know will I be able to lean on it in the future and will it cause problems perhaps? I still want to understand where that extra number is coming from, if some of you know the answer.

    Another problem I faced, made me question is making a system like this even possible at the end. When I kill 2 enemies at the same time, C2 counts it as only one for WEC. Killing multiple enemies at the same time is very common in this game as its built around combat and being unable to count it right breaks the whole arena system. Can I overcome this somehow?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now I get it! It didnt even pop to my head that if the value is 0 to begin with, it affects the group instantly especially since I also didnt tell C2 to deactivate all the groups at the start. Thanks a lot!!!

    Now Ill still need to get WaveEnemyCounter to work, because killing enemies wont subtract from it for some reason. Looking for solutions will be easier now that two beasts have felled.

  • I setted the trigger once actions and it stopped the spawning madness. Thank you! One problem solved, two more to go.

    XD I was too nervous to notice that typo until now.

    I still dont know, why the spawning happens before I hit the switch. Isnt the default value supposed to be the one showing at the beginning of my event sheet (that is 0)?

    I did notice something strange anyway. The debug layout said, that ArenaWaveCounter was already 2(???) and it really was so. The guys of the second wave waited there patiently for my arrival at their line of sight. Also hitting the activator does actually spawn the first waves enemies, but its no use, while the second is already on.

  • Hi! Im working on a game for my studies and faced a problem, along the way. So...

    What Im trying to accomplish?

    A battle arena system, in which after you enter a certain zone, enemies will appear. Once youd defeat them, a second enemy wave would start. Then after that a third one etc. until all waves have been defeated

    What I tried to make it work?

    First of all, I made two global variables: Arena Wave Counter, which indicates the current wave number and Wave Enemy Counter, which indicates the number of the enemies of each wave. At the end of the corridor, that leads to the battlefield, theres an object, which when the player collides with, is supposed to launch the first wave. Around the zone, there are portals, of which each of them is supposed to spawn an enemy, one at a time, when the wave starts. To indicate when enemies of the current wave are defeated, for the next wave to start, I simply put a value at Wave Enemy Counter just before the wave group activates and that value is as much as I create or spawn enemies for that wave. The way, the value changes is that, whenever an enemys HP reaches zero, it subtracts one from the Wave Enemy Counter. Once it reaches zero, I set a value that represents the next wave, activate the group of that wave, set the number of the next waves enemies and deactivate the group of the wave I just finished. For details, I added these pics of my code.

    What went wrong?

    First of all the enemies are spawning before I touch the corridor fence, secondly for some reason, hundreads of enemies are spawning instead of the few, I told the system to be created. I dont understand at all with what logic these atrocities happened.

    So Id be really grateful for help for fixing this code, or for creating the arena system, with perhaps a completely different way.