peterb
March 9th, 2023, 10:09
This is a "hack" that inserts a hit-location roll button on the main tab of the character sheet that I'd like to share. The solution is not perfect. Since the button is tied to the frame you will have to resize the character sheet if you add a lot of weapons. But it will save some time since there are fewer mouse clicks and the user needs to move the mouse pointer less.
Note. This feature doesn't, of course, make any sense if you don't use hit locations, only use it if you do. Also, when using the extension you have to click once on the button on the armor tab before the button on the main tab works, why that is I don't know.
Either use the provided extension (BRP Hit Location Button.ext) at the bottom of this post or use the method described below.
How-to
1) Preparations
1.1) Start by making a backup copy of the ruleset file (Basic Roleplaying.pak).
1.2) Then create a dev directory somewhere. Mine is called "dev" and it's in the root of the Fantasy Grounds folder.
1.3) Copy Basic Roleplaying.pak to the dev folder.
1.4) Change the name of Basic Roleplaying.pak to Basic Roleplaying.zip
1.5) Unzip the zip-file
2) Copy existing code
2.1) Open campaign/record_char_armor.xml in an editor (such as notepad++)
2.2) From record_char_armor.xml copy this code:
<genericcontrol name="hitlocationbutton">
<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
<icon>indicator_hitlocation</icon>
<script>
function onClickDown(...)
rollHitLocation(Input.isShiftPressed());
return true;
end
function rollHitLocation(flag)
local charnode = window.getDatabaseNode();
local name = charnode.getChild("name").getValue();
local listnode = charnode.getChild("hitlocations");
if listnode then
Global.RollHitLocation(name,listnode,flag);
end
end
</script>
<tooltip>
<text>Roll hit location</text>
</tooltip>
</genericcontrol>
3) Paste into record_char_main
3.1) Open campaign/record_char_main.xml
3.2) Insert in record_char_main.xml, under weaponFrame", like this:
<frame_char name="weaponframe">
<anchored>
<left parent="" anchor="left" offset="15" />
<top parent="statframe" anchor="bottom" />
<right parent="" anchor="right" offset="-25" />
<bottom anchor="bottom" />
</anchored>
</frame_char>
<genericcontrol name="hitlocationbutton">
<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
<icon>indicator_hitlocation</icon>
<script>
function onClickDown(...)
rollHitLocation(Input.isShiftPressed());
return true;
end
function rollHitLocation(flag)
local charnode = window.getDatabaseNode();
local name = charnode.getChild("name").getValue();
local listnode = charnode.getChild("hitlocations");
if listnode then
Global.RollHitLocation(name,listnode,flag);
end
end
</script>
<tooltip>
<text>Roll hit location</text>
</tooltip>
</genericcontrol>
3.3) Save
4) Save and re-package the ruleset.
4.1) Zip the contents of the ruleset folder. Do this when "inside" the folder.
4.2) Rename the zip-file to Basic Roleplaying.pak
5) Replace the existing pak
5.1) Move the Basic Roleplaying.pak to the ruleset folder
6) Reload the ruleset
6.1) Type "/reload" in the chat window
Note. This feature doesn't, of course, make any sense if you don't use hit locations, only use it if you do. Also, when using the extension you have to click once on the button on the armor tab before the button on the main tab works, why that is I don't know.
Either use the provided extension (BRP Hit Location Button.ext) at the bottom of this post or use the method described below.
How-to
1) Preparations
1.1) Start by making a backup copy of the ruleset file (Basic Roleplaying.pak).
1.2) Then create a dev directory somewhere. Mine is called "dev" and it's in the root of the Fantasy Grounds folder.
1.3) Copy Basic Roleplaying.pak to the dev folder.
1.4) Change the name of Basic Roleplaying.pak to Basic Roleplaying.zip
1.5) Unzip the zip-file
2) Copy existing code
2.1) Open campaign/record_char_armor.xml in an editor (such as notepad++)
2.2) From record_char_armor.xml copy this code:
<genericcontrol name="hitlocationbutton">
<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
<icon>indicator_hitlocation</icon>
<script>
function onClickDown(...)
rollHitLocation(Input.isShiftPressed());
return true;
end
function rollHitLocation(flag)
local charnode = window.getDatabaseNode();
local name = charnode.getChild("name").getValue();
local listnode = charnode.getChild("hitlocations");
if listnode then
Global.RollHitLocation(name,listnode,flag);
end
end
</script>
<tooltip>
<text>Roll hit location</text>
</tooltip>
</genericcontrol>
3) Paste into record_char_main
3.1) Open campaign/record_char_main.xml
3.2) Insert in record_char_main.xml, under weaponFrame", like this:
<frame_char name="weaponframe">
<anchored>
<left parent="" anchor="left" offset="15" />
<top parent="statframe" anchor="bottom" />
<right parent="" anchor="right" offset="-25" />
<bottom anchor="bottom" />
</anchored>
</frame_char>
<genericcontrol name="hitlocationbutton">
<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
<icon>indicator_hitlocation</icon>
<script>
function onClickDown(...)
rollHitLocation(Input.isShiftPressed());
return true;
end
function rollHitLocation(flag)
local charnode = window.getDatabaseNode();
local name = charnode.getChild("name").getValue();
local listnode = charnode.getChild("hitlocations");
if listnode then
Global.RollHitLocation(name,listnode,flag);
end
end
</script>
<tooltip>
<text>Roll hit location</text>
</tooltip>
</genericcontrol>
3.3) Save
4) Save and re-package the ruleset.
4.1) Zip the contents of the ruleset folder. Do this when "inside" the folder.
4.2) Rename the zip-file to Basic Roleplaying.pak
5) Replace the existing pak
5.1) Move the Basic Roleplaying.pak to the ruleset folder
6) Reload the ruleset
6.1) Type "/reload" in the chat window