combine 2 macros

If you have searched the other User Creations subforums and an answer to your question has not been found, please post here!

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
raazorfiend
Kobold
Posts: 17
Joined: Thu Sep 19, 2013 12:40 pm

combine 2 macros

Post by raazorfiend »

Hey Im currently messing with some fantasy macros, I have a Enemy called Varls, and made a macro to attack players. (with help=)
Spoiler
[h:listOfSelectedTokens = getSelected()]
[h:switchToken(getSelected())]
[foreach(id, listOfSelectedTokens), code:{
<p>
[h:getName(id)]
Varl Attacking [r:token.name]
[h:damage = 3d10+44]
[attackroll = 1d20]
[h:hitMiss = if(attackroll >= 5,1,0)]
[if(hitMiss == 1), code:{
Feral varl Hit
[h:diff = max(0, damage - PD)] <!-- Passive Defence aka Armor -->
[h:HP = max(-10, HP - diff)]
[h:bar.Health = HP / MaxHP]
[r:token.name] takes [r:diff] damage.
};{
Varl Missed
}]
}]
[h: state.Dying = if(HP < 0 && HP > -10, 1, 0)]
[h: state.Dead = if(HP <= -10, 1, 0)]
[h: state.Wounded = if(HP < MaxHP/2 && !state.Dead, 1, 0)]
Now I also have one to check vs player dodge
Spoiler
[h:listOfSelectedTokens = getSelected()]
[h:switchToken(getSelected())]
[foreach(id, listOfSelectedTokens), code:{
<p>
[h:getName(id)]
Attacking [r:token.name]
[damage = 3d10+44]
[h:targetAC = getProperty("Dodge", id)]
[defroll = 1d20]
[h:hitMiss = if(defroll <= Dodge,1,0)]
[if(hitMiss == 1), code:{
Varl Hit
[h:diff = max(0, damage - PD)] <!-- Passive Defence aka Armor -->
[h:HP = max(-10, HP - diff)]
[h:bar.Health = HP / MaxHP]
[r:token.name] takes [r:diff] damage.
};{
You Dodged
}]
}]
[h: state.Dying = if(HP < 0 && HP > -10, 1, 0)]
[h: state.Dead = if(HP <= -10, 1, 0)]
[h: state.Wounded = if(HP < MaxHP/2 && !state.Dead, 1, 0)]
And I was wondering if they could be combined smartly, BUT players can only dodge once pr turn unless they pocess a talent called "dodge twise or trice" ...so how to make a macro that conts dodges(check vs a stat stat maybe?

Right now I simply run the dodge variant, so the first hit is automatic unless the player dodge, and the rest is tested vs Varl attack skill...

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: combine 2 macros

Post by aliasmask »

I would have 3 macros, Attack, Damage and Dodge. Attack would post a link to damage target and the AC they hit. Damage would apply damage to target, no dodge. And dodge would check for dodge, check the init round and set a flag for that init to prevent multiple dodges taking in account the number of dodges based on a property. ie dodges: 1 (2 or 3). If dodge fails, then it applies damage.

raazorfiend
Kobold
Posts: 17
Joined: Thu Sep 19, 2013 12:40 pm

Re: combine 2 macros

Post by raazorfiend »

thx Alias,

yea I reckoned there was no way to do it, but had to ask the more savvy then myself xD

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: combine 2 macros

Post by Full Bleed »

raazorfiend wrote:
Thu Jun 10, 2021 2:29 am
yea I reckoned there was no way to do it, but had to ask the more savvy then myself xD
There is certainly a way to do it. He's just saying you shouldn't and providing a better method. ;)
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

raazorfiend
Kobold
Posts: 17
Joined: Thu Sep 19, 2013 12:40 pm

Re: combine 2 macros

Post by raazorfiend »

True ;P

So another fantasy headache.
Needed funcion, a macro that counts a specific property in tokes - and sums them up.
The plan was to include it in the top of certain "prayer attack macros" where there is a modifyer based on number of "beacons"

Basically a Prayer called "smite" deals 2d8 damage + "number of Beacons nearby"
The beacons represent other clergy anointed in the Light, who therefore buffs the spell passively.

So Im trying to count all tokens beacon property (some tokens carry a relic that adds more then one beacon)
and the counter isnt working at all xD
Spoiler
[H: json = arg(0)]
[H: pcs = getPC("json")]
[H: npcs = getNPC("json")]
[H: selected = getSelected("json")]
[H, foreach(token,pc,npc), code: {
[H: switchToken(token)]
[H: Beacons = getProperty("Beacon")]
[H, if(getProperty("Beacon") =< 1), code: {
[H: json = "sum(%s)", Beacons]
[H: total = eval(strformat("sum(%s)"))]
[R: total]
};{
};{}]
Once I got the sum of all beacon properties they should be added to the damage.
For good meassure the attack macro is below
Spoiler
[h:listOfSelectedTokens = getSelected()]
[h:switchToken(getSelected())]
[h:Beaconsum=8]
[foreach(id, listOfSelectedTokens), code:{
<p>
[h:getName(id)]
Ikibard attempts to smite [r:token.name]
[h:damage = 2d8+Beaconsum]
[h:castroll = 1d20]
[h:hitMiss = if(castroll >= 7,1,0)]
[if(hitMiss == 1), code:{
Smite cast
[h:diff = max(0, damage - PD)]
[h:HP = max(-10, HP - diff)]
[h:bar.Health = HP / MaxHP]
[r:token.name] takes [r:diff] damage.
};{
Ikibards faith falls short
}]
}]
[h: state.Dying = if(HP < 0 && HP > -10, 1, 0)]
[h: state.Dead = if(HP <= -10, 1, 0)]
[h: state.Wounded = if(HP < MaxHP/2 && !state.Dead, 1, 0)]

Post Reply

Return to “Requests for HELLLLP!”