How do I stop a turret from shooting a target w/o LOS?

Get help using Construct 2

Post » Sun Jul 06, 2014 4:00 am

My units shoot their targets once in range whether there is a solid object blocking LOS (line of sight) or not. Is the turret behavior not integrated with the solid behavior.

What I want is a unit that has LOS to shoot/look at the target (which I already achieved) and stop shooting/looking at the target when LOS is broken (need to implement).

Ive already tried implementing it by setting the turret behavior disabled at start and enabled only when LOS is achieved with target. The LOS behavior is set to "obstructions: solids" and Ive already double checked all of the sprites that I want to block the characters' visions are set to solid behavior. Ive also tried looking this up on the forums because I thought it might be a common issue for a lot of people doing a top down game but I cant find anything relevant.

Thanks for any help.
B
4
Posts: 10
Reputation: 220

Post » Sun Jul 06, 2014 4:36 am

Sample capx would make it a lot easier.. but if you have an event to check line of sight (inverted) and then disable turrent behaviour.. it should work I would've thought. I have a combination of LOS and turret behaviour and it works ok. What is your LOS cone of view?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Jul 06, 2014 4:50 am

Have you tried this?

turret.PNG


all I have is an object with bullet behavior, an object with turret and los, and a object that is a solid. Works fine for me.

(*Updated)
You do not have the required permissions to view the files attached to this post.
Founder of HeroicTek
HeroicTek.com
Owner of HeroicDomains
HeroicDomains.com
B
21
S
7
G
1
Posts: 157
Reputation: 2,020

Post » Sun Jul 06, 2014 6:35 pm

codah wrote:Sample capx would make it a lot easier.. but if you have an event to check line of sight (inverted) and then disable turrent behaviour.. it should work I would've thought. I have a combination of LOS and turret behaviour and it works ok. What is your LOS cone of view?


Lol, there I was thinking "man it would be so great if they had a simple way to invert a condition". Didnt even know about the invert option till now, thanks so much you just helped me clean a lot of unnecessary code! + rep again good sir! (let me know if there is some actual way to give + reputation that I dont know of other than the meaningless form of typing it).
B
4
Posts: 10
Reputation: 220

Post » Sun Jul 06, 2014 11:58 pm

All good.. there's no upvoting here :) Do read the manual though!
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi and 18 guests