PDA

View Full Version : Changing the dice pool in the Charsheet



ttuckel
May 23rd, 2012, 23:09
Hi,
Sorry for this noob question and for my bad english !
I have a problem with a script in the characteristics in my charsheet.
Actualy, the number in the characteristic is added to the dice.
But I want that the number in the characteristic determine the number of dices.
Example : val=2 > 2D6 rolls

I'm basing in the Warhammer v2 ruleset and my actual script is :

<script>

function rollDice()
local desc = getValue();
ChatManager.throwDice("dice", {"d6"}, getValue(), "Test de Puissance (" .. desc .. ")");
end

function onDoubleClick(x, y)
rollDice();
end

</script>

Anyone can help me please ? :o

Moon Wizard
May 23rd, 2012, 23:49
Try this:



function rollDice()
local nValue = getValue();
local aDice = {};
for i = 1, nValue do
table.insert(aDice, "d6");
end
ChatManager.throwDice("dice", aDice, 0, "Test de Puissance (" .. desc .. ")");
end


Cheers,
JPG

ttuckel
May 24th, 2012, 19:47
It doesn't work :

Script Error: [string "charsheet_skills:puissance"]:1: attempt to concatenate global 'desc' (a nil value)


:confused:

Dakadin
May 24th, 2012, 21:29
I think you just need to change


ChatManager.throwDice("dice", aDice, 0, "Test de Puissance (" .. desc .. ")");


to


ChatManager.throwDice("dice", aDice, 0, "Test de Puissance (" .. nValue .. ")");


since desc isn't declared.

ttuckel
May 24th, 2012, 21:33
Thank you moon_wizard and Dakadin everything is OK ;)