Hi there,
great stuff! Even if it would be way better, if RW had this onboard itself, especially with topics as input ("give me a random magic item out of my magic trinkets category").
I tried to adapt what I've seen here into a simple script to generate the results of criticals hits and misses. Unfortunately having no JS experience lead to me failing
There's obviously something I missed as it's not working.
Here's what I produced, maybe one of you guys can spot the error:
Code:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>Critical Hits and Misses</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
crit = new makeArray(20);
crit[0] = "Double damage";
crit[1] = "Double damage";
crit[2] = "Double damage";
crit[3] = "Double damage";
crit[4] = "Double damage";
crit[5] = "Double damage";
crit[6] = "Double damage";
crit[7] = "Double damage";
crit[8] = "Double damage";
crit[9] = "Double damage";
crit[10] = "Double damage and foe drops weapons (5-30 feet away)";
crit[11] = "Double damage and foe is knocked down.";
crit[12] = "Double damage and foe's weapon or attacking appendage is broken/destroyed.";
crit[13] = "Double damage and foe is -1 to hit until healed";
crit[14] = "Double damage and loses one round of action (STUNNED, No DEX Modifier on AC).";
crit[15] = "Double damage and foe is -2 to hit until healed.";
crit[16] = "Double damage and loses two rounds of action (STUNNED, No DEX Modifier on AC).";
crit[17] = "Triple damage, foe loses their weapon arm (or attacking appendage).";
crit[18] = "Foe is dropped to 0 hp.* You may choose to coup de grāce or knock them unconscious.";
crit[19] = "Foe is decapitated.";
fail = new makeArray(20);
fail[0] = "You have killed yourself (0 HP, bleeding out).";
fail[1] = "Double damage and you knock yourself unconscious for 1d4 rounds";
fail[2] = "Maximum single damage to yourself and you break your weapon.";
fail[3] = "Maximum single damage to yourself and you are stunned for one round (STUNNED, No DEX Modifier on AC).";
fail[4] = "Maximum single damage to yourself and you are stunned for one round (STUNNED, No DEX Modifier on AC) and you are -1 to hit until healed.";
fail[5] = "You accidentally knock out your closest ally for 1d4 rounds.";
fail[6] = "You accidentally break the weapon of your nearest ally.";
fail[7] = "You accidentally strike your nearest ally for maximum single damage.";
fail[8] = "You accidentally knock the weapon out of the hand of your closest ally.";
fail[9] = "You accidentally knock down your closest ally down.";
fail[10] = "You fall down, break your weapon and sustain normal damage.";
fail[11] = "You fall down, lose your weapon (5-30 feet away) and sustain normal damage.";
fail[12] = "You break your weapon and sustain normal damage.";
fail[13] = "You fall down (No DEX Modifier on AC next round) and sustain normal damage.";
fail[14] = "You lose your weapon (5-30 feet away) and sustain normal damage.";
fail[15] = "You break your weapon.";
fail[16] = "You fall down (No DEX Modifier on AC next round).";
fail[17] = "You lose your weapon (5-30 feet away).";
fail[18] = "You sustain normal damage on yourself.";
fail[19] = "Your failed attack leaves you exposed, +2 to hit on you next round.";
function rnd() {
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.ceil(rnd()*number)-1;
};
function makeArray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = "";
return this;
} ;// End of function makeArray
function f_crit() { // crits
return crit_value[rand(20)];
};
function f_fail() { // fails
return fail_value[rand(20)];
};
</script>
<form>
<input type="button" name="Crits" value="Generate Crit" onClick="this.form.textField1.value = f_crit()" size="" />
<textarea name="textField1" cols="60" rows="1" wrap="soft"></textarea>
</form>
<form>
<input type="button" name="Fails" value="Generate Fail" onClick="this.form.textField1.value = f_fail()" size="" />
<textarea name="textField1" cols="60" rows="1 wrap="soft"></textarea>
</form>
</BODY>
</HTML>