[SOLVED] Enemy AI using private variables goes crazy.

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • First of all, excuse my english level, it is not my mother language.

    I want to say hello to everyone in this site, sharing this hobby(?) of us. And thanks to peole on Scirra, Construct is a very useful and easy to use tool.

    Let´s go to the problem:

    A .cap file is linked above, this is a platform game, the character smoothly works with all the movements and states that I´ve addressed to rivate variables, can dash hitting twice, holding attack button, or even combining attack button and direction keys. Also my enemy, a little coloured cat, runs all his events correctly, states addressed in private variables also, BUT when i got two instances of the same enemy, the IA becomes crazy, and the more enemies I spawn, they weird it gets. It is supose for every enemy to get the value for itself, but instead of that, they share it. BUT (again) they not share every PV, and thats even more weird, for examle, the enemy decide when to jump in order to the value that private variable "wantjump" gets a random value every 10 ticks, they jump separatly, but the same case for attacking variable DO NOt work, when there are more than 1 enemy, they all attack at the same time, but jump randomly....

    I have read the whole Construct Classic forum, I have experience in other programs that I own and I´m also a grown man, 33 years old, but about to cry with this issue.

    Thank in advance for your help, I hope I attached right the cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I forgot to mention the controls:

    MOVE: arrow keys

    ATTACK: D key

    JUMP: S key (in air ,press again for double jump)

    Ki blast: hold D

    Dragon punch: up + D

    Diving kick: in air, down+D

    Double punch: in gorund, down+D

    Dashing kick: hit twice forwards

    SPACE: spawn more enemies

    ENTER: destroy them

  • Oh1 I´ve realize a picking issue. if you have several instances and the code: "if player.X>enemy.x (enemy.angle=0)" and "if player.X<enemy.x (enemy.angle=180)" not all the instance turns to the player, but if I use "for each enemy", then it begins to work properly. it is has to be that way? it is suposed for every enemy to turn around without the "for each" action right?

  • I think this is a Construct BUG, no reasons for this not to work, it just messes up

  • Anyone check this? I´ve seen some downloads but no answer yet...I´m really mad about this, i think idoesnt work correctly

  • This is odd but the problem does not appear on my pc when previewing the cap. The enemies attack and jump at different times. Only changing the frame rate mode to unlimited causes them to attack and jump repeatedly.

  • they did not spawn the coloured cirlces at the same time? did you try that about changing angle for every enemy?

    i have them juming randomly too here on my c, but when its more than one you should look at them very closely to see how tehy beging to get buggy. From animations hapenning in the states they are not, movement bugs, they cannot go acrros de vertexY of the player and they do sometimes, they supose to be attacking but spawn nothing....

  • R0J0HOUND come at us, pleaseeee!

    Anyone at Scirra?

  • I upload another try, keeing things simplier just to see the failure. They do jump and seems to attack and spawn hitboxes randomly, but they are really messed up. Watching the debugger, they are attacking and the value for "action" its not "atttacking", what should be. The keep sharing behaviour in a way, just one cat do it perfecttly well, stop in mid air or wherever to attack for example, more than one cat never stop their vertical speed...

  • Uooo downloaded times are going up...i wonder if anyone fix it and take the game for him XD

  • Couldn't find "Outline Custom.fx" so I couldn't open it for a bit.

    Anyways I suspect the "trigger once" in event 37 possibly isn't doing what you're intending so maybe rework the events not to use it there. Also maybe try eliminating the elses. ELSE had some quirks at times when in a sub-event as i recall.

  • Thanks ROJOhound, as you say, it was a simple "wrong input". First time using construct, and i have old habbits from other programs.Get rid of the elses and put together everything better and now it´s working. I hope to finish this soon and upload for you to test!!! Has achievements to unlock and skins for the player, some of them very famous, like Ryu skin for example.

  • Baconizer - love the name btw - if you think it is a bug then best to report it via the correct procedures.

  • hundredfold Baconizer

    A few bug tickets with else already exist.

    http://sourceforge.net/p/construct/bugs/

    Keep in mind CC hasn't been worked on since r2 though.

  • I could achieve what I was looking for. I think is working pretty good

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