PDA

View Full Version : rRoll, rSource, and rTarget



sciencephile
July 6th, 2014, 16:35
I've been looking for quite a while ... does anyone know if there is documentation about rSource, rTarget, and rRoll?

I'm trying to create a skill system that test for potential critical threats and critical errors but does not automatically roll for the potential critical. If someone has a good idea on how to do that and would like to share, that would be great. Ultimately, however, regardless of if a solution is posted, I would still like to know if there is any documentation for the three values mentioned above.

Thanks.

Griogre
July 6th, 2014, 18:24
Hmm. Those are variable names and as such would be defined by the ruleset or part of the ruleset that is using them. In Hungarian notation the leading "r" often means its a real number which is somewhat odd to use with something like die rolling since it typically uses whole numbers unless you're doing division. I would suggest you search all files where you got the variables. While they might be global variables, they are most likely to be local ones defined inside a function or as function arguments.

Trenloe
July 6th, 2014, 19:02
The CoreRPG scripts\manager_actions.lua file has some data on what is stored in a roll variable in the script header.

You can see en example of this data being compiled in the same script file for the decodeRollFromDrag function.

rSource and rTarget can be created by the getActor function in scripts\manager_actor.lua which is a good function to look at for understanding the structure - that script file lists the data structure for the rActor variable which is what is returned to rSource and rTarget.

sciencephile
July 6th, 2014, 19:59
Thanks. I am racking my brain trying to implement a skill system where I have to display "Potential Error" on a roll of 1 (or a value given in a text box) and "Potential Critical" for a roll of 20 (or a value given in a text box). In the manager_action_skill.lua, I can get the value from the skill being tested and pass it all the way to the getRoll function. Unfortunately, this is before the result of the die roll. In the onRoll function, I can get the result of the die roll but cannot seem to get the value for the potential error/crit to that function.

Does anyone know of a ruleset I can look at that has a similar mechanism, where a skill needed to be tested for a condition, like a potential critical or error?

This is my white whale at the moment. I've been pretty good being able to figure things out without posting to the board. Lately, however, seems I am coming across some unusual circumstances.

Trenloe
July 6th, 2014, 20:28
Does anyone know of a ruleset I can look at that has a similar mechanism, where a skill needed to be tested for a condition, like a potential critical or error?
The 3.5E ruleset does this for attacks - it is an automatic critical threat on a 20 but certain weapons can have a wider range. This wider range is passed as part of the rRoll.sDesc string using [CRIT 19] (for example to crit on a 19-20) as part of the sDesc string. See lines131-133 of scripts\manage_attack_action.lua in the 3.5E ruleset.

Then see the section starting at line 419 in the onAttack Result Hander function where the crit range is parsed out of the sDesc string: local sAltCritRange = string.match(rRoll.sDesc, "%[CRIT (%d+)%]");

Using values in square brackets is quite a common way of passing data in the roll description so that it can be used in the result handler function.

sciencephile
July 6th, 2014, 21:06
Ahhh. I was looking into something way too sophisticated (like passing an actual parameter). I saw this but had assumed that the processing wasn't actually happening via parsing a string. Thanks for the information.

sciencephile
July 6th, 2014, 22:28
Worked like a charm. Thanks again, Trenloe.

Paul Pratt
July 7th, 2014, 15:02
In the onAttack, onDamage, etc you can also call something like:

local nResult = rRoll.aDice[1].result;
if nResult == 20 then

rRoll.aDice[1].result will find the die result and is a pretty easy way of sending/adding to rRoll.sDesc

And as above string match is a way to handle going from onXXX() functions to applyXXX() functions in those 3.5 files.

sciencephile
July 7th, 2014, 17:55
Unfortunately, it has to take the error and crit range from the character sheet and may not be tied to strictly a 1 or 20 but a value entered by the user on the skills sheet. I used the string parser and got it working. Thank you anyway though (I did use the aDice[1].result. I just needed to compare it to a dynamic number.