PDA

View Full Version : How to code Grapple and Shove as an action in your character sheet



SilentRuin
June 6th, 2020, 21:16
I'm new to FG(unity) and have already heavily modified an extension for my personal use. However, this was based on an existing extension so it was fairly easy to figure it out. But now I want to add the action to all my PC's called "grapple" (and also add "shove").

I've seen plenty of comments about "just make it a spell" or "just do this" as if I know how to do more than a one line simple thing like in the examples here ( https://www.fantasygrounds.com/wiki/index.php/5E_Effects ) . But I'm looking how to do a multiple conditional action here. The following is just made up data in "". Though I know I've seen .lua use of all of this type data - not sure how to trigger it as extension action for character sheet - or just a spell that has all I need in it with no .lua modifications required.

For grapple (based on PHB p. 195 - also this is not a real language just a way to describe what I want):


if "source size" +1 > "target size" then

FAILED TO GRAPPLE

return;
end

if "target effects" has "unconcious/incapacitated" then

APPLY GRAPPLE EFFECT TO TARGET

return;
end

if "target dex check" > "target str check" then

"target check" = "target dex check"
else

"target check" = "target str check"
end

"source check value" = roll ("source str check");
"target check value" = roll ("target check");

if "source check value" > "target check value" then

APPLY GRAPPLE EFFECT TO TARGET
else

FAILED TO GRAPPLE
end

return;

So.... My question is - how do I do this in an extension. Or even better, how do I make a "grapple" spell that does the above logic ending up in a state of "grappled" being applied to target - or not after the "cast" or whatever.

Zacchaeus
June 6th, 2020, 21:37
I don't know the answer but it is on the 'to do' list in this extension https://www.fantasygrounds.com/forums/showthread.php?56994-5E-RFIA-Addon-Manual-spell-concentration-death-saves-NPC-support-Contested-skill

SilentRuin
June 6th, 2020, 21:46
I don't know the answer but it is on the 'to do' list in this extension https://www.fantasygrounds.com/forums/showthread.php?56994-5E-RFIA-Addon-Manual-spell-concentration-death-saves-NPC-support-Contested-skill

I've unpacked the 5e and CoreRPG and have my own extension for code examples, and I can "see" everything I've mentioned being possible (notepad++ keyword searches can find each thing I want to do in some odd place or another). But as most extensions I'm finding are tailored to another DM's personal preferences and also generally have more than I want (i.e overhead even with options), I'm hoping for a quick cheat implementation using a spell effect syntax, but I'm not sure you can do all that I want in that syntax. And if that's not possible, I'd just want to make an extension (not buried with other things I don't want/need) to simply add "grapple", "break grapple", and "shove" to every PC character sheet actions automatically based on my above logic.

I've seen your posts and your very experienced at this sort of stuff, so by your answer can I assume there is no way to make this into some multi conditional spell with the current available syntax?

The answer to that would at least force me down the extension path instead of wondering if I'm missing something much easier. Let me know if a spell with multi conditional statements like I presented is just not possible if you can. Thanks.

Zacchaeus
June 6th, 2020, 22:43
No, there’s no way to create a scenario like this with effects. You will need an extension to do this.

SilentRuin
June 10th, 2020, 22:43
Someone should have warned me how undocumented the code is, how you have to literally trial and error and trace down into each and every piece of code because no two things take the same argument, how OOB messages are required to update things in the host, how they mangle everything in translation, how even existing 5e/coreRPG code you think you can use ends up corrupting your database so that you have to write your own stuff to process things at host level...

AHHHHHHHHHH!!!!!!!!

And don't get me started on no compiler/linker having to debug everything with print statements in LUA... not to mention having to learn LUA (should not complain about that as was not hard as I've learned many languages over the decades)...

But major progress after a week of slaving. i'm going to make this into a really impressive feature now that I have the bloody wounds from trying to figure all this stuff out on my own.

Threz
September 16th, 2020, 12:09
You sir are a champion of the community.