periodic / foundryvtt-summoner

A module to help with summoning tokens in the Foundry Virtual Tabletop
MIT License
4 stars 1 forks source link

Concentration Check #11

Open uLotUu opened 3 years ago

uLotUu commented 3 years ago

Is there any way to connect concentration to summoned token (or give yourself an effect that requires concetration and deleting the effect would delete the summoned token)?

periodic commented 3 years ago

Thanks for the question!

I don't think it's part of this app, but you can connect it to any other condition by making one of the effects of the condition be to invoke an item macro. Those macros get called when a condition is added or removed. They pass in an argument that is either "on" or "off". Depending on what you get you could summon or dismiss a token.

Does that make sense? So you'd end up probably needing ItemMacros and The Foundry, then there's some active-effect programming to do. I don't actually know how to connect the effect to concentration, but I'm sure someone has done that already.

uLotUu commented 3 years ago

Yeah I've figured that one out recently.

let lastArg = args[args.length - 1]; let target = canvas.tokens.get(lastArg.tokenId); let tactor = target?.actor; let DC = parseInt(args[1]) if(args[0] === "on"){ new Dialog({ title: "Which Shadow? ", buttons: { one: { label: "Fury", callback: () => { Summoner.placeAndSummon( actor, "Shadow Spirit (Fury)", {}, { setSpellBonuses: true } ); } }, two: { label: "Fear", callback: () => { Summoner.placeAndSummon( actor, "Shadow Spirit (Fear)", {}, { setSpellBonuses: true } ); } }, Three: { label: "Despair", callback: () => { Summoner.placeAndSummon( actor, "Shadow Spirit (Despair)", {}, { setSpellBonuses: true } ); } }, } }).render(true); } if(args[0] === "off"){ Summoner.dismiss("Shadow Spirit (Fear)"); Summoner.dismiss("Shadow Spirit (Fury)"); Summoner.dismiss("Shadow Spirit (Despair)"); }

It's an item macro that is connected to the effect. Midi Qol checks concentration checks on the actor to remove connected effects. So it works. However I can't get the "{ setSpellBonuses: true }" to work.