
I'm trying to make a custom character sheet for a game I'm hoping to run. I'm pretty new at this, and I'm hitting some snags in trying to automate some of the mechanics. 1) Attacks can hit a number of times up to the maximum hits value. Each attack has a chance to miss. Is there a way I can roll the number of hits, and then roll for how much damage the total hits did? I'm trying this as an ability roll right now, and I know it's not working: [[floor((1d20+80)/100*(@{p_atk}-@{target|p_def})*[[@{max_hits}d100>(@{aim}-@{target|eva}]])]] basically, rolling for damage is equal to 80%-100% times (attack - target's defense) times the number of hits, which I'm trying to come up with by rolling a d100 a number of times equal to max_hits, and comparing that to the miss chance. Using in-line rolls to make it less cluttered. 2) I'm trying to set a value based on if a weapon is equipped, or set it to 0 if it's not set. Trying to use a worker, tracking when the value could change. <label>Left Attack:</label><input type="number" name="attr_l_p_atk" readonly/><br />
<script type="text/worker">
on("sheet:opened change:str change:l_hand_p_atk change:l_hand_rank", function() {
getAttrs(["l_p_atk", "str", "l_hand_p_atk", "l_hand_rank"], function(value) {
if (parseInt(value.l_hand_p_atk) > 0)
setAttrs({l_p_atk:parseInt(value.str)+parseInt(value.l_hand_p_atk)*parseInt(value.l_hand_rank)})
else
setAttrs({l_p_atk:"0"})
});
});
</script>
basically just trying to calculate @{l_p_atk} if @{l_hand_p_atk}>0, otherwise setting it to 0. Side question, can you either ignore a roll result if it's value is under another value, or can you conditionally roll if @{l_hand_p_atk}>0? I'm getting close nailing down the hardest parts, but these have been stumping me.