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 .
×
Create a free account

ammo mod within a scriptcard?

November 25 (1 year ago)

Hi everyone,

We're using the pathfinder 1st roll20 charactersheet. Everytime my ranger fires his bow the created attribute 'Pfeile' increases by one. After the fight the ranger uses the following lines to retrieve a random number of arrows and reset the attribute 'Pfeile' to 0.


!wammo -M6zpcse50RSjYM2ajML repeating_attacks_$0_atkammo [[d@{Dagan Donnerfaust|Pfeile}]] Pfeil(e)

!setattr --silent --charid -M6zpcse50RSjYM2ajML --Pfeile|0


I want to implement these two lines into a scriptcard. Implementing the 2nd line works fine. I don't know how to adress the repeating section (bold text above) in the first line.  Is it possible using the ammo mod? Or is there a way using tokenmod or chatsetattr?

Thanks in advance

November 25 (1 year ago)

Edited November 25 (1 year ago)

My first guess as to what is happening is that the roll [[ ]] in the !wammo command is interfering. You can test this by doing a roll variable just before with something like:

--=arrows|1d6
--@wammo|-M6zpcse50RSjYM2ajML repeating_attacks_$0_atkammo [$arrows] Pfeil(e)

That would probably be my first starting point to figure out what's going on there. Alternatively, ScriptCards can now do direct object modification which can often replace ChatSetAttr and TokenMod commands that take the place at the end of a ScriptCard with some direct ScriptCard modifications.

November 25 (1 year ago)

Edited November 25 (1 year ago)

Thanks for the hint. The script is working now.

!script{{
--=arrows|1d@{Dagan Donnerfaust|Pfeile}
--+Pfeile|[$arrows]
--@modattr|_charid -M6zpcse50RSjYM2ajML _repeating_attacks_$0_atkammo|[$arrows]
--@setattr|_charid -M6zpcse50RSjYM2ajML _Pfeile|0
}}