SilentRuin
June 19th, 2020, 21:21
I want to create a dice roll, of my own, that can drag/drop over a valid combat tracker entry or map token target - just like "attack" and "damage" do.
I have brute forced an ugly solution by actually overriding the "attack" results handler but I don't like it because it means I need to call the normal "attack" processing if I was not the one triggering it. Works but "bleh" - makes me feel queasy doing that.
I'd much prefer to have a simple elegant die roll of my own that can get the target from combat tracker or map from drag/drop. I tried what I thought should work, but it literally will die (cool pun) after the drop of my die over the combat tracker entry or map token. Oddly enough it will return the active target if I drop it over the chat window or dice tower. Here is what I'm doing...
function onInit()
GameSystem.actions["mystuff"] = { sTargeting = "each" };
ActionsManager.registerResultHandler("mystuff", onRoll);
end
I created a new button in the record_char.xml joining to charsheet_actions_contents and used onDoubleClick or onDragStart to trigger my die roll.
All I'm trying to do is get it to respect the drop over combat tracker entry or map token and return that target like "attack" and so many other things do.
But dragging my button die over these things acts EXACTLY like if I drag a die from the desktop over one of them. As if the drop thinks this new thing is not good enough to be processed by the "magic" in combat tracker and map. I've set the draginfo.setType("mystuff") before I call via onDragStart in a desperate attempt to see if it would magically start working but still nothing. A search of all the 5e/coreRPG code does not reveal to me the secret of why this is not happening as I think it should. So I turn to the experts here.
My question is - what am I missing? I thought having my GameSystem setup with an sTarget = "each" would be all that was required to get combat tracker and the map to respect my die roll and get my target for me.
I have brute forced an ugly solution by actually overriding the "attack" results handler but I don't like it because it means I need to call the normal "attack" processing if I was not the one triggering it. Works but "bleh" - makes me feel queasy doing that.
I'd much prefer to have a simple elegant die roll of my own that can get the target from combat tracker or map from drag/drop. I tried what I thought should work, but it literally will die (cool pun) after the drop of my die over the combat tracker entry or map token. Oddly enough it will return the active target if I drop it over the chat window or dice tower. Here is what I'm doing...
function onInit()
GameSystem.actions["mystuff"] = { sTargeting = "each" };
ActionsManager.registerResultHandler("mystuff", onRoll);
end
I created a new button in the record_char.xml joining to charsheet_actions_contents and used onDoubleClick or onDragStart to trigger my die roll.
All I'm trying to do is get it to respect the drop over combat tracker entry or map token and return that target like "attack" and so many other things do.
But dragging my button die over these things acts EXACTLY like if I drag a die from the desktop over one of them. As if the drop thinks this new thing is not good enough to be processed by the "magic" in combat tracker and map. I've set the draginfo.setType("mystuff") before I call via onDragStart in a desperate attempt to see if it would magically start working but still nothing. A search of all the 5e/coreRPG code does not reveal to me the secret of why this is not happening as I think it should. So I turn to the experts here.
My question is - what am I missing? I thought having my GameSystem setup with an sTarget = "each" would be all that was required to get combat tracker and the map to respect my die roll and get my target for me.