Skip to content

Instantly share code, notes, and snippets.

@teddy-dev
Created August 3, 2020 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teddy-dev/9906f0ed804bd61eca11d46bd43577fa to your computer and use it in GitHub Desktop.
Save teddy-dev/9906f0ed804bd61eca11d46bd43577fa to your computer and use it in GitHub Desktop.
FoundryVTT - Link all (represented actor only) scene tokens to actor by name
let tokens = canvas.tokens.children[0].children;
for (let i = 0; i < tokens.length; i++) {
let token = tokens[i];
let actor = game.actors.find(actor => actor.name === token.name);
if (actor) {
token.update({actorId: actor.id, actorLink: false});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment