Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro flag syntax? Examples? #128

Open
nirurin opened this issue Jan 21, 2023 · 1 comment
Open

Macro flag syntax? Examples? #128

nirurin opened this issue Jan 21, 2023 · 1 comment

Comments

@nirurin
Copy link

nirurin commented Jan 21, 2023

I have been looking to create a template via a macro, that has terrain flags in there, but nothing I've tried has worked, and I haven't seen any examples. Is this possible?

I thought it was worth putting here, in case I get an answer and it then becomes useful for other people.

const token = canvas.tokens.controlled[0]

const templateData = {
    borderColor: "#000000",
    distance: 20,
    fillColor: "#000000",
    user: game.user.id, 
    t: "circle",
    x: token.center.x,
    y: token.center.y,
    texture: "CustomDiscworld/Tokens/Empty%20(Token).png",
    flags: {      "enhanced-terrain-layer": {
        "multiple": 2,
        "elevation": null,
        "depth": null,
        "environment": ""
      },
    },
 } ;

let [template] = await canvas.scene.createEmbeddedDocuments("MeasuredTemplate", [templateData]);
await tokenAttacher.attachElementToToken(template, token, suppresNotification=false);

This was my best effort, but unfortunately the flags section doesn't work.

@dineshm72
Copy link

The issue seems to not be with the programmatic side, it's that the settings don't actually do anything even if properly placed.

If you open up the template details, there is a terrain tab there. You can add terrain costs to it manually, but this doesn't seem to do anything to actually add terrain penalties. (Or, equally possible, the ruler isn't working properly to detect them. I'm using the usual 5e drag ruler.)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants