PDA

View Full Version : Extension or Option to roll defense



Alucard339
December 15th, 2019, 18:30
Hi,

I am new to FG and in our pathfinder Iron Gods game we are using an optional rule were you roll 1d20+def bonus instead of using the fixed 10+defense bonus.
I was wondering if there was a way to easily recreate this with an existing extension or an option to unlock in FG.

in the end i would like to use this in both my pathfinder (iron gods) and 5e game (curse of strahd).

ty.

Kelrugem
December 15th, 2019, 18:41
Hi,

I am new to FG and in our pathfinder Iron Gods game we are using an optional rule were you roll 1d20+def bonus instead of using the fixed 10+defense bonus.
I was wondering if there was a way to easily recreate this with an existing extension or an option to unlock in FG.

in the end i would like to use this in both my pathfinder (iron gods) and 5e game (curse of strahd).

ty.

Welcome :)

There is not an extension I know of, it is possible to code something like this, I guess, but it would certainly need some/a major rewrite of the code, especially when one wants to include the defense roll with the physical dice system/code. Using a random table for the defense roll instead might be easy to code though because one only needs to replace the generic 10 with a random table going from 1 to 20 :) (but just guessing at the moment, it gets often more complicated than expected :D) Maybe someone can do this for you or already did :)

Trenloe
December 15th, 2019, 20:24
[Moved to the 3.5E/PF subforum]

Welcome to the FG forums Alucard339!

See this thread: https://www.fantasygrounds.com/forums/showthread.php?26006-Removing-the-Static-10-for-AC And post #33 for an extension. This will need updating to v3.3.9 code - don't run this for anything other than testing as the script it uses has been modified in the three years since that extension was made.

Alucard339
December 17th, 2019, 00:45
Ty for the answer, Ill look into it and see what i can do with it.
I do intend to try implementing our game style in FG, once i learn enough lua coding.

LordEntrails
December 17th, 2019, 01:05
You can also just do it manually until you get an extension to work. Just setup a 1d20+10 roll in a hotbar and manually calculate the hit/miss.

Kelrugem
December 17th, 2019, 03:27
Ty for the answer, Ill look into it and see what i can do with it.
I do intend to try implementing our game style in FG, once i learn enough lua coding.

Hi :)

I shortly took a look and the original author indeed took the easy way: he replaced the 10 with math.random(20) :) Thence, I shortly updated it to the actual FG version, but I didn't test it yet due to time issues :) (I took a very short glimpse over it, so, please tell me whether it works; the chat message for the attack is changed such that you can see the roll of the AC roll)

Just in case: When you use some of my extensions, especially anything with the advanced effects extension, then my extension will overwrite this here. When you want a combination of both, then please tell me :) I can shortly do that :)

PS: For some reason the bonusses coming from effects for AC and ATK were not been accounted into the rolls in this extension; so, I am not sure whether there was some other meaning of this extension or some oversight on my side. Maybe this was a bug back then or a design decision. Thus, please test the extension before you use it ingame :) In this extension the effects are now accounted into the automation :)

EDIT: When you want to update this on your own: Only manager_action_attack.lua got changed. I added comments in form of KEL and END, everything between is what you have to add to that file to make it work :)

EDIT2: Reuploaded it, for a little bit better chat message :)

Alucard339
December 17th, 2019, 16:56
I will look into it for sure and try it.
I didn't have access to internet yesterday, so I experience with lua and made it too as you can see in picture below.

30889

Thank you everyone for your help.

Kelrugem
December 17th, 2019, 17:01
I will look into it for sure and try it.
I didn't have access to internet yesterday, so I experience with lua and made it too as you can see in picture below. 30889

Thanks to all of you for your help.

Ah, cool :) Let us know when you need any help :)

The extension is for 3.5e and PF1. I am writing this because I see a roll with disadvantage in your image such that you seemingly write your extension for 5e? :) (I remember that you wanted it in both rulesets) The manager_action_attack.lua is different in both rulesets, so you need two extensions at the end :)

Alucard339
December 19th, 2019, 17:46
Ah, cool :)
The extension is for 3.5e and PF1. I am writing this because I see a roll with disadvantage in your image such that you seemingly write your extension for 5e? :) (I remember that you wanted it in both rulesets) The manager_action_attack.lua is different in both rulesets, so you need two extensions at the end :)

You are right the one I post was for 5e since my next Xmas game will be in 5e. End up working well with you making the PF1.

Alucard339
December 19th, 2019, 18:01
Quick question that I am not sure should be here or not, but if you can answer it or point me in the good direction it would be appreciated.

Still in 5e for now.

I start understanding how lua function. but so far i still need to find where to find the ActionsManager function and/or rRoll one (see below) as I want to add a special rule that on a natural 20, you reroll another d20 and add them (kind of like savage world exploding dices). My issue is that i want the d20 dice show the final result (ie: 1d20+3 where the program roll a 20 and a 7 would show either this = [27] + 3 30 or [20] + [7] + 3 30).

"rAction.nTotal = ActionsManager.total(rRoll);"

thank you fro your help.

Trenloe
December 19th, 2019, 18:05
I start understanding how lua function. but so far i still need to find where to find the ActionsManager function and/or rRoll one (see below) as I want to add a special rule that on a natural 20, you reroll another d20 and add them (kind of like savage world exploding dices).
Most rulesets like 5E, PFRPG, etc. are layered on top of CoreRPG - you'll also need to look in the CoreRPG ruleset for functions that are being used in 5E.

Alucard339
December 19th, 2019, 18:36
Never mind, I just figure out that most part in FG refer back to the CoreRPG.pak and that is where i found the roll function.
Now I just have to see how to properly update/modify those core lua files.

Trenloe
December 19th, 2019, 18:48
Now I just have to see how to properly update/modify those core lua files.
Most base global scripts have some level of custom functions that can be overridden. Some brief background info on one global script package here: https://www.fantasygrounds.com/forums/showthread.php?52736-Calling-the-original-function-in-an-overridden-function&p=467605&viewfull=1#post467605

Also, you can override specific functions within a global script package - this is shown in the next post in the thread just linked.