Options

# Dice array and LUA

Registered User regular
edited July 2008
So I'm trying to use Lua to mimic these kind of dice.

The thing is that I'm stuck right here. I made this array using tables.
-- Red Die
>t[dRdamage]= {4,0,1,2,3,3};
>t[dRsurge] = {0,0,1,0,1,0};
>t[dRrange] = {0,0,2,2,1,1};
>t[dRmiss] = {0,1,0,0,0,0};

-- Blue Die
>t[dBdamage] = {1,0,1,2,0,2};
>t[dBsurge] = {1,0,1,0,1,0};
>t[dBrange] = {3,0,3,1,4,2};
>t[dBmiss] = {0,1,0,0,0,0);

-- White Die
>t[dWdamage] = {3,0,1,1,3,2};
>t[dWsurge] = {1,0,1,1,1,0};
>t[dWrange] = {1,0,3,3,1,2};
>t[dWmiss] = {0,1,0,0,0,0};

--Green die
>t[dGdamage] = {2,2,2,1,3,3};
>t[dGsurge] = {1,0,1,0,0,0};
>t[dGrange] = {0,1,0,1,0,0};

--Yellow Die
>t[dYdamage] = {1,0,1,0,0,0};
>t[dYsurge] = {0,0,0,0,1,1};
>t[dYrange] = {1,3,2,3,2,2};

--Black Power Die
>t[dBLACKdamagerange] = {1,1,1,0,0,0};
>t[dBLACKsurge] = {0,0,0,1,1,0};

--Silver Power Die
>t[dSILVERdamagerange] = {2,2,2,0,0,0};
>t[dSILVERsurge] = (0,0,0,2,2,0);

--Gold Power Die
>t[dGOLDdamagerange] = {3,3,3,0,0,0};
>t[dGOLDsurge] = {0,0,0,3,3,0};


So now how do I call up that data, and do all the adding functions?

My objective is to recreate those dice inside a d6. The program rolls a custom d6 called dR, and in the result of a 1, it looks up the information under Red Die (dR) and puts that into the calculation.

So when you throw 1dr plus 1dY you get the info on the array and the functio does the calculation.

So how do I write that function?

Munacra on