Macro to Change Token/Character Art
Type: Macro
Short Description: A Macro that changes Token Art and Character Art
Long Description: I run Delta Green, and I want a macro to change both the token art and the character art to a secondary piece of token/character art (it will be a visual indicator that the character is insane). Executing the macro again will switch the token to the original art. I actually have the macro mostly done (it's only about 20 lines) - but I lack the knowledge to complete it.
Budget: Should be the easiest $30 you'll make today
33 Replies
can you post what you have so far?
Sure, this macro is specific to one person ("Zahra") - but I want a macro that returns the name of the current token and goes to that path, if that makes sense.
if (!token) return ui.notifications.error("No token is selected.")
let notTransformed = 'zahra/zahra1.png';
let transformed = 'Zahra/Zahra2.png';
let img = token.document.texture.src === notTransformed ? transformed : notTransformed;
new Sequence()
.sound("Zahra/evil2.ogg")
.effect()
.file("modules/jb2a_patreon/Library/2nd_Level/Divine_Smite/DivineSmite_01_Dark_Purple_Caster_400x400.webm")
.atLocation(token)
.scaleToObject(2)
.randomRotation()
.wait(1500)
.thenDo(() => {
token.document.update({ img });
})
.play()
I assumed the folder would be the same as the token name
Looks about right, but how would I change the character art as well?
I think that should be done by this part of the Sequencer chain:
Hmm, does it? Let me check how that works right now, 1 min
No, it doesn't, unfortunately.
You can see the art changed to the "horned" token, but the character art doesn't change.
oh you want the art on the character sheet to change as well?
Yes
ah my bad, one sec
should the character art be the same as the token art?
Umm, err. Good question. It can, sure.
let's see if this works
Give me a bit to put that in there and make sure the images are there, give me... 5 mins plz
as is, this will make the token art and the character art the same, but you can have different art for the character sheet if you would prefer, it would just require you to set up the image file paths
How do I post this as code, what command is that?
Okay, so first here is the folder structure and what's in it:
Here is the code, I changed the names to reflect .webp
The sound works, the jb2a animation fires... but the token changes to the mystery man token
And that's it. Clearly I screwed something up. 🙂
Tokens have
texture.src
, not img
.
Also your webp files above have a dot that the jpg images do notYup, saw that!!
Now it appears to be fixed, at least as far as going back and forth for the token
(Thanks @Zhell !)
@Craftzero gave :vote: LeaguePoints™ to @Zhell (#45 • 62)
@enso the token is now switching, thank you. But it's showing the token art, rather than the character art, what would I need to do to change that?
Point to the correct file?
Hmm, What in the code points to the correct character art file?
one sec
The actor art is the two on the left, right? And the tokens the two on the right?
Correct
Although I removed the extra period as per Enso's suggestion
Works Perfectly!
Can you message me your venmo, Enso?
Closing this, thanks @enso
@Craftzero gave :vote: LeaguePoints™ to @enso (#20 • 156)