#PF2E Unowned Token Buff
1 messages ยท Page 1 of 1 (latest)
From initial script: #macro-polo message
@cyan nexus @zinc garden @errant owl @solid skiff
So just loop over targets.
Here you go
const tokenDocs=targets.map(i=>i.document)
for (let tokenDoc of tokenDocs){
const existing = tokenDoc.actor.itemTypes.effect.find((e) => e.data.flags.core?.sourceId === ITEM_UUID);
if(existing){
}else{
}
}
Just fill in the actual stuff
if(existing) warpgate.revert(tokenDoc, "STEVE!");
else warpgate.mutate(tokenDoc, {embedded: {Item: {[source.name]: source}}, {}, {name: "STEVE!", description: "Is that you, Steve?"});
also e.getFlag("core", sourceId) === ITEM_UUID
Looks right. Give it a description as well for more context
That's what is shown to the remote user
You could also replace the item types.find with a mutation stack query instead. Only a bit shorter but doesn't rely on the source uuid comparison
This is super helpful thanks! I'm gonna see if I can play around at some point today, but got a busy one. I'll let you know how I get on ๐
adding the final result here: