How do I Assign a Object UID to "Path Path > Object.UID"

Get help using Construct 2

Post » Sat Nov 28, 2015 9:04 pm

How can I use a single object multiply times around map to send other objects on path find routes

This is what I usually assign to Path Find -> object.X , object.Y

I want to send them to
object.Y.(UID=2)
object.Y(UID=2)
B
5
S
1
Posts: 29
Reputation: 457

Post » Sat Nov 28, 2015 9:56 pm

You can pick the object by UID in the event..

object pick by uid - find path to object.x,object.y

that way you reference the right object in the event and only that object will be used for the coordinates..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 28, 2015 10:23 pm

Yes I know that one

So

Object(No Need For UID Here) - Find path to Object(Need UID here)
B
5
S
1
Posts: 29
Reputation: 457

Post » Sat Nov 28, 2015 10:33 pm

GaddMaster wrote:Yes I know that one

So

Object(No Need For UID Here) - Find path to Object(Need UID here)


The picking of the object is done in the event and conditions, not in the actions..

You can't reference another object of the same type in the action, but if you explain what it is exactly what you are trying to do, a solution can be found..

You could for example use local variables to put the x and y of the desired object's position in..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 28, 2015 10:49 pm

http://gaddmasterproductions.ie/wp-cont ... titled.png

As you can see i have find path to EnemyPath1.X , EnemyPath1.Y

I then have to go ahead and make loads of objects
EnemyPath2
EnemyPath3
etc
etc

If I could just have the find path to EnemyPathUID, then I could just have the one Object for paths
B
5
S
1
Posts: 29
Reputation: 457

Post » Sat Nov 28, 2015 11:07 pm

That should not be a big issue..

Instead of uid, in this case I would give the enemypath an instance variable "number" and the sprite an instance variable "destination"..

Then you could just set the sprites instance variable to the destination enemypath variable..

sprite on pathfinding arrived
>sprite add 1 to destination
(subevent)
system pick enemypath where enemypath.number = sprite.destination
> sprite find path to enemypath.x,enemypath.y

or you could set destination to choose(1,2,3) to pick a random enemypath to go to..
etcetera..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 28, 2015 11:43 pm

I have no idea what ya mean
I'll explain a little more. I have a ships spawning every 2 seconds. I have EnemyPath1, EnemyPath2, EnemyPath3.
I get a random bumber between 0-3.
If number>=0&&number<1 then AleinFighter(Sprite) find path to EnemyPath1
Same with other two paths..

So I have like 15 paths objects..One path instance has UID's, if i could use them with just one object that would be neater

I kind of understand what you are saying about, but I can only see this singular object all over the map been selected individually with the UID, as each instance creates a UID

I'm also using when Fighter Pilot collides with EnemyPath4 he will find path to another EnemyPath depending on a random number, this could be EnemyPath5 or EnemyPath7
B
5
S
1
Posts: 29
Reputation: 457

Post » Sat Nov 28, 2015 11:51 pm

You do know what instance variables are?
I believe using those would simplify what you are trying to do..

You probaly wouldn't even need enemypath1 enemypath2 and enemypath3, if they are izn a sense the same object, for 1 2 and 3 could also be defined by a seperate instance variable..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Nov 29, 2015 12:01 am

Yes I know what they are, you can add a instance variable to a object. So lets speak about only one Object, so we only have EnemyPath object. This object has 15 instances around the map. The only way possible of differentiating between them is their UID's??? Right? Where does this Variable come into play when given to this single object, which has 15 instances around the map. My other Fighter Object finds path to one instance, then when he hits it, does a bit of random number stuff, and then aims to find a path to another instance.

These cannot be random insatnces as a whole. Example
On Collisions with UID 1 -> will go to UID2 or UID3
On Collisions with UID4 -> will go to UID5 or UID6
On Collisions with UID7 -> will go to UID8 or UID9

Where we use the variables for this. I'm a noob
B
5
S
1
Posts: 29
Reputation: 457

Post » Sun Nov 29, 2015 12:15 am

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie and 22 guests