How do I Reference Family Instances with Line of Sight

Get help using Construct 2

Post » Wed Apr 15, 2015 5:40 pm

I have 8 or so objects in the family "entity." Each of these objects has a "e_GPS" object which controls the facing animation of these objects in an isometric map. This e_GPS object also has the Line of Sight behavior because it is the only object for "entities" which actually changes it's angle.

Here is the problem. I want to say: If "e_GPS" has line of sight of "e_GPS" store ID of instance 0 and store the ID of instance 1 (as you might do with collisions referencing instances within a family).

The system is not referencing either of these objects with the "pick 'e_GPS' instance X".

So how can I pick object/family instances in a Line of Sight event, and have it so that the line of sight operation works even when trigger 50+ times simultaneously.
B
7
S
1
Posts: 15
Reputation: 482

Post » Sat Apr 18, 2015 7:12 am

I believe you can do something like:

events
Has line of sight to e_GPS
for each e_GPS
action
Do something with the info from the e_GPS's in your line of sight.
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Tue May 05, 2015 2:19 pm

I tried that. It would only reference its own e_GPS and would not retrigger the has_LoS condition
B
7
S
1
Posts: 15
Reputation: 482

Post » Tue May 05, 2015 2:35 pm

You need a second family with the same items (e_GPS2) so you can do "e_GPS has LOS of e_GPS2", for example.
ImageImageImage
B
71
S
21
G
203
Posts: 3,582
Reputation: 115,008

Post » Tue May 05, 2015 4:09 pm

As you loop through the objects with LOS, your own can be included, just keep that in mind and use actions accordingly.

ie
id = myid do nothing
id <> myid so something

But if your own object is solid, it could be interfering to what it can potentially see with LOS.
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Tue May 05, 2015 7:10 pm

You may be right about it blocking its own LoS because of solid behaviors. I do not think it was solid, but possibly another behavior (Pathfinding, 8 Direction, etc) caused it to block LoS.

As far as a second family goes. I could do this, but I have 10+ unit types and a ton of functions which reference that family universally. I would have to double my functions.
B
7
S
1
Posts: 15
Reputation: 482

Post » Wed May 06, 2015 12:47 am

You don't need to use the duplicate family for anything but picking the LOS. You can grab the UID of both objects and reference the single family after that, if that's what you need.
ImageImageImage
B
71
S
21
G
203
Posts: 3,582
Reputation: 115,008


Return to How do I....?

Who is online

Users browsing this forum: Darknessed, ismael123 and 10 guests