PDA

View Full Version : Adding additional bonus to ability rolls



morgurth
August 14th, 2013, 13:32
I'm just checking to make sure I'm not looking in the wrong place. I want to add the character level to the ability roll bonus you already get from your stats. I have everything updating fine on the main character sheet, but the actual dice roll doesn't take that into account.

Is "char_totalwithability.lua" the right place to add this to the existing "abilities" and "level" (which is the GM modifier in the lower left corner, I think)?

I've attached a screenshot of how the dice rolls show up in the chat window.

Sorry if this has already been answered, but the search the forum function never comes back with any hits.

BTW, this is with the v3.0 test version of FG2.

4655

Thanks!

I also need to figure out why the character's "Race" value isn't saved. Probably because I moved it out of "record_char_main.xml" so I could get it placed where it is.

Moon Wizard
August 14th, 2013, 16:40
If you are borrowing from 3.5E, the ability rolls are calculated separate than sheet numbers. Check in manager_action_ability.lua.

In general, my advice is to use an editor that has good multi-file search capability (like Notepad++). Then, follow the chain of function calls (like ActionAbility.performRoll).

Regards,
JPG

morgurth
August 19th, 2013, 00:52
I reread a bunch of posts and was debating on whether to take the CoreRPG and add in stuff slowly, or something like 4E (which imports CoreRPG) and modify functions as I get to them.

I restarted my efforts with the CoreRPG and ported over things like the "template_char.xml" and "record_char_main.xml" from 4E. It was going good until I hit this problem with the "number_linked.lua".

Script Error: [string "common/scripts/number_linked.lua"]:52: createChild: Invalid argument 2

This occurs in the "template_char.xml" in the "<template name="number_charabilitycheck">" "onInit" function trying to reference two sources. They are "addSource(abilitybonusfield[1]);" and "addSource(levelbonusfield[1]);"

Most likely, I am missing something additional I need from the 4E ruleset, but haven't been able to narrow it down. Any ideas?

Thanks

4705

Moon Wizard
August 20th, 2013, 20:10
Unravelling the code, I see that the createChild function expects a second parameter to define the data type of the child node. However, the parameter check is ignored if the child already exists.

In this case, the database fields referenced by abilitybonusfield and levelbonusfield are already defined as separate data objects on the main character sheet page, so they would already exist before the onInit function is called.

The fix is to either:
* Change the addSource calls to add a second parameter of "number" in the number_charabilitybonus and number_charabilitycheck templates.
* Or make sure that those fields exist on the same page as the fields using those templates.

I think I will also update number_linked to assume "number" if not specified.

Regards,
JPG

Moon Wizard
August 20th, 2013, 20:11
Also, thanks for the detailed report that allowed me to figure this out quickly. ;)

JPG

morgurth
August 20th, 2013, 21:38
Thanks! I'll have to try that when I get home from work.

Update:

I changed the two lines as you suggested and it works and displays what I'm looking.


addSource(abilitybonusfield[1], "number");
addSource(levelbonusfield[1], "number");

morgurth
August 25th, 2013, 02:43
If you are borrowing from 3.5E, the ability rolls are calculated separate than sheet numbers. Check in manager_action_ability.lua.

In general, my advice is to use an editor that has good multi-file search capability (like Notepad++). Then, follow the chain of function calls (like ActionAbility.performRoll).

Regards,
JPG

I had to modify "manager_action_ability.lua" and "manager_actor2.lua". I had it working but it took me a bit to realize I was getting the "roll.nMod" "halflevel" added to my rolls. After commenting out that, it all works great.

Thanks for all the help.