DICE PACKS BUNDLE
Page 1 of 4 123 ... Last
  1. #1

    Removing the Static 10 for AC

    Does anyone have or know where I can get rid of the static 10 on the AC for Pathfinder? I want it to be a D20 variable AC instead of static 10.
    When the GM smiles, it's too late!

    ULTIMATE LICENSE GM

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    The default of 10 is set in a number of template calculations in campaign\template_char.xml in the 3.5E ruleset:
    • number_chartotalac
    • number_charflatfootedac
    • number_chartouchac
    • number_charcmd

    Have a look at the onUpdate code within each of these templates. They all have code to set the value to 10 + the various modifiers: setValue(10 + ...
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Hello,

    I'm new to the forum, and started to use FG a few weeks ago. Actually this is may first post.
    I'm just browsing the forum for information what kind of possibilities available in FG. When I've found this thread and since we are using dynamic AC, I thought that this topic is about to change static (+10) AC to dynamic d20. Based on your guide I was able to remove the +10 modifier, the next step would be to replace it with a random d20. I'm not sure if it is possible, so please tell me if I shouldn't search for a solution, otherwise if this is possible please tell me how to proceed.

    Thank you in advance

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    Now that I know how people want this to work (random 1d20 to AC instead of the base 10 on each attack), it will be best to do the modification of AC in the FG attack action.

    Look at the 3.5E ruleset scripts\manager_action_attack.lua. In the onAttack function the target AC is stored in nDefenseVal. A simple way to modify this would be to subtract 10 and add 1d20:

    nDefenseVal = nDefenseVal - 10 + math.random(20);

    Do this after nDefenseVal has been returned from the ActorManager2.getDefenseValue function call.

    You won't see a d20 rolling to apply to the AC (this would be waaaaay too complicated in the asynchronous 3d dice rolling model), but it does add a random number between 1 and 20.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Excellent,

    Thank you for the quick answer, it seems to work.
    If I understood correctly it is difficult to make the visualization of the roll. Such as in case of the saving throws.
    What do you think is it possible to show somehow at least the result of the random d20?
    It would be nice to know what was the actual AC. eg if we fail to set the modification before the roll, we can "manually" make the damage, or restore the lost hp.

    Thank you in advance

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    rAction.aMessages is a table that contains text entries that are added into the attack notification message in the onAttack function. You could extract the math.random(20) calculation into a variable and then store that in into the messages table with a suitable text descriptor.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  7. #7
    Thanks,
    I did it partially, I created a local variable at the declaration part of the function (dynamicAC), and give it a value with the math.random(20) inmediately there.
    It seems OK, 'cos the function running well (I tested several rolls, in one case roll 14 miss, in the other roll 14 hit - so I think its OK)

    I make the AC calculation in the section starting with the "-- If we have a target, then calculate the defense we need to exceed" comment in the else part where not the "critconfirm" happen.
    I've just written "table.insert(rAction.aMessages, dynamicAC);" just before the original "table.insert(rAction.aMessages, string.format(sFormat, nAtkEffectsBonus));" line, but it is not visible in the text output.
    Perhaps this is not the way to add line in the table, or it is not the right place to make it happen.

    Could you please give me more specific info about this table.
    Actually I'm not so good in coding, just do it on hobby level.

    Thank you in advance

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    Quote Originally Posted by Felix Montmorency View Post
    I've just written "table.insert(rAction.aMessages, dynamicAC);" just before the original "table.insert(rAction.aMessages, string.format(sFormat, nAtkEffectsBonus));" line, but it is not visible in the text output.
    That is within a If statement that only gets executed if there are some effects active on the attack - I'm guessing there aren't in your testing.

    Put it immediately after the ActorManager2.getDefenseValue command for your initial testing.

    You can see if your code is getting executed by using Debug.console("String to send to console") commands within the code - open the console using /console and then you can see the results of these commands. Info on Debug.console here:https://www.fantasygrounds.com/refdoc/Debug.xcp#console Adding these in when you are adding your code will help to determine if your code is actually being executed.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,406
    Another place you could put it (which might be easier) is the rRoll.sDesc string. Make sure you concatenate your values, as this is slowly built up during the dice rolling process.

    e.g. rRoll.sDesc = rRoll.sDesc .. " [Dynamic AC:" .. dynamicAC .. "]";
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  10. #10
    Excellent, it is working properly, I used, the first solution, before I realized, you posted another one.
    Actually rRoll.sDesc solution is not clear for me. Just adding "rRoll.sDesc = rRoll.sDesc .. " [Dynamic AC:" .. dynamicAC .. "]";" instead of the table.insert exactly in the same place doesn't result any text out.
    Maybe it is just giving a value to rRoll.sDesc and overwritten somewhere else in the code. I wasn't able to locate where to text out rRoll.sDesc
    I'm just curious about this, maybe somewhere else it would be beneficial to know this method.
    I started to enjoy modifying the code, it opens a lot of potential.

    The other problem I wasn't able to use the Debug Console command I've inserted a line Debug.Console(dynamicAC); just before the table.insert line, and in runtime I open the console with /console, and it returns an error message: "Script Error: [string "scripts/manager_action_attack.lua"]:416: attempt to call field 'Console' (a nil value)"

    Thank you in advance

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in