How do I Pick some instances as Custom LOS

Get help using Construct 2

Post » Sat Jun 27, 2015 12:59 pm

No way to pick a custom obstacle from a families, it always pick the entire family.
The picking works if LOS is used with Solids but If change the to use Custom the picking stops working and picks all the instances

I modified the LOS scirra example to illustrate this:
https://db.tt/Udmrb9up

Only the objects on the right side shouls block LOS
Thanks
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076

Post » Sat Jun 27, 2015 4:49 pm

Hi,

You cannot specify witch object to be an obstacle for LIne Of Sight behavior (as well as Pathfinding behavior), but only object type or entire family. The "add obstacle" action applies to all instances, it's construct 2 built in.

So depending on what you want to achieve, you'll have to avoid this.

Maybe you can tell more about your project and we can find a solution.
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Sat Jun 27, 2015 7:02 pm

arrrgh! Thanks for clearing this @Nabu001. This is my prototype.
Image

I´v already a system using an invisible sprite created on top of the tiles at runtime (that's what turns the orange cones to gray, while the LOS plug turns opacity to 100%) I will try and extend it this way.

Each tile as different elevation and depending on the tile my astronaut stands it will block LOS if higher.
If using colliders this will also prevent the Astronaut to move smoothly in to a solid tile (theres is a jump while the code re-cycles)
I´m also planing to add other LOS blocking features (vegetation etc..) and on top of that have also some kind of LOfire. So using colliders for LOS is not an option.
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076

Post » Sat Jun 27, 2015 8:01 pm

You can have two object types with same graphics and variables / behaviors. One being set as an obstacle to the line of sight, the other not. So when a tile is or become higher than the player, destroy it and create the same but of the type that blocks line of sight. You can encapsulate everything in function to make it clear.

And maybe you'll be interested in ray casting (search in forums) for testing if player has direct line of sight to something. It can be customized (customised ?) to collide with what you want and thus have different kinds of obstacles.
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Sat Jun 27, 2015 8:24 pm

Yep, I´v made it work already. After you explained how the custom LOS works with instance types only i come with a workaround. I ll see if its flexible enouf down the road.
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076

Post » Tue Jun 30, 2015 7:53 am

i think instead of using LOS, you can use a cone-shaped sprite.
then if that sprite overlapping an object, trigger a boolean.
then, pick object with booelan == true
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
63
S
14
G
2
Posts: 291
Reputation: 6,641


Return to How do I....?

Who is online

Users browsing this forum: evillair, vankizzle and 7 guests