I was thinking of something like this for the base:
Code: Select all
[H: zOrder = mod(getTokenX(0),100) + mod(getTokenY(0),100) * 100]
So, to expand the available values to account for size I'll have to make the base number bigger. Since I want tiny in front, it'll have to have the biggest number. So, a colossal creature at (0,0) will be behind a tiny creature at (0,0). So, I'm thinking of multiplying the base by 100, then use a size mod 10 to 70 (colossal = 10, tiny = 70) and use 0-9 for actual stacking of same size tokens. I could check that by when setting the zOrder it get back a different number which tells me that zOrder already exists. 71 to 99 can be used for elevation in 5ft increments, so 70 + max(0,min(29,floor(elevation/5)+sizeMod)) where sizeMod is 0 for medium, 1 for large, etc...
What do you think? Any other ideas?