(Solved) How to find an object instance position using ID?

I have multiple instances of the same object and i want to change the position of player to the object instance with similar ID that player has.
I really don’t know how to do it?

If you give your instances variable called ID

And gave them different value

Then for example
Condition
Stone variable ID = 24

Action
Change text object text set to "X pos “+ToString(Stone.X())+”
Y pos "+ToString(Stone.Y())

Sorry for the late reply

How do I charge the player according to text??
i am getting x pos like this

Let’s agree on something here
Variable is just SOME value
Your nick and my nick are same variables as name of this forum category
How do i…?

They are just text variables it does NOT make any difference is it for nickname or forum category

Same way number vars are just SOME numbers
Your barnID is same exact as
EnemyHP variable
Just some number

So imagine you are checking if
Enemy variable HP = 100

Action change text ToString(Enemy.X())

Then imagine you have multiple enemies with HP variable equal to 100
Which enemy X position it should show?

You need some means to target specific Enemy

Well in your case Barn and BarnExit
I would assume
Barn ID variable = 10
BarnExit ID variable = 10

And now in action you are targeting specific object

Now that we have that establish
I look at your formula and it looks correct
JUST in case i will write here in text form
BUT from what i see yours should work perfectly fine
It looks like you have there extra "
But you don’t

"X pos "+ToString(BarnExit.X())+"
Y pos "+ToString(BarnExit.Y())

But that is pretty much what you have
I really am confused how your read part of expression literally

You were right about the extra “”
it shows the coordinates
But how do I change the position of the player according to the coordinates in the text?

You put some expression in text object
It shows you some coords

And now you wanna change player condition to that?

So allow me to repeat myself not just for you but for any1 who will read it

Variables are just some values
It is not specific thing unique to each other like you would have knife to cut bread and separate/special knife to cut cables or wood

NO variables are variables
Like folders are just folders

There are not special folders that can hold something and can’t hold something else
If folder can hold something ALL folders can hold it
Or to speak human language contain it

SOOOOO
If in your condition you check if
BarnID = BarnExitID or whatever
You are not checking variables themselvs you are checking SOME numbers

SO you have condition BarnID = BarnExitID
And action change text set to

"Pos.X "+ToString(Barn.X())+"
Pos.Y "ToString(Barn.Y())

Then all you need is event

Condition BarnID = BarnExitID
Action Change player position to Barn.X() Barn.Y()

Again variables are just numbers
If you use them in one place to identify some number
You can use it anywhere else to do the same

Like i can use your home address to check on what street you live or in what town

BUT i also can use it to send you a letter or to visit you
Because your home address is just some data some VARIABLES
Universal to many things

Okay i get it
And it is working
I really thought it would require a few more steps lol
Thank you so much for the help^^

1 Like

Just as heads up when it comes to values

Do you think when you tween opacity of object you have separate opacity of object and separate opacity for tween?

Or you can set opacity of object to 100 and tween opacity of object with tween to 0 and it means same exact opacity?

This is not a question
The moment you will realize value is value the easier your life be making games

1 Like