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

[How to] !ammo for weapons in fieldset/repeatable field (at least somehow)

1431639132

Edited 1431639480
Rough translation: Line1: GM (the player), Line2: fluff text, Line 3: rolls, Line 4-5, game relevant stats, Line 6: On the right in bold the current ammunation value and the maximum amount the clip can hold, Line 7: Flufftext saying how many bullets were fired, Line 8: information how much the player manually has to change its ammunation if he changes to another ranged weapon which shall use this macros. Because i got so much help from this forum I am trying to share what I encounter during building my shadowrun 5 charactersheet. This is one way to use !ammo inside of a charactersheet roll. I admit I am lazy and did not translate it but actually everything that is important is the counter of Munition (=ammuniton) from 5/28 down to 4/28. The notification at the bottom does explain how much the ammunation count have to be updated manually. This is definetly not the best way to do it and it still requires manual interaction but I think it is better than nothing. This is less of a tutorial than more a simply coarse guidance how it is achievable (I am investing already too much time into this character sheet ^^ - so I assume you have all the knowledge on how to add a script and build a charactersheet in general) Use a dummy counter variable for the current tracked weapon on a sheet <input type="hidden" name="attr_rangedweapon_munition_counter" value="0" /> Warning! The attribute is required to exist, so you will have to add it manually to the character sheet at the moment (I just have asked how to ensure this automtically in another thread) Store an attribute for your weapon which will track the current amount of your weapon. Your players will have to manually adjust this value. Im my case this is the entry below the label (aktuell) (=current) and the input field for it is attr_rangedweapon_munition_aktuell . <input type="text" name="attr_rangedweapon_munition_aktuell" value="0" /> I use overlayed roll buttons for all the input fields to generate a context sensitive action. A user can check the "Bearbeiten" (=edit) checkbox to disable the rollbuttons on hovering. So the next view is the view when you are hovering the line with "Ares Predator" (the name of the weapon). If i refer to the buttons I always refer to the buttons of the same field. All those buttons are part of the same entry of the fieldset - which is important - because this way you are able to access all the fieldset attributes - like the Store the current ammunation value inside of our dummy-counter and sent a message like "user has loaded/equipped weapon_xyz" <button type='roll' name='roll_rangedweapon_magazin' value='/me rüstet @{rangedweapon_name} aus !ammo @{character_id} rangedweapon_munition_counter -[[@{rangedweapon_munition_counter}]] !ammo @{character_id} rangedweapon_munition_counter +[[@{rangedweapon_munition_aktuell}]]'/> The trick here is to use @{character_id} therefore you are not required to select a token. Which is the first handy stuff. The second trick is also from aaron, it first sets the dummy counter to 0 and then sets it to the value of our current weapon. Resetting to zero fails with the default script if you got a negative counter value, so you simply will be required to hit the reload button as often as it is required to get into a positive value first. (This is because of a sanity check inside of the !ammo script) rangedweapon_munition_counter is our dummy counter while rangedweapon_munition_aktuell is the counter of the current ammunation value inside of our fieldset. Now you have copied the value of the fieldset to a value which you can access from every position of your character sheet. Now you want to fire it! I won't show the template styles as they are absolutely unimportant, what is interesting for you is the calculation for the values! {{munition_update=[[@{rangedweapon_munition_aktuell}-(@{rangedweapon_munition_counter}-?{Anzahl Kugeln?|1})]]}} This is how you calculate how much the user manually has to update the ammunation when he wants to use a different ammunation based weapon - because we only have one dummy-counter. If you output this inside of your roll-template you always can see how the ammunation has changed, you have a logged value of the initial ammunation and you can verify all changes! {{munition_aktuell=[[@{rangedweapon_munition_counter}-?{Anzahl Kugeln?|1}]]}} This is how you calculate the current ammunation count of the fired weapon, which is also very handy for a roll-template output. The Input "Anzahl Kugeln" simply asks for the amount of fired bullets. If you play a game where you always only fire one bullet/arrow simply replace it with 1. I know I have been lazy explaining the whole thing, but if someone needs help implementing this for his own sheet, I will try to help to figure out the missing stuff. Maybe someone even finds a way better solution and wants to share it - hopefully one which is able to write the current ammunation count back to the fieldset attribute :D
I vastly interested in this.
1431765265

Edited 1431765383
How may I help you? At the moment it is mostly having a temporary variable, copying the value with ammo to this temporary variable, operating with ammo on this temporary variable and manually writing the value back. In the latest version I am using a visible textfield for this temporaray counter such that people are always able to verify the macros behind all the butons. Aaron is currently working on a CharMod script which might let me improve this functionality a lot!
No actual questions yet; I haven't the time to dive head long into it. But I did want to show interest.
1431772027
Allen
Sheet Author
When we used to do this sort of thing in kLoOge Werks (RIP) we would have an ammo pool reference from a repeating variable to a variable in a fixed (non repeating) location which we would call the ammo pool, The dice roll would then apply an ammo damage equal to the ROF to the character making the roll. I have not yet tried this in Roll20 since I don't know whether that can be done without an api call here. (I try to avoid api calls since they are not yet on regular servers)
@Allen, this is essentially what i do. You can just not write back to the repeating variable at the moment. It does require the !ammo script. If CharMod from Aaron will do what i expect I will use it and i guess it will be possible to write back to a repeating variable as well!