on my current game i need to have a 3d objects size i have got the distance and akk of that info but i need the ratio for it to scale at.
Can you rephrase that? I don't understand what you are asking at all.
Well, AGS has built-in scaling for walkable areas (and regions too? I don't remember) so you can just say "scale my object to 20% at the top of the walkable area and 100% at the bottom", and then characters that walk on that area get scaled depending on how far up the area they are.
If this isn't what you need, and you simply mean how do you scale a 3D object to the right size depending on the distance away, the maths is very simple:
scaled size = object size / distance
where "distance" is how far back the object is along a line pointing into the screen at right angles to it.
Be careful you don't divide by zero, because this won't work. It's probably better to use a revised form of this equation instead:
scaled size = object size / (distance + 1)
where distance = 0 when the object is as close as it can be, at which point it will be drawn full size. If you don't want it full size at this point, you can multiply by a scale factor (experiment until you get the value that works best for you - the number must be greater than 0; less than 1 will make your object smaller; greater than 1 will make it bigger):
scaled size = scale factor * object size / (distance + 1)
I hope that helps.
Please, matt, use capital letters and punctuation.
Thanks for the tip of the scale factor but I know about the scripting side of it alreadybut the actual factor is what I am looking for.
There's no "actual factor", as soon as a 3D point has been transformed into the camera's coordinate system, getting its 2D equivalent is calculated exactly as paolo says: (2d_x; 2d_y) = (3d_x / 3d_z; 3d_y / 3d_z)
What doesn't work? Consider showing us a screen shot.