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

0 favourites
  • 11 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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)

  • 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..

  • Yes I know that one

    So

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

  • 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..

  • 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

  • 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 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

  • 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..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • Dude sorry I didn't get back to you sooner. That night I was up all night getting a project finished for college for 9am the next morning. Long night of coffee and problems. LoL. I really appreciate the help. It was very helpful and swift reply. I might possible have another question or query about it,but Ill experiment with it first for a while before I bother you again. I have other exams now all week so busy as hell. I'll chat soon and thanks very much LittleStain

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)