PDA

View Full Version : Adding Damage Dice...



Blackfoot
January 8th, 2014, 21:12
In the ruleset I'm working on, damage is based on 'damage classes' (DCs) these DCs get converted to different amounts of damage based on what sorts effects are applied to them.
Examples:
Normal Damage: 1DC = 1d6
Mental Damage: 2DC = 1d6
Killing Damage: 3DC = 1d6
etc...

For basic 'punching' damage you take the character's Strength/5 to determine the number of DCs that they do in damage. (This is obviously pretty different from 3.5 but kinda the same too...) anyway... a character with a 15 strength will do 3d6 damage.
I have built the code to come up with the number of DCs that a character might have when they go to do 'melee' damage... but my issue is converting that number into 'dice'. I'm looking at making some sort of loop that basically goes through and adds { "1d6" } until it runs out of DCs... but the code I'm looking at is quite complicated and honestly... I can't figure it out.
Can anyone help me get started?

Blackfoot
January 8th, 2014, 21:27
Sorry.. I meant to post this in the Workshop.

Trenloe
January 8th, 2014, 21:43
Have a look at \scripts\manage_action_ability.lua in the 3.5e ruleset. performRoll is what kicks off an ability roll, with the getRoll function putting all of the rRoll data together before calling ActionsManager.performAction.

In getRoll you can change rRoll.aDice to be a table of d6's.

First set the rRoll.aDice table to be empty: rRoll.aDice = {};

Then add however many d6's you need with: table.insert(rRoll.aDice, "d6");

You have to add one d6 at a time.

Moon Wizard
January 8th, 2014, 21:50
That sounds about right. Calculate the number of dice from Ability/5, then loop that many times to add "d6" to an array. Pass this to the function handling your roll.

Regards,
JPG

Blackfoot
January 9th, 2014, 02:52
OK.. another.. related question.
Is there a way to set a display dice in a dicefield without dropping them into it? Or maybe is there a different sort of control that I need to use?
Here's my example:
I have 30 strength... so my 'strength bonus' should be 6d6.. (plus any additional dice I want to add to it) I want the 'bonus' field to display the 6d6 and then have another field that I can drop dice into.. I'm using the 3.5 dice as a model and it sorta works.. but it doesn't display the dice.

Blackfoot
January 9th, 2014, 07:08
I think I have it mostly...
My only problem at this point seems to be finding the darn Actor for the ActorManager... that fellow always seems to get lost on me somehow.

Moon Wizard
January 9th, 2014, 21:24
ActorManager is a global script that used in CoreRPG that a has a function getActor that returns a actor object (i.e. table with fields) that can be passed to other CoreRPG script functions. It's in CoreRPG under scripts/manager_actor.lua, and it's one of the first functions in that file.

Regards,
JPG

Blackfoot
January 9th, 2014, 22:30
I couldn't quite get 'getActor' to work... I'm not sure what I'm supposed to pass with it to return the proper info... I used another function I found in char_weapondamage which I was emulating anyway ...
local rActor, rDamage = CharManager.getWeaponDamageRollStructures(window.g etDatabaseNode()); ... and it worked I have my strength bonus damage displaying properly now.. and even have the dice colored differently from normal dice.. and make a color distinction for a 'half die' if there is one. Something I would sorta like to see in the 3.5/PFRPG rulesets. (use a different graphic or different color for half die (d3).. and d2 as well I suppose)

Thanks for the help guys!