Oooh, sorry to say this, but none of the DSLRs except the original *istD series will support TTL mode. Whether TTL or P-TTL, both the camera and the flash must be capable of supporting the desired mode.
Until very recently, the newer flashes such as the AF360FGZ and AF540FGZ would support both P-TTL and TTL depending on what camera body you were using. In other words, the flashes were generally backwards compatible with older bodies. (The very recent Mark II versions no longer support the TTL mode.)
However, the bodies have always tended to be not quite so backwards compatible. Even those bodies (*istD series, MZ-6 film body, etc) that are technically capable of supporting both P-TTL and TTL modes will always favor P-TTL mode on a multi-mode flash like the AF540FGZ, unless you force the flash to go into a TTL-only mode, for example, by setting the aperture ring of an A-series lens to a manual aperture setting. Point is, they really didn't really intend for you to use TTL, once P-TTL was available. I guess they figured that flashes needed to be backwards compatible, but someone who just spent big bucks on a new body wouldn't mind having to pony up a few more bucks for a new flash system.
In summary, the old Pentax TTL flashes can only be used in manual mode on your K-5iis.
Since the AF500FTZ doesn't have manual power settings or an auto-thyristor mode, it will always fire at full power (and that model is a very powerful flash indeed). So you will need to manually calculate aperture based on guide number and distance to subject, and/or use filters.
Some other options are to sell the AF500FTZ and get a newer P-TTL flash, or a flash that supports variable power settings and/or an auto mode. You can pick up a new flash with variable power settings for quite cheap. And for a controlled studio environment, that will give you the most consistent results anyhow.
Another option is to find an older *istD series that will communicate with your AF500FTZ. That approach mostly appeals to those who regularly shoot with manual lenses, do macro, etc.