Page 1 of 2 12 Last
  1. #1

    Need some guidance - extension to change encounter window

    So I'm wanting to make up an extension that changes how the level modification box on encounters works (namely, changing the values it adds, potentially based on role), and am wondering what area of the ruleset this is handled in so I can try figure it out. Does anyone know where to start?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,171
    I don't think the 4E ruleset does any auto calculation of encounter XP or level based off the creatures in the encounter window. I can't see any code in the ruleset that does this, and using the ruleset itself doesn't do any auto-calc.

    So, are you saying you want to add in such functionality? In which case I recommend looking at the 5E or 3.5E rulesets - these have calculation buttons in the encounter window that perform various calculations on the encounter. For example, in 3.5E there are two buttons in campaign\record_encounter.xml (button_enc_refreshcr and button_enc_refreshxp) that trigger challenge rating and XP calculations for the encounter.
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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
    I am referring to the box (pictured here at the end of the line to the left of the ID) that you can put in a value, and it adjusts the creatures level when added to the combat tracker. By default it adds 10hp, +1 ATK, +1 DEF, and +0.5 DMG (rounding down) per level. It also reduces by the same values if negative value there.

    I'm wanting to make an extension that adjusts what those values are, and if possible, add a check that chooses the value based on the creatures type (skirmisher, controller, brute, lurker, artillery, soldier etc)
    https://puu.sh/Efqcx/e25fe305bc.jpg

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,171
    Ah, right - gotcha.

    Have a look at the 4E ruleset, scripts\manager_combat2.lua - addNPC function - the nLevelAdj variable comes from that field. This function is ran when the NPC is added to the combat tracker.
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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
    Alrighty, found what I need, just need to figure out how to make an extension now that changes it.
    Thanks Trenloe

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,171
    Quote Originally Posted by spite View Post
    Alrighty, found what I need, just need to figure out how to make an extension now that changes it.
    If you look at the top of the manager_combat2.lua script, you'll see that there is a command: CombatManager.setCustomAddNPC(addNPC);

    This is a way that FG uses in key areas allowing layered rulesets (and extensions) to easily add in single functions to override the lower level code (base ruleset -> layered ruleset -> extension).

    So, you can use this in your own extension to override the 4E addNPC script. Just copy out the addNPC code from the 4E ruleset into a script file in your extension, have an onInit function with CombatManager.setCustomAddNPC(addNPC); to override the 4E custom function with your own, and then customize addNPC as needed.

    Quote Originally Posted by spite View Post
    Thanks Trenloe
    No worries.
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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
    I think I broke it. Hahhaha

    This is an experience

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,171
    Quote Originally Posted by spite View Post
    I think I broke it. Hahhaha
    Well played!
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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
    I've edited the manager_combat2.lua to have the correct values etc, and have made the extension call upon it (I think) but it hasnt adjusted anything in the actual ruleset. Do you perhaps have a moment for me to pick your brains on discord?

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,171
    Quote Originally Posted by spite View Post
    I've edited the manager_combat2.lua to have the correct values etc, and have made the extension call upon it (I think) but it hasnt adjusted anything in the actual ruleset. Do you perhaps have a moment for me to pick your brains on discord?
    Sorry, I'm not really on Discord.

    You don't modify the 4E manager_ combat.lua file - you leave that as is.

    Extract the addNPC function from that file and put it in your own LUA file that you will have in your extension.

    Then, in that LUA file, add an onInit() function that overrides the base addNPC function: CombatManager.setCustomAddNPC(addNPC);

    Then load this script in your extension.xml file.

    See the LUA file in the attached ZIP file - I've done this for you. Add this file to your extension, and load it with a <script> command in your extension.xml file.

    Then make your custom changes to the addNPC function in this file. Don't touch any of the base 4E files.
    Attached Files Attached Files
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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!

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Log in

Log in