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

Scriptcards for Gunslinger Misfires

As always.. I've searched, but have been unsuccessful in finding any references to the subjects regarding the unique features of the GunSlinger sub-class.  If there are already discussions regarding this, please redirect me thustishly. Otherwise... I'm looking for references to learn from regarding this subject and how anyone has successfully applied ScriptCards to GunSlinger Misfires.  Ammo usage is fairly similar and I'm sure doable in the same manner as a quarrel for arrows... And... most other characteristics of the application of their specialized weapons, regarding attacks, would be same as with most any ranged weapon.  However, the "Misfire" (Jamming) function is unique to these weapons.  How could this be integrated into the die roll, rather than just a miss?  (as I type this I'm trying to think of other lines of code I've seen that might apply effectively)   Essentially, I'm trying to learn how to not write a 200 line script full of "if then go to" statements.. for lack of a better term when someone else has already done something similar with 10 lines of code. thanx Muchly! in advance for any advice.
1728957625
timmaugh
Pro
API Scripter
Can you state the rule, for those of us who don't know?
1728958094

Edited 1728958418
Dink
Pro
the "Misfire" rule states {from the DnD Beyond site}:   Misfire.  Whenever you make an attack roll with a firearm, and the dice roll is equal to or lower than the weapon’s Misfire score, the weapon misfires. The attack misses, and the weapon cannot be used again until you spend an action to try and repair it. To repair your firearm, you must make a successful Tinker’s Tools check (DC equal to 8 + misfire score). If your check fails, the weapon is broken and must be mended out of combat at a quarter of the cost of the firearm. Creatures who use a firearm without being proficient increase the weapon’s misfire score by 1. I'm hoping that's what You were asking.... Otherwise,... did I ask something in the wrong place?  or did i break a forum rule? ------  I actually think I could find code that will do the above,.. and much of the resulting efforts are done outside of this script tbh.. i think...  but I'm trying to apply this to another idea that would be:  Because this device is an intricate mechanical weapon, every time the weapon is fired, there is a 1% chance that it will jam.  There is a cumulative +1% each time a new cartridge is inserted.  This chance for experiencing a "jam" is reset to 1% after a long rest, assuming the user spends time cleaning the weapon during the rest. Intended for a different weapon application...  I know.. but it's part of an adventure into a 5e adaptation of Module S3.  Regarding a needler pistol...  we can't have them lasting forever now can we?
1728959008
timmaugh
Pro
API Scripter
No, no... no rule violation. It just wasn't clear what system you were referring to, and then DnD isn't a system I play, so there was a lot of information I needed! My forte is in metascripts, however, which can help ScriptCards if someone else can't get you a strict-ScriptCards-only solution in the meantime. 
no Worries.. I'm kinda hoping someone has dealt with something similar building scripts that I can work from.  btw - great videos!  though.. i did have trouble finding my snorkel once the information got too deep...
Its not necessarily a bad thing to have a lot of lines in your code. Just make sure you're using functions & subroutines to keep your code readable. Think of the name of subroutine as like a comment, telling you what is happening at that moment in the code. I would do something like this: --?[$AttackRoll] -le [$MisfireScore]|>SetWeaponMisfired;True --?[$AttackRoll] -gt [$MisfireScore]|>SetWeaponMisfired;False --C[&WeaponMisfired ]|True:>HandleMisfire|False:>CheckForHit --:SetWeaponMisfired|     --&WeaponMisfired|[%1%]     --<| --:HandleMisfire| --+|Oops you misfired! --<| --:CheckForHit|...
1729005528

Edited 1729005843
Dink
Pro
thanx Muchly! Michael O.!!  Will definitely give that a try!  kinda stuck on another part currently, and got sidetracked with another script for another S3 item and trying to figure out how to apply "SmartAOE" to make it easier.   ANYwayz...  Assuming what You suggested works,.. and I have NO reason at this point to believe otherwise...  How would I implement the other variable into this operation?  That variable being the cumulative risk increase as the player uses a "cartridge of needles" and inserts another cartridge or "clip" which increases the chance for a jam by 1%?  It's really not a lot,.. in fact is a fairly insignificant amount, but having that function in my back pocket would be useful in the future for more significant instances. Thanx in advance! ~~EDIT~~ ok.. now I'm seeing that I'm misunderstanding what You suggested,...  You're not setting the "misfire" to 1%... the "%"s are part of the code and the 1 is the potential result of the d20 roll...  so we're actually increasing by 5% if we add one....  so... if we assume that extended use of the weapon...  increases the "jamming" or "MisFire" chances by "5%" with each new clip,.. how could I add this... Basically,.. how do I increase the 1 that's bracketed by %'s?
1729096805

Edited 1729098388
Hmm... I'm not directly familiar with this gun jamming rule - but if you're trying to calculate a percent chance, the standard would be to use a D100. Personally I would rewrite the rule. Shouldn't require a change to the code, just an adjustment to variables and modifiers. AOE is kind of tricky, but easy if you understand arrays and loops. --/| This line creates an array of all of the tokenids on the map called "AllTokens", the last parameter is optional @selected|token_id excludes the selected token from the array. --~|array;pagetokens;AllTokens;@{selected|token_id}  --/| Then loop through each item in all tokens - access the current token id as a string value &CurrentToken: --%CurrentToken|foreach;AllTokens --+CurrentToken|[*[&CurrentToken]:character_name] -->GetTargetDistance|[&CurrentToken] --/|if the spell distance is greater than spell radius - skip this iteration of the loop --?[$TargetDistance] -gt [&SpellRadius]|% --/|ApplyDamage, roll saving throws etc|... --%| --/| Use the built in math functions to check if the token is in your AOE range: --:GetTargetDistance| --~TargetDistance|distance;@{target|token_id};[%1%] --<|