PDA

View Full Version : adding text to dice roll result



DNH
June 28th, 2007, 12:03
this is what currently happens (bear in mind this is for 2e AD&D):

players grab an attack die and roll it to make an attack the result is displayed on the chat window as something like "Boris: Longsword +1 (Attack) (18)"

i would like to be able to do something like the following:

players grab an attack die and roll it to make an attack the result is compared with values held in the character sheet db to find the AC hit the full result is displayed on the chat window as something like "Boris: Longsword +1 (Attack) - probably hits AC -1 (18)"

i think i know how to do this (by manipulating chat_chat.lua and the draginfo.getDescription result) but everything i try is getting me nowhere. a related issue is getting hold of the final dice roll total (roll + modifiers) so as to make the afore-mentioned comparison.

any thoughts?
(i realise you may require more info!)

cheers

DNH
June 28th, 2007, 12:38
i now have it so that i can pass additional info to the attack roll chat entry BUT i still need to be able to get that total roll value (die roll + modifiers).

any thoughts?

cheers

joshuha
June 28th, 2007, 13:54
Do you know how to get at the die table results list? Just loop through that, add them all up together, add the sum of the modifier stack (I get this before ApplyModifierStack is called), and then you have a total.

DNH
June 28th, 2007, 14:01
thanks joshuha! i have just managed to figure this out for myself, as it happens. i had to delve deeper into lua table manipulation than i ever had before!

now comes the lookup part, then the string construction. here goes.

cheers

DNH
June 28th, 2007, 14:33
ok, so now of course i need to look up certain values on the attacking character's character sheet ... er, how do i do that?!

i thought i almost had it - i can get the identity of the attacking player (the likes of "id-00002") and so would need to traverse the character db.xml to find the child node of that name (that would be the parent node of the whole character sheet for that character). then i could run down that tree and find the nodes i need.

but no luck so far.
any thoughts?

joshuha
June 28th, 2007, 14:51
Well if you have the id it should be something like:


DB.findNode("charsheet").getChild(idvariable).getChild("name").getValue()

DNH
June 28th, 2007, 15:57
i have this working like a charm now - tests for critical hits and misses and probable ac hit! thanks for your help.

Hamish
June 28th, 2007, 18:58
Would you care to share your code with us? I know I'm interested!