Hey everyone. I've been trying to make a macro for encounter math and I'm having a hard time trying to get the job done. I have a way of doing it but it is extremely inelegant. I thought someone might be able to show me a Better Way (TM). Here is the math I'm trying to Figure out. The idea is that each hex on the map has a certain % of having an encounter. That % is determined by a combination of factors. The Patrol level of the nearby town, a base encounter level of the world and a modifier based on how close the hex is to dangerous threats. The basic formula if no threats are nearby should look roughly like this: 10*(5- (( 1+ Level of the Town - Hexes from Town), 0)k1) Example 1: Town Level 3, Adjacent to town (Hexes from town = 1) 10*(5-(1+3-1), 0)k1) = 10*(5-3)= 20. So a 20% Encounter Rate. Adding in the Level of Dungeons should mean I get something like this: 10*(5- ((1+Level of the Town - Hexes from Town), 0)k1 + ((1+Level of Dungeon - Hexes from Dungeon), 0)k1) Example 2: Town Level: 3, 2 Hexes from town, 1 Hex from a Level 2 Dungeon 10* (5 - ((1+3-2)+(1+2-1))) = 10*(5-(2)+(2))= 10*(5) = 50. So a 50% Encounter Rate. For numbers below 50% this works well. However once you get beyond 50% the encounter rate is supposed to drop off. For every 1 step above the base the threat should increase at half rate. This is the part where everything I try to make ultimately breaks down or I just don't know what to do to get the job done. From Example 2, ideally there would be a way for the macro to return a 50% encounter rate with the numbers given, but if the numbers changed slightly, it should start to scale by 5% instead of 10%. So if you change the example to being Town Level 3, 2 Hexes from Town, 1 Hex from a Level 3 Dungeon instead of returning 60% I need it to return 55%. I don't really know how to do this. Once that gets done I'd like a way for me to be able to macro in multiple threats on a given area. Example 3 Town Level: 3, 4 Hexes from Town, 2 Hexes from a Level 4 Dungeon, 1 Hex from a Level 1 Dungeon. 10*(5 -( (1+3-4) + (1+4-2) + (1+1-1) ) ) = 10 * (5 - (0) + (3) + (1) ) = 10 * (9) = 90% Encounter Rate. I don't know how to do the math properly, but if I can get the right formula instead of 90% that should return a total of 70% Encounter Rate (10*(5+(4/2))). I was thinking of having different macros based on how many dungeons are nearby, just to minimize the number of prompts during play. I'd also like for it to roll an encounter roll at the end. So the output would be something like this: Encounter Chance: 20 Encounter Roll: 85 (Just a simple 1d100) Or, if I could get it to work, If I could get it to return a 1 or a 0 depending on the result of the d100 and the encounter chance. If the formula would be something like [[(Encounter Chance Formula)-1d100]] Where if the number is below 0 it returns a 0, if it is above 0 it returns a 1. I don't know how to do that either, but I feel reasonably strongly that it is possible I just don't have the expertise to be able to get the job done while also maintaining my sanity. Any help would be greatly appreciated. Thanks in advance. PS. The closest thing that I've gotten to a working macro is as follows: **Encounter Chance**: [[50-10*({@{Town Level}+1-?{Hexes From Town|1},0}k1)+10*(?{Dungeon 1 Level|1}+1-?{Hexes From Dungeon 1|1}),0}k1)+10*(?{Dungeon 2 Level|1}+1-?{Hexes From Dungeon 2|1}),0}k1)+10*(?{Dungeon 3 Level|1}+1-?{Hexes From Dungeon 3|1}),0}k1)]] **Encounter Roll**: [[1d100]]