PDA

View Full Version : ChatBat (Chat comBat Extension)



Vam
January 23rd, 2021, 21:01
This is my first attempt at an extension. I expect there will be bugs, but I hope you find it useful. PRs are welcome if you are a developer and want to help.

It allows users to do targeting from the chat window. I built it with CoreRPG so it should work with any ruleset, but I've only tested it with 5e.

The idea is to drag the commands from chat into hotkeys, and then be able to do auto targeting and clear targeting with hotkeys.

What follows is a copy and paste from the readme, which is easier to read on github: https://github.com/zymsys/vam-chatbat

From the chat window, type /cb (or /chatbat) to get quick help.

If you are the GM, ChatBat will work with the combatant who's turn it is. If you are a player, ChatBat will work with your PC(s) only.

Targeting
To auto-target type /cb t. If you are targeting from a 'friendly' or 'neutral' faction it will target the nearest 'hostile' combatant. If you are targeting from a 'hostile' combatant it will target the nearest 'friendly' combatant. Entering /cb t again will target the next nearest combatant, eventually cycling back to the nearest.

To override the target faction you can type /cb t {faction}. You can specify faction as f or friend for friendly, h, hostile or foe for hostile, or n or neutral` for neutral.

To target multiple combatants, add a count to the command. For example, if you wanted to cast Bless on three of your friends you could use /cb t f 3. If you are targeting enemies then you can leave out the faction and just give a count, such as /cb t 3.

To target by radius, use /cb t r {distance}. This will target creatures within the given radius regardless of faction.

To clear your targets use /cb c.

Targets can be memorized and restored. Use /cb m to memorize the current list of targets, and then /cb r to restore those targets. This is useful if you want to list more than one ChatBat command on the same line as explained below under Command Stacking.

Actions
Actions are currently available for the 5e ruleset. I plan to add additional rulesets in the future.

To get a list of available actions, type /cb a. You can then select an action with /cb a # where # is the number of the action. You can also give the name with /cb a {name} to avoid hotkeys changing when the actions on your character sheet change.

Tip: If you assign /cb a to Alt-0, and then the numbers /cb a 1 to /cb a 9 to Alt-1 to Alt-9 then you can very quickly see a list and select an action.

To roll damage after using ChatBat to roll an attack, use /cb d. Note that this only works for attacks invoked through ChatBat actions.

Command Stacking
This currently doesn't work well for players, which is where it would be most useful. I'm working on it.

You can stack commands by separating them with a comma. For example, to attack the nearest enemy with a dagger and then return targeting back to how it was when you started, you could use /cb m,t,a Dagger (M),r. What I'd really like to offer is including the damage command in there too, but I have some work to do before that works. I need to make damage conditional on a successful attack, and I need to make stacked commands wait for dice rolls.

damned
January 24th, 2021, 00:30
Very nice. Well done.
I was struggling with the utility of the concept reading the first couple of lines but the auto selecting targets is very neat. I like it.

Stv
January 24th, 2021, 08:49
Nice concept Vam, well done :)

Cheers, Steve

Vam
January 24th, 2021, 14:41
Thanks for the encouraging feedback. I found targeting is what slows down the campaigns I'm running more than anything, so I think this will help a lot to make combat run more smoothly.

I spent some time working on auto-attack but I think that'll be a much bigger project. I figured out how to get at NPC weapons so far. Next is to figure out how to translate those into attack rolls, and then to expand out to spells, PCs, and other powers. Once I get that far I think damage will be a breeze. It looks like attack will be ruleset specific too. I'd like to have it auto-select melee vs ranged based on distance, etc.

I don't want to go as far as suggested in the feature "Enemy AI - Auto Combat for Monsters (https://fgapp.idea.informer.com/proj/?ia=135350)", but I like the idea of automating simple attacks for GMs and repetitive attacks for players using hotkeys. I'll keep chipping away at it.

Edit: I think I have attack rolls sorted out. They seem to be working well with NPC weapons. Next will be selecting melee vs ranged based on range, then I'll move on to powers, PCs, etc. I probably won't have much/any time to tinker again until next weekend, but I'm happy with the progress made this weekend.

Bishopza
January 25th, 2021, 05:25
I tried this with my group last night and it really sped up combat from the GM side! Hitting the shortcut key 3 or 4 times to quickly loop through the PCs as a target from each NPC is much quicker than scrolling the map around to find who to target. It also feels like I get a better overview of combat... maybe because is is so fast to see the distance between all the tokens...
Anyway, it works awesome. Thanks!

Ulric
January 29th, 2021, 01:39
@VAM I test your extension with the Starfinder RuleSet and so far has been working great! I hope you find time to expand this extension. Thank you for sharing your creation!

Myrdin Potter
January 29th, 2021, 03:55
Will try this next Monday. Great idea!

Vam
January 29th, 2021, 12:57
Thanks for the great feedback! I had a chance to use it in a real game myself this week and it worked well, although not all of my players could be bothered to set it up. I liked having it, and I'll certainly use it as a player too.

I have been chipping away at it this week, and hope to have another release out this weekend with weapon attacks and casting. I don't know yet how that'll translate to other rulesets, but I hope to keep it generic enough to work across games.

Noelus
February 5th, 2021, 12:39
Excellent extension. My only query is whether it is possible to restrict targeting to enemies that the PC can see. At the moment it's a bit of a spoiler as PCs are able to target enemies that are outside LOS thereby gaining unfair intel. I understand that if you have the NPC set to invisible on the combat tracker it works fine but if you want to have the enemies visible there and rely on LOS to hide them it allows targeting. I understand if this would be too difficult to implement but thought I'd ask anyway.

Farnaby
February 5th, 2021, 14:58
Just tried it in FGU with the PF2e ruleset and it works a treat, my players are going to love this.

Ludd_G
February 5th, 2021, 15:40
Great request about LoS enemies.

Vam
February 6th, 2021, 00:46
Thanks for the encouragement. I think the LOS feature is a good idea. I can imagine counterpoints. Like, "I saw it, I ran around the corner and threw a fireball back at it", which would expand around the corner and allow valid targeting. Since that's the exception and not the rule I think it's a good idea. I don't think it would be very difficult to do. I've added it to the roadmap.

I was busy last weekend working on actions: attack, cast, effects and heal. These are working well, but only for 5e. I need to first make sure the rest of the extension plays well with other rulesets, and then see how much of that I can offer to the CoreRPG ruleset. I'll probably have to do custom work for each ruleset, which is unfortunate. I also had follow up damage working, but in a session I played today it wasn't working so I have to see what went wrong.

The actions thing is really great when it works. I programmed Alt-F10 to list available actions, and Alt-1 to Alt-9 to take actions. So as a GM I can very quickly target, scan available actions, and do a selected action. I'm super happy with how it works when it works.

For now I'll try to polish that enough to release a new version. Hopefully this weekend.

Farnaby
February 7th, 2021, 11:11
I'm getting an error as a player "[2/7/2021 11:51:39 AM] [ERROR] Script execution error: [string "scripts/manager_targeting.lua"]:276: attempt to index a nil value"
when targeting for the first time. I had to target manually and then it would work properly.

Also as the GM I'm getting [2/7/2021 12:02:10 PM] [ERROR] Script execution error: [string "scripts/vam_chatbat.lua"]:103: attempt to index local 'targetToken' (a nil value)
when using /cb t, though the /cb c works though.

damned
February 7th, 2021, 11:48
What other extensions are you running Farnaby?

Vam
February 7th, 2021, 14:47
Thanks very much Farnaby. I've tested both of these with just CoreRPG and ChatBat, and have reproduced them. I've been digging into the first one, and it is a doozie.

It turns out that only the GM has permission to create the holder for targets in the combat tracker. When you add a new PC that has never had targets that holder doesn't yet exist. When you target with Ctrl-Click it sends an OOB message to the GM, and it gets created there. The way I was doing it - directly by both PCs and GMs works as long as the holder for targets already exists.

I'll set up ChatBat to do something similar and message the GM to create the targeting for the PC. I'm still hoping to get a release out today that would include this, but I also need some prep time for a game I'm running tomorrow.

I still need to dig into the 2nd bug. Thanks again for reporting these Farnaby!

Vam
February 7th, 2021, 18:27
I've fixed both bugs identified by Farnaby and updated the first post with the ext file and updated readme. This release also adds actions, damage and target by radius. Here's my current to-do items:

### Bugs
- Players who control more than one character can only use ChatBat with the first one. Need to have it support multiple PCs.
- In ToA, Jaq didn't get +4 to hit or +2 damage with his crossbow. Weird.
- In ToA, the stacked Bless didn't do anything. Player stacked commands need to be updated to work with OOB messaging.

### Short Term Goals
- Initiative rolls (all NPC for gm)
- Don't depend on 5e ruleset
- Add a way to 'fave' something, so it appears at the top of the actions list
- Sort the actions list by name
- Check for actions of unequipped items. Jon reported them in the list.
- Have stacked commands wait for rolls so damage can be conditional

### Long term ideas
- Don't target tokens outside of LOS when LOS is enabled (?)
- Is there a way to include action shortcuts in the /cb a output?
-- See Shortcuts on https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm
- Target based on the last shape drawn (50% within the shape)
- Add a way to reset the combat tracker after an encounter
- Undo damage?

Bishopza
February 7th, 2021, 18:39
- Have stacked commands wait for rolls so damage can be conditional



Nice update! I like the actions, if you can get it to chain into damage that would be amazing.
I know the spell automation extension (https://www.fantasygrounds.com/forums/showthread.php?62208-5E-Spell-Automation) has stacked actions where it will roll the attack for a weapon and then automatically roll damage if there is a hit. Not sure if that would be of any help to you...

Vam
February 7th, 2021, 19:09
Ooo, thanks for the tip Bishopza. I'm sure having an example will help. Also, the code built into 5e for critical hits. Thanks for that.

Farnaby
February 7th, 2021, 21:15
Just tried out the new version and it works nicely.
The radius is good though I think there is also a case for radius without targeting self.
Perhaps a suggestion for the todo list?

The only thing that doesn't work is /cb a


but that would be because I'm running PF2e.
(bet I had you worried for a second there. ;))

Anyway, thanks for the great work!