PDA

View Full Version : MD 5E Character Portrait Import Fix



MatrixDreamer
June 25th, 2020, 18:54
MD 5E Character Portrait Import Fix
(by MatrixDeamer)

Here is a simple extension to fix an issue with character portrait (token) failing to import with character data.
This is apparently only an issue with 5E (CoreRPG works fine).
Not sure if this issue has been submitted to FG, but it may be that they will eventually resolve it in their production version (but until then!).

Details:
This fixes a bug in the 5E ruleset character import where you receive an error on import failing to activate due to invalid parameter, and the portrait token does not import.
[ERROR] Script execution error: [string "campaign/scripts/charselect_import_entry.lu.."]:23: activate: Invalid parameter 1
Expected correct behavior is for the portrait token to import properly with no error, given that the appropriate token pack is installed locally.

Source of the issue.
This error is a cascading result due to the return of nil from the manager_campaigndata2.lua addPregenChar function used to import character files.
The 5E version of this function does not return the nodeTarget data node for the newly imported character (as is done in the CoreRPG function).
The calling function checks the return and sees there is no portrait and then tries to activate the portrait selection.
This call generates the emitted error seen in the console due to the nil value for nodeTarget.

The fix (pretty simple):
Override the manager_campaigndata2.lua
Add the missing return nodeTarget line (at line 269 in the overridden lua)

BEWARE:
This fix would conflict with other Extensions that override the manager_campaigndata2.lua file.
(but you could easily patch their copy with the same return nodeTarget line)