Hi all,
Long time lurker, first time caller.
So here's what I'd like to do in a nutshell:
I would like a macro that when invoked will:
1) When clicked, change token state to dead
2) Add the experience points that monster is worth (which is set as a property of the token) to a general pool
3) At the end of combat, another macro to input number of players/npcs who gain experience as well as enter treasure looted by type (cp, sp, ep, gp, pp, gem) which then calculates the division of exp per player/npcs.
I have a couple idea but haven't started scripting it out yet. I'm pretty sure I can over 1 & 3 without problems as it's simple math. 2 is an issue.
Unless there is some way to define a "global" variable, the easiest way seems to be having a Misc token that will track the pool of experience points.
Any other ideas on how to do this a bit better?
Death Macro
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Death Macro
about 2
1. create a token which name starts with 'lib:' e.g. lib:MyMacros
2. in MT campaign properties create a new propertytype: 'global' (or whatever you want to call it)
3. add the property xpPool to that type
4. set the propertytype of lib:myMacros to 'global'
now in your macro use Wiki: setLibProperty ()and Wiki: getLibProperty() to store and retrieve the xp pool of the party on the lib token.
1. create a token which name starts with 'lib:' e.g. lib:MyMacros
2. in MT campaign properties create a new propertytype: 'global' (or whatever you want to call it)
3. add the property xpPool to that type
4. set the propertytype of lib:myMacros to 'global'
now in your macro use Wiki: setLibProperty ()and Wiki: getLibProperty() to store and retrieve the xp pool of the party on the lib token.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Death Macro
1) Provided you already created the "Dead" state, Wiki: setState() is what you need and the example in the wiki is exactly what you want (but maybe you want to add an IF condition dependant on HP value).
2) Was covered by wolph42, but know that there are also ways to "skip" point 2 and integrate it directly into point 3. But depends if you want to give XP immediately after combat or if you want to give it all at the end of each session (in this latter case, keep the points separated).
3) The treasure part can be complex*, it heavily depends on what system you use and how do you want to set the things that your system might not have specified, leaving them to GM discretion.
For the XP, it's quite simple.
EDIT
*Complex not from a coding perspective, but from a math-and-stuff perspective, finding formulas on how to randomly but solidly divide coins, gems and items, and that kind of things.
I wrote a macro like that for Pathfinder (but with a good amount of personal tweaks) like one or two years ago. Then, I was looking at its code again just a few weeks ago, and I had no clue what part did what (well, I wasn't much in need or mood to try to grasp it back, so I didn't waste much time on it, but you get the idea).
2) Was covered by wolph42, but know that there are also ways to "skip" point 2 and integrate it directly into point 3. But depends if you want to give XP immediately after combat or if you want to give it all at the end of each session (in this latter case, keep the points separated).
3) The treasure part can be complex*, it heavily depends on what system you use and how do you want to set the things that your system might not have specified, leaving them to GM discretion.
For the XP, it's quite simple.
Code: Select all
[h: XP = getLibProperty("XP", "lib:XP")]
[h: abort(input(
"totalXP|" + XP + "|Total XP to deal",
"participants|1|Number of participants"
))]
<!-- In case you mistakenly input more than available from the pool. -->
[h: totalXP = min(totalXP, XP)]
[h: setLibProperty("XP", XP - totalXP, "lib:XP")]
[h: singleXP = floor(totalXP / participants)]
XP total: [r: totalXP]
<br>
Per person [r: singleXP]
*Complex not from a coding perspective, but from a math-and-stuff perspective, finding formulas on how to randomly but solidly divide coins, gems and items, and that kind of things.
I wrote a macro like that for Pathfinder (but with a good amount of personal tweaks) like one or two years ago. Then, I was looking at its code again just a few weeks ago, and I had no clue what part did what (well, I wasn't much in need or mood to try to grasp it back, so I didn't waste much time on it, but you get the idea).
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
-
- Kobold
- Posts: 2
- Joined: Thu Oct 16, 2014 3:25 pm
Re: Death Macro
Thanks for the help guys. It was exactly what I was looking for. I thought I would share my solution in case anyone else would like to use it.
I have a token property named "Experience(EXP)".
I've also added a state called "Slain"
I've placed a token named "lib:EXP_Cntr" on my map (or any map where I want to use this functionality).
It has 2 macros.
Label = Reset
Which just resets EXP = 0. Nothing special here.
And
Label = DivyEXP
I'm using the old style 2E D&D experience calculation method so it wasn't too hard to do as it turns out.
In each monster token I have the following macro:
Label = Slain
Nothing extra special about the macros but they work well for my needs. If you have improvements feel free to chip in.
I have a token property named "Experience(EXP)".
I've also added a state called "Slain"
I've placed a token named "lib:EXP_Cntr" on my map (or any map where I want to use this functionality).
It has 2 macros.
Label = Reset
Which just resets EXP = 0. Nothing special here.
And
Label = DivyEXP
Code: Select all
<b><u>*** Split EXP ***</u></b>
[input("CP", "SP", "EP", "GP", "PP", "Gems", "Jewels", "Other")]
<br>CP Conversion: [t: GP=GP + round(CP/100)]
<br>SP Conversion: [t: GP= GP + round(SP/10)]
<br>SP Conversion: [t: GP= GP + round(EP/2)]
<br>PP Conversion: [t: GP= GP + round(PP*5)]
<br>SP Conversion: [t: GP= GP + Gems]
<br>PP Conversion: [t: GP= GP + Jewels]
<br>PP Conversion: [t: GP= GP + Other]
<br>GP to XP Conversion: [t: Experience = GP+Experience)]
<br>Each player gets: [t: Experience / Party_Size] XP
In each monster token I have the following macro:
Label = Slain
Code: Select all
<b><u>*** This creature is SLAIN ***</b></u>
[h: setState("Slain", 1)]
[h: tot = getLibProperty("Experience", "lib:EXP_Cntr")]
<br>
[t: setLibProperty("Experience", tot+Experience, "Lib:EXP_Cntr")]
<br><b>[Experience] added to the pool</b>
<br><b>Total: [t: getLibProperty("Experience", "lib:EXP_Cntr")]</b>