Thread: Puttering around with Automation
-
March 28th, 2022, 23:52 #21
- Join Date
- Apr 2010
- Location
- Australia
- Posts
- 905
Timezone: Australian EST (GMT +10).
Systems/Rulesets: GURPS 4th Edition.
Campaigns (Ultimate License Holder)
GURPS Traveller - The Empty Peace
GURPS Shadowrun - Power Plays
GURPS Banestorm - Dark Clouds Rising
-
March 29th, 2022, 00:29 #22
Sort of; I'm not sure where spells are done just yet, but ranged aren't triggered with the melee either, which makes perfect sense, since it's not melee
Now I'm just trying to figure out how to do both melee and ranged without them mucking one another up (you can't have two action handlers in the same file I think?).
I'm having masochistic fun; as long as I get little bits of success once in a while, I'll keep going.Anybody want a peanut!
-
March 29th, 2022, 02:58 #23
I have melee and ranged working (I think; seems to be). I like the idea of it doing it from the _melee and _ranged better than observing the chat, but I'm not completely sure I grasped bmos' suggestion -- I'm still basically adding script into those files and duplicating the code; so it'll only work well as long as the GURPS code isn't changed much? I'm not sure how to do it in another way that just uses the base scripts and call the critical -- the rMessage has to be 'given' to the critical and the only way it can do that is from inside, right? Anyway, the basics are below; ranged isn't different at all, and I think _ability will be the same (for Spells). (I think _ability rolls spells? it's in ability type data anyway so that's my guess )
Code:local onMelee_old function onInit() --ActionsManager.registerModHandler("melee", modRoll); ActionsManager.registerResultHandler("melee", onMelee_new); onMelee_old = ActionMelee.onMelee ActionMelee.onMelee = onMelee_new --ActionsManager.registerResultHandler("criticals", onRoll) -- OptionsManager.registerOption2("criticals", false, "option_header_client", "option_label_CombatAutomation", "option_entry_cycler", -- { labels = "HitCriticals|HitLocationOn|CriticalsOn|NoCombatTriggers", values = "HitCriticals|HitLocationOn|CriticalsOn|NoCombatTriggers", baselabel = "NoCombatTriggers", baseval = "NoCombatTriggers", default = "NoCombatTriggers" }) -- -- OptionsManager.registerOption2("criticals_Source", false, "option_header_client", "option_label_CombatAutomation_Source", "option_entry_cycler", -- { labels = "SubLocationsOn|SubLocationsOff", values = "SubLocationsOn|SubLocationsOff", baselabel = "SubLocationsOff", baseval = "SubLocationsOff", default = "SubLocationsOff" }) end function onClose() ActionMelee.onMelee = onMelee_old end function onMelee_new(rSource, rTarget, rRoll) --Debug.chat("onMelee_new") local rMessage = ActionsManager.createActionMessage(rSource, rRoll); local nTotal = ActionsManager2.total(rRoll); local bAddMod = false; if GameSystem.actions[rRoll.sType] then bAddMod = GameSystem.actions[rRoll.sType].bAddMod; end local node = DB.findNode(rRoll.sNode); local sWeapon = DB.getValue(node.getParent().getParent(), "name", ""); local sMode = DB.getValue(node, "name", ""); -- Send the chat message local bShowMsg = true; if not rSource then bShowMsg = false; end if bShowMsg then local sTargetDesc = DB.getValue(node, "name", ""); local nTarget = DB.getValue(node, "level", 0); rMessage.text = string.format("%s\n%s%s%s %s(%d):%s", (string.format("%s%s",(rTarget and string.format("%s || ",rTarget.sName) or ""), rMessage.text)), sWeapon, ((sWeapon and sWeapon ~= '' and sTargetDesc and sTargetDesc ~= '') and "\n" or ""), sTargetDesc, (rRoll.nMod ~= 0 and string.format("(%d%s%d)=", nTarget, (rRoll.nMod > 0 and "+" or ""), rRoll.nMod) or ""), nTarget + rRoll.nMod, --rollResult(nTotal, nTarget + rRoll.nMod) Criticals.rollResult(nTotal, nTarget + rRoll.nMod) ); rMessage.diemodifier = (bAddMod and rRoll.nMod or 0); -- added script for critical check if (TableRolls.criticalsTriggersOn(rMessage.text)) then --Debug.chat("criticals on on melee") local sAllTriggers = CombatOptions.OptionsManager.isOption("criticals","HitCriticals") local sCriticalsOn = CombatOptions.OptionsManager.isOption("criticals","CriticalsOn") local sLocationsOn = CombatOptions.OptionsManager.isOption("criticals","HitLocationOn") local hitLocation local bHeadBlow if sAllTriggers then sCriticalsOn = true sLocationsOn = true end rMsg = rMessage local sText = rMessage.text --Debug.chat(sText) if TableRolls.criticalCombatNeeded(sText) then -- process critical hit/fial roll Roll - --processRoll() Criticals.processRoll(rMsg) end end -- added script end Comm.deliverChatMessage(rMessage); end end
Anybody want a peanut!
-
March 29th, 2022, 03:57 #24
For tweaking now (that I have spells working too!) I need to work on it saying the persons name instead of the GM in the critical for who did it (I think that should be easy?).
Then maybe work on hit locations.... I still have to think about how to do that AND handle criticals with this methodology.
And to use a table table (sidebar) instead of a script table.Anybody want a peanut!
-
March 29th, 2022, 04:14 #25
Getting a weird error though; seem to have stepped on someones toes. campaign/scripts/campaign_rollable.lua 120 attempt to call field 'performRoll (nil value) when I try to drag down an attack to the quick bar (it shows the level, in her case 15, instead of [MELEE]). I had some other melee's loaded while I was testing, so it was something that I did I think, but I didn't touch that; guess I need to find out whats calls it.
edit: also perform skill roll, so I'm thinking ... @#$@#$Anybody want a peanut!
-
March 29th, 2022, 17:57 #26
Not figured out so far but I'm sure it has to do with the first bits in the onInit of the manager_action_(rolltype); I'm not getting something, or what I'm trying isn't going to work.
If I change it to this, it still gives me that problem (I pick up a number instead of a die roll -- double clicking gives that same message type)
Code:local onMelee_old function onInit() --ActionsManager.registerModHandler("melee", modRoll); ActionsManager.registerResultHandler("melee", onMelee); onMelee_old = ActionMelee.onMelee ActionMelee.onMelee = onMelee --ActionsManager.registerResultHandler("criticals", onRoll) -- OptionsManager.registerOption2("criticals", false, "option_header_client", "option_label_CombatAutomation", "option_entry_cycler", -- { labels = "HitCriticals|HitLocationOn|CriticalsOn|NoCombatTriggers", values = "HitCriticals|HitLocationOn|CriticalsOn|NoCombatTriggers", baselabel = "NoCombatTriggers", baseval = "NoCombatTriggers", default = "NoCombatTriggers" }) -- -- OptionsManager.registerOption2("criticals_Source", false, "option_header_client", "option_label_CombatAutomation_Source", "option_entry_cycler", -- { labels = "SubLocationsOn|SubLocationsOff", values = "SubLocationsOn|SubLocationsOff", baselabel = "SubLocationsOff", baseval = "SubLocationsOff", default = "SubLocationsOff" }) end function onClose() ActionMelee.onMelee = onMelee_old end --function onMelee (rSource, rTarget, rRoll) --onMelee_new(rSource, rTarget, rRoll) --end function onMelee(rSource, rTarget, rRoll)
ActionsManager.registerResultHandler("melee", onMelee);
whether onMelee is as is or onMelee_new is the problem; keeping the next two lines doesn't affect anything except not any call to onMelee (new or normal) in the file
back to fishing.
edit edit:
I think I need to merge/join or replace in the xml
edit x3: not sure how to accomplish this. So far as it stands, I can roll criticals OR allow rolls to be dropped off the sheet, but not both... I'm sure it's about replace
Code:<windowclass name="ActionMelee" merge="join" > <script merge = "delete" /> <script file="scripts/manager_action_melee.lua" /> </windowclass>
Last edited by Fezzik Buttercup; March 29th, 2022 at 20:41.
Anybody want a peanut!
-
March 30th, 2022, 02:12 #27
- Join Date
- May 2013
- Location
- East Coast USA.
- Posts
- 961
-
March 30th, 2022, 03:19 #28
When you're testing it are you spamming out the rolls? I've noticed that if you roll attacks to quickly that they interfer with the critical results; if you give the dice just enough time to stop moving before you roll again you're usually ok. Keep in mind that the ext that I put out is in a very very rough form (but it does seem to be working at least when I try it); I'm trying a different method now that (hopefully) won't require watching the chat as the one you're using does.
(see image -- top roll I rolled the next too fast and it screwed up the next roll... that +3 was a modifier I put in to make her skill over 16 to make crit hunting easier -- the last one worked properly)
Everything seems to be fine on your end otherwise I think from the pictures; do you have any other extensions on that I can look at if that didn't help?Last edited by Fezzik Buttercup; March 30th, 2022 at 03:24.
Anybody want a peanut!
-
March 30th, 2022, 03:59 #29
- Join Date
- May 2013
- Location
- East Coast USA.
- Posts
- 961
Hello. The issue stemmed from a conflicting extension (one that is not currently operational - the author is promising to look into it). It is, https://www.fantasygrounds.com/forum...Dice-(DM-only)
-
March 30th, 2022, 18:00 #30
The one your using right now Seycrus was actually inspired off Celestian's AudioOverseer. There are still a lot of functions in there that are not needed; as I said it was very rough -- if it works well for you and others though I'll see about trimming it down IF the more elegant version that is supposed to replace (modify) the GURPS melee, ability, and ranged action managers (currently they work, but only if you put the melee/ranged/ability(spell) in the quickbar and THEN restart FGU (if you try to use the values off the character sheet it doesn't like it... which is kinda useless and bad ).
Anybody want a peanut!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks