Quick Bug Fix?

Get help using Construct 2

Post » Thu Jun 29, 2017 10:29 pm

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
B
19
S
6
Posts: 143
Reputation: 1,835

Post » Thu Jun 29, 2017 11:50 pm

Use the line of sight behavior.
Maybe never use every tick, ever again.
And never ever use for each every tick.
Image ImageImage
B
172
S
50
G
183
Posts: 8,443
Reputation: 115,605

Post » Thu Jun 29, 2017 11:52 pm

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.
B
19
S
6
Posts: 143
Reputation: 1,835

Post » Fri Jun 30, 2017 12:08 am

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

Events run every tick, so the "every tick" condition is pretty much pointless.
Image ImageImage
B
172
S
50
G
183
Posts: 8,443
Reputation: 115,605

Post » Fri Jun 30, 2017 12:13 am

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
B
19
S
6
Posts: 143
Reputation: 1,835

Post » Fri Jun 30, 2017 9:07 pm

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
B
19
S
6
Posts: 143
Reputation: 1,835

Post » Fri Jun 30, 2017 10:01 pm

"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.
Image ImageImage
B
172
S
50
G
183
Posts: 8,443
Reputation: 115,605

Post » Fri Jun 30, 2017 10:40 pm

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
B
19
S
6
Posts: 143
Reputation: 1,835

Post » Fri Jun 30, 2017 11:24 pm

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.
Image ImageImage
B
172
S
50
G
183
Posts: 8,443
Reputation: 115,605

Post » Fri Jun 30, 2017 11:43 pm

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
B
19
S
6
Posts: 143
Reputation: 1,835

Next

Return to How do I....?

Who is online

Users browsing this forum: EuropaMin3r, maddy467, work3 and 6 guests