Quick Bug Fix?

0 favourites
  • 11 posts
From the Asset Store
A challenging game that needs quick responses!
  • hi there i have a battle system where loads of minions charge at each other and fight but im having an error with the code i was wondering if anyone can help.

    Through some debugging ive worked out that the first archer spawned doesnt trigger the timer"DemonArcherFire" and any other archers timers constantly reset so the timer never reaches 0. BUT if its just one archer attacking the code works fine so im abit lost.

    also the engaged for archer means it wont pathfind anymore

    Please help me screenshot below

    http://imgur.com/a/MVbPH

  • Use the line of sight behavior.

    Maybe never use every tick, ever again.

    And never ever use for each every tick.

  • line of sight as in turret behavior. okay with each does it check every tick anyhow?

    and its funny you just replied as i was just checking your game out on another page

    but thanks alot man really appreciate the help will try implement it.

  • https://www.scirra.com/manual/163/line-of-sight

    Events run every tick, so the "every tick" condition is pretty much pointless.

  • thanks a bunch man this will make my life easier i tried to make a sprite for this same effect earlier which was a fail .

    Hugely appreciate all the help

  • hey there im still having problems its doing the same i did another test and had it working but then i added code to check if each demon has not got a line of sight then change action to searching - which starts the demons moving to next targets. then the archers "demonArcherFire" Timer keeps rebooting it makes no sense as i thought the code would check each minion individually instead if 1 isn't then they all do the same, image below of code

    http://imgur.com/a/vhB7m

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "For each" has no place in any of it.

    Its objectA has los to objectB, do stuff

    Or this variable = some value

    The triggers set together in the same condition as the for each are redundant, and actually slow down the system, as you are forcing them to be checked each tick, when the idea behind triggered conditions is to not have to check each tick.

  • i see, i've been getting that part wrong lol thanks for informing me, but getting rid of the other triggers and having the single one hasn't fixed it, all the demons timers are still resetting instead of each demon checking its line of sight

  • I don't know. You have a lot of for each's in there, and that random() value in the timer is not a good idea either.

  • i got rid of all the each's in there as you said they were unnecessary, i thought the random timer just gave each individual their own rate of fire but the timer is the problem as for some reason the line of sight doesn't work as when one of them are not in line of sight it changes the code for all the demon archers not just the one

  • i believe i worked out the issue, from the code i showed you it would never work because all of the objects its looking for isn't in line of sight meaning that it would always trigger, so simple fix was to set last known position on sprite and have line of sight on position meaning that it should never be out of sight

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