Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
May your rolls be chill this holiday season!
Create a free account

How to call a character's attribute using that character's name from another character's attribute?

My ultimate goal here is to create a moderately sized list of weapons, each with attributes like damage, weight, etc, and then pull those statistics into the abilities and token macro of campaign characters. Any method to that end would be acceptable, but I figure I'm just going about my attempted method incorrectly. I created a folder full of characters called 'Weapons,' named one of those characters 'sword' and gave it some attributes. I then created a 'Revanent' character with the attribute equiped_weapon=sword. With a Revanent token selected, executed the following token macro as a test: @{selected|token_name} uses their @{selected|equiped_weapon} to deal @{@{selected|equiped_weapon}|damage} damages. The result:  Revanent uses their sword to deal sword damages. I was very much expecting to be able to use nested attribute calls, but am pretty sure it's either not possible or I'm doing it wrong. Anyone have any pointers for using a character's attribute value as the selector for an attribute, or for making the kind faux inventory system I'm going for?
1543640181
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Take a look here and see if this Stupid Trick is of any help. That being said, creating many, many characters in a campaign is Bad Practice, if you happen to be using a character sheet. That just puts a ton of non-essential overhead on the game. Perhaps a Weapon character with many separate weapon attributes?
1543653761

Edited 1543656146
Thanks Keith! I was curious about the burden on roll20 if there were to be, say, three-hundred characters. Is there a general bad practices thread / wiki page? I was able to get what I wanted from a token macro by using a single 'weapons' character with a long_prefix=@{weapons| attribute. The token macro itself employed the format of @{weapons|long_prefix}@{selected|equipped_weapon}_damage}. That poor weapons character will have quite the number of attributes.
1543727151
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Glad you were able to make it work. Here is a wiki page that may be of some help. This page also has some helpful guidelines. RawrWolfie said: Thanks Keith! I was curious about the burden on roll20 if there were to be, say, three-hundred characters. Is there a general bad practices thread / wiki page? I was able to get what I wanted from a token macro by using a single 'weapons' character with a long_prefix=@{weapons| attribute. The token macro itself employed the format of @{weapons|long_prefix}@{selected|equipped_weapon}_damage}. That poor weapons character will have quite the number of attributes.