#aura teamwork
1 messages · Page 1 of 1 (latest)
Yep, that's smart.
function validateAura(parentAura, distance, parentToken, parentActor, childToken){
//check a bunch of conditionas if an aura can be shared
let radius = parentAura.getItemDictionaryFlag('radius');
const teamworkFeatName = parentAura.getItemDictionaryFlag('teamwork');
const childHasTeamwork = !teamworkFeatName || !!childToken.getActor()?.items.find(x => x.name === teamworkFeatName);
let inRange = (distance <= radius);
let shareIfInactive = this.getInactiveShareFlag(parentAura);
let correctDisposition = this.validateDisposition(parentToken, childToken, parentAura) ?? true;
return ((parentAura.system.active || shareIfInactive) && inRange && childHasTeamwork && this.validateLifeform(parentActor, parentAura) && correctDisposition);
}
I'm not a big fan of how I named childHasTeamwork because it's essentially this is not a teamwork feat OR it is a teamwork feat and the child has the feat. But basically add a dFlag on the buff that is named teamwork and the value is Name of the Feat that the child is supposed to have
So essentially it's just those two lines and then also adding in && childHasTeamwork in the return statement at the bottom
Well I will try that out and see how it works! Wish me luck! And thank you for your time.
Also not tested, but it looks like it should work 😅
So if I put this in, what is x? leave it 'x' or substitute the feat name?:
//check a bunch of conditionas if an aura can be shared
//JEW - add check for Teamwork here
//*********************************
const teamworkFeatName = parentAura.getItemDictionaryFlag('teamwork');
const childHasTeamwork = !teamworkFeatName || !!childToken.getActor()?.items.find(x => x.name === teamworkFeatName);
let radius = parentAura.getItemDictionaryFlag('radius');
let inRange = (distance <= radius);
let shareIfInactive = this.getInactiveShareFlag(parentAura);
let correctDisposition = this.validateDisposition(parentToken, childToken, parentAura) ?? true;
return ((parentAura.system.active || shareIfInactive) && inRange && this.validateLifeform(parentActor, parentAura) && correctDisposition && childHasTeamwork);
}```
unrelated - triple backticks at the top and bottom turns the whole thing into a code block
js_ function() {turns into;} const foo = () => a formatted code block; _
function() {turns into;}
const foo = () => a formatted code block;
This might make it more obvious what's going on
const found = actor.items(item => item.name === "Name I'm looking for")
the array's find function, takes a function as a parameter. So x is just the variable name for each item in the array that it's comparing against.
All of these are the same
// these are defining a lookup "function" that you pass an item to and it returns true/false if the name matches the hardcoded 'name to find' string -- both of these are the exact same
const lookup = (item) => item.name === 'name to find';
const lookup = x => x.name === 'name to find';
...
// these are also the same
// these are calling the method in parenthesis on each item in the array and then setting `found` to the first item in the array that matches the hardcoded 'name to find' string
const found = actor.items.find(item => item.name === 'name to find');
const found = actor.items.find(x => x.name === 'name to find');
const found = actor.items.find(lookup);
const found = actor.items.find(item => lookup(item));
const found = actor.items.find(x => lookup(x));
short answer - leave x as is
Slightly related - if you update the mod, your local changes will be overwritten with the latest code from the update
Yep, updating the original mod is up to the Aura Share crew, but it will have to be updated at some point. Backwards compatibility for game.pf1 will stop at PF1 0.83.0. Maybe I can find out where to ask for feature requests. This mod is really capable of lots of cool PF things. Think dragon fear auras and poison gas clouds, fiery areas and stuff. You could make it do continuous damage and stuff. It's a broad canvas!
My scope here is to automatically handle Teamwork feats.
could make it do continuous damage
you can sorta do it with mana's regen module since it covers Bleed
I think I added that module but I haven't used it yet.
The Thing about Aura Share is that it automatically does something (adds buff) when all tests have been met and stops something when the tests fail. Distance and disposition so for, but the possiblities are endless!
This does not appear to work.
Tried the original. When any actor with dflag radius > 0 gets close to any other actor the child actor gets the buff.
Added the function above - no potential child actor gets the buff, including one that has the Shield Wall feat.
I don't think combat is much of a priority for the next session or two - I am in RotRL, and they just finished Thistletop so they wil be in town doing local stuff (and crafting magic items!) until the Skinsaw Man makes his ghastly (sic) appearance.
So i have time to deep delve. I think.
I wonder if the Feat name has to be the PF feat name, like the Tag, i.e. Shield Wall becomes shieldWall?
I'll test it out later try and get it working
Nope, that wasn't it.
So I got this:
OK. I am very dirty and tired. I think it's shower time, but I might check back later. Thank you for your effort!
This gonna be so epic when it's done...
Rename the buff so it doesn't match the feat name, that could be a problem
So other than the above apparently not working for you - here's some other issues you're going to have.
- For teamwork feats, you need to have each team member have their own uniquely named buff and have it disabled, you need to add the flag for the "share when disabled", and then the change bonus type needs to be untyped. This is because (at least for Shield Wall) you don't benefit from your own feat, but from your ally's--lots of teamwork feats stack with more allies nearby--meaning you need a unique buff per ally.
..Actually I guess that's the only point, that should cover a lot of the "if ally is near, get a bonus" cases
I just tested - the above code I posted above is working. One caveat is that this only shares from the moving token to the child token, so it won't "share back" the buff from the child
In regards to @untold wagon not finding Fiona on Discord, a small search for Aura Share in the pf1e channel shows the release post. Cactuar is Fiona from what I can tell.
@median bison
Thanks! I reached out to @median bison but as it turned out Fiona had already DM'd me yesterday! That was fast... I didn't even see it until I got on this morning to ask about Aura Share stuff...
Still no joy.
I have David's change in the script, and have my buffs set up (for the two players with teamwork).
what am I doing wrong?
How big are your tokens? Tokens that take up more than one square don't work so well with how Aura distance is being measured
Just one square, although sometimes one or more might get Enlarged, per the Enalrge spell...
I'm not sure why it's not working for you, then. I took the exact code I had above and dropped it in the mod and I was able to share the "teamwork" buff.
The name in the dFlag has to exactly match the Feat Name that's on the actor you're trying to share with.
Actually it looks like Fiona pushed out a new release yesterday so you should update the mod and just go with the official teamwork implementation now