CR to XP: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "Category:Cookbook This macro is a framework for calculating XP and is setup for D&D 5e. This specific implementation will search the current map for any token with in a '...")
 
m (Taustin moved page cR to XP to CR to XP without leaving a redirect)
 
(One intermediate revision by one other user not shown)
(No difference)

Latest revision as of 21:10, 25 April 2023


This macro is a framework for calculating XP and is setup for D&D 5e. This specific implementation will search the current map for any token with in a dead state and then lookup the CR from the properties table. For JMR monster tokens, this is a variable in the json-formatted __MECHANICS_META__ property.

Example output when this macro is run:

Listing the Dead 
Name: Drow XP: 700 
Name: Goblin 9 XP: 50 
Name: Grick 1 XP: 450 
Name: Goblin 12 XP: 50 
Name: Goblin 7 XP: 50 
Name: Goblin 11 XP: 50 
Name: Goblin 10 XP: 50 
Name: Goblin 17 XP: 50 
Name: Hobgoblin 4 XP: 100 
Name: Wolf XP: 50 
Name: Goblin 1 XP: 50 
Name: Goblin 2 XP: 50 
Name: Goblin 3 XP: 50 
Name: Goblin 4 XP: 50 
Name: Goblin 8 XP: 50 
Name: Goblin 13 XP: 50 
Map Total XP: 1900

Macro


[h: broadcast("<b>Listing the Dead</b> <br>", "gm")]
[h: cond = json.set("{}", "setStates", "['Dead']")]
[h: ids = getTokenNames("json", cond)]
[h: mapXP = 0]
[h, foreach(id,ids),CODE:{
	[h: CR = json.get(getProperty("__MECHANICS_META__", id),"CR")]
	[h, switch(CR),CODE:
	    case "0": {[XP = 10]};
	    case "1/8": {[XP = 25]};
	    case "1/4": {[XP = 50]};
	    case "1/2": {[XP = 100]};
	    case "1": {[XP = 200]};
	    case "2": {[XP = 450]};
	    case "3": {[XP = 700]};
	    case "4": {[XP = 1100]};
	    case "5": {[XP = 1800]};
	    case "6": {[XP = 2300]};
	    case "7": {[XP = 2900]};
	    case "8": {[XP = 3900]};
	    case "9": {[XP = 5000]};
	    case "10": {[XP = 5900]};
	    case "11": {[XP = 7200]};
	    case "12": {[XP = 8400]};
	    case "13": {[XP = 10000]};
	    case "14": {[XP = 11500]};
	    case "15": {[XP = 13000]};
	    case "16": {[XP = 15000]};
	    case "17": {[XP = 18000]};
	    case "18": {[XP = 20000]};
	    case "19": {[XP = 22000]};
	    case "20": {[XP = 25000]};
	    case "21": {[XP = 33000]};
	    case "22": {[XP = 41000]};
	    case "23": {[XP = 50000]};
	    case "24": {[XP = 62000]};
	    case "25": {[XP = 75000]};
	    case "26": {[XP = 90000]};
	    case "27": {[XP = 105000]};
	    case "28": {[XP = 120000]};
	    case "29": {[XP = 135000]};
	    case "30": {[XP = 155000]};]
	[mapXP = mapXP + XP]
	[h: broadcast("<b>Name:</b> " + id +" <b>XP: </b>" + XP + "<br>", "gm")]
}]
[h: broadcast("<b>Map Total XP: </b> " + mapXP + "<br>", "gm")]]