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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Script] PowerCards 3 (Thread 3)

November 23 (8 years ago)
Finally put all of the crit tables in the macro. Works nicely. The macro is hitting 96 lines and has a reasonable lag time of around 2.6 seconds.
I did notice that at level 10 the dice roll was 2d20 instead of 2d20+1d14. I couldn't figure out how to make the crit table roll 2d20+1d14 if warrior level >= 10.

--Attack|[[ [$Atk] 1d20cs>[[19 - {@{selected|Level},0}>5 - {@{selected|Level},0}>9]] + [[{@{selected|Level},0}>5]]d[[14 + 2 * {@{selected|Level},0}>6 + 4 * {@{selected|Level},0}>7]]cs0cf0 + [[{@{selected|Level},0}>10]]d14cs0cf0 + [$Deed] 1d[[{@{selected|Level} + {@{selected|Level},0}>7, 10 + 0d0>0}kl1 + ]]cs0cf0 + [[{@{selected|Level},0}>7 * (@{selected|Level} - 6)]] ]]


Fumbles

Silvyre said:
Please do! Then we can get started on fumbles!

As for fumbles, I've been trying to work it out myself but can't. My frustration is with the character sheet attribute for the fumble die based on armor type. The HTML for the character sheet lists these attributes for armor:
<input type="text" name="attr_ArmorName"/>
<input type="text" name="attr_ArmorBonus"/>
<input type="text" name="attr_ArmorCheck"/>
<input type="text" name="attr_ArmorSpeed"/>
<input type="text" name="attr_ArmorFumbleDie"/>
<input type="text" name="attr_ArmorSpecial"/>
Reference: https://github.com/Roll20/roll20-character-sheets/tree/master/DCC
None of those attributes return anything even when the values are filled in the character sheet:


I get:
No attribute was found for @{selected|ArmorName}
The reason ArmorName is important is that the fumble die is based on armor type. 

Fumble logic and table

Fumble roll = Armor Fumble Die + Reverse of luck modifier
  • Example if your luck mod is +3 and your armor name is Hide: 1d12 - 3
  • Example if your luck mod is -3 and your armor name is Half-plate: 1d16 +3

Armor Fumble Die Table:

Armor NameFumble Die
Unarmored1d4
Padded1d8
Leather1d8
Studded Leather1d8
Hide1d12
Scale mail1d12
Chainmail1d12
Banded mail1d16
Half-plate1d16
Full plate1d16


November 23 (8 years ago)

Grognard said:

I did notice that at level 10 the dice roll was 2d20 instead of 2d20+1d14.

Are you sure? This part in particular controls the addition of 1d14 at level 10:
[[{@{selected|Level},0}>10]]d14cs0cf0

Grognard said:

I couldn't figure out how to make the crit table roll 2d20+1d14 if warrior level >= 10.

At level 10, the corresponding Crit Die/Table is "2d20/V". Unless I'm misunderstanding something, shouldn't the crit table roll just be 2d20?
November 23 (8 years ago)

Edited November 23 (8 years ago)

Grognard said:

<input type="text" name="attr_ArmorName"/>
<input type="text" name="attr_ArmorBonus"/>
<input type="text" name="attr_ArmorCheck"/>
<input type="text" name="attr_ArmorSpeed"/>
<input type="text" name="attr_ArmorFumbleDie"/>
<input type="text" name="attr_ArmorSpecial"/>
Reference: https://github.com/Roll20/roll20-character-sheets/tree/master/DCC
None of those attributes return anything even when the values are filled in the character sheet:


I get:
No attribute was found for @{selected|ArmorName}

Those are Repeating Attributes, which are called differently than normal Attributes. For example, the call you want is @{selected|repeating_armor_$0_ArmorName}.

However, instead of bothering with armor names, wouldn't it be easiest to just use [[ [$Fumble] @{selected|repeating_armor_$0_FumbleDie} - @{selected|LCK} ]]?
November 23 (8 years ago)
At level 10, the corresponding Crit Die/Table is "2d20/V". Unless I'm misunderstanding something, shouldn't the crit table roll just be 2d20?
At level 10 the crit die roll is 2d20+1d14 on table V. I'll have to check my logs again. 

Those are Repeating Attributes, which are called differently than normal Attributes. For example, the call you want is @{selected|repeating_armor_$0_ArmorName}.
:mindblown:
Sweet, thanks. Yeah, this worked: @{selected|repeating_armor_$0_ArmorFumbleDie}
Now to figure out the Fumble dice roll logic. Thanks for your help. After this portion is done I think I should be good while I build all the tables and macros. 
November 23 (8 years ago)

Ryan T. said:

This section of the Roll20 Wiki documents how to call Attributes.


The Attribute in question (according to the sheet's Wiki page) is named strength-mod
Thank you very much, I ended up using the sheet wiki page which lead me to https://wiki.roll20.net/DnD4e_Character_Sheet , this has every hidden attribute which is making life so much easier for me.  thank you for your assistance, I just gotta learn how to add the condition icons and see if these rolls can automatically influence attribute bar data like hp.  I read it a bit on the home page but I'm going to tackle it and see what I can do. 
PowerCards does not include any methods of automation like that. It does not have any method by which it can adjust attributes of a token or character sheet.

November 23 (8 years ago)

Sines said:

Hi Drew C.,

You could try a modification I did to allow the use of autocalculated attributes of DnD 4e sheet.
The code of PowerCards should be changed as following:
1. Add a new function (to treat attributes with references to other attributes):
function getAttrRefValues(char_id, attribute) {
    var n_ref = 0;
    var attr = attribute;
    if (/.*@{.*/.test(attribute)) {
        n_ref = attribute.match(/@{/g).length;
    }
    if (n_ref > 0) { //there are references to attributes
        for  (var i = 0; i < n_ref; i++) { 
            attr = attr.replace(/@{(.*?)}/, function(e) {
                var attr_ref = e.replace(/@{/, '').replace(/}/, '');
                attr_ref = getAttrByName(char_id, attr_ref);
                return getAttrRefValues(char_id, attr_ref);
            });
        }
    }
    return attr;
};

2. On the function getTargetInfo, modify the default case of its "switch (charm)":
default:
    attr = getAttrByName(Character.id, charm);
    attr = getAttrRefValues(Character.id, attr);

Then, on the game, make sure your target charm is part of an inline roll. Your example "[[1d20+%%stealth_bonus%%]]" is already part of one, but I had to add 0d0 and brackets where some of my target charms are, like "[[ 0d0 + %%ac%% [AC] ]]".

Hope it helps.
I have added this to the PowerCards script. Thanks Sines!
November 23 (8 years ago)
November 23rd, 2016 ~ 5:00 pm eastern
  • Version: 3.2.22
  • Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c
  • Update: Added getAttrRefValues function written by Sines. This allows you to use autocalculated attributes on character sheets with target charms. Such as the armor class attribute on most D&D character sheets.
  • Note: This update is untested by me. I simply added the function as is into the script.
November 23 (8 years ago)

Edited November 23 (8 years ago)

Grognard said:

At level 10 the crit die roll is 2d20+1d14 on table V. I'll have to check my logs again.

Ah, I was just going off of the image you posted earlier. Well, you could add [[{@{selected|Level},0}>10]]d14cs0cf0 right before you add LCK, then.

Now to figure out the Fumble dice roll logic. Thanks for your help. After this portion is done I think I should be good while I build all the tables and macros.

Great! Good luck!
November 23 (8 years ago)
Also... new thread:

https://app.roll20.net/forum/post/4285059/script-powercards-3-thread-4/?pageforid=4285062