Thread: Roll on table on result
-
August 22nd, 2019, 07:00 #1
Roll on table on result
Hey guys. How do I make the stress dice from my Alien RPG ruleset roll on a table. Looking for a mechanic like that of the d&D5e Critical Hit/Fumble option.
Basically I want for my stress dice to automatically roll a number of dice on a table in game labeled “PANIC ROLL EFFECT RESULTS” if a 1 is rolled.
I just can’t figure out how to call up the roll in the first place. Any suggestions/examples? I think I found it in the 5e code, but there’s a lot of excess from checking other options and Booleans that I can’t determine the difference between what’s needed in my code and what needs to be changed/removed.
-
August 22nd, 2019, 09:52 #2
You would need an extension to do that I think.
If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
August 22nd, 2019, 14:24 #3
Yeah I’m looking for an example of how to code that.
https://www.fantasygrounds.com/forum...ion&highlight=Last edited by pr6i6e6st; August 22nd, 2019 at 14:31.
-
August 22nd, 2019, 16:14 #4
In 5E the code to initiate the roll for a fumble or critical is handled via OOB messaging - yep, you're going to have to learn about that now!
But, all that really does is call the handleApplyHRFC function that issues TableManager.processTableRoll("", msgOOB.sTable); where "msgOOB.sTable" is the table name to roll on. The dice to roll are set directly in that table.
EDIT: essentially the TableManager.processTableRoll("", "tablename") is the same as issuing a chat command: /rollon tablenameLast edited by Trenloe; August 22nd, 2019 at 16:17.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 22nd, 2019, 16:18 #5
Lol ok. Yeah I thought I was in the right spot there. So I’ll just have to play around with that a bit. Once I figure out how to work with all that, I can use it for npc attacks and initiative (works by drawing cards in this game, so I’ll be trying to incorporate your card extension somehow)
-
August 22nd, 2019, 20:28 #6
Ok, cool, thank you. so I got that kind of working, or at least sort of figured out. So which function might I want to look at to tell the table to roll a variable amount of stress dice (dS) rather than what it has stored? Or is that possible?
-
August 22nd, 2019, 20:34 #7
Get it working using the /rollon chat command - see the syntax here: https://www.fantasygrounds.com/wiki/.../Chat_Commands
Then use whatever you specify after /rollon in the chat as the second argument to TableManager.processTableRoll
For example: TableManager.processTableRoll("", "myTable -d 2dS")
If you want to see the code, look at the processTableRoll function in the CoreRPG TableManager global package (scripts\manager_table.lua).Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 22nd, 2019, 21:23 #8
oh man, it's so close to working. can the number of dice be a variable?
kind of like:
nValue = getValue();
TableManager.processTableRoll("", "myTable -d nValuedS")
or
TableManager.processTableRoll("", "myTable -d getValue()dS")
the above doesn't work straight like that,
-
August 22nd, 2019, 21:26 #9
The argument you pass is a string. So, construct that string as you need - look up how to construct LUA strings in standard LUA tutorials. But you can use something like this: "myTable -d " .. nValue .. "dS"
Info on string construction here: https://lua-users.org/wiki/StringsTutorialLast edited by Trenloe; August 22nd, 2019 at 21:51.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 22nd, 2019, 21:35 #10
awesome! that works! it doesn't recognize my stress or base dice that way yet, it seems, but a d6 works just fine in its place. you're a legend.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks