Junior Member
Join Date: Aug 2010
Posts: 23
|
hi, I'm making a data file for Dark Heresy and have run into a _Potential_ challenge. I need to call the dice roller multiple times throughout the character generation process. A List seems to be in order.
i need to roll a D5 for Wounds. D10 for Fate D100 for Divination and in the future will need 2D10 for characteristic generation (this will only happen AFTER i get the data files in a workable form) i am assuming that you can call the function from outside the Tac-con, my question is whether you can change what type of dice it rolls on the fly and if so, how? Thanks for any help, Regards, Protector152 Last edited by Protector152; January 30th, 2012 at 12:42 AM. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Let the user enter the results of those rolls, rather than generating the rolls yourself - many people will prefer to roll physical dice for character generation - those who don't can use the dice roller themselves.
|
#2 |
Junior Member
Join Date: Aug 2010
Posts: 23
|
I'll implement that as an option. However the group i play with doesn't know much about rolling up characters and we play over the net, hence i want to have the option of semi-/hidden rolls to speed up the process.
|
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
There aren't any good ways to lock down random number generation in the code, and prevent the user from rolling it again - or prevent the program from rolling it again just because you changed something else and your lockdown code wasn't perfect.
|
#4 |
Junior Member
Join Date: Aug 2010
Posts: 23
|
tags can do a lot of things, however most of the stuff i "need" to randomize, (other then starting money, and stat generation) will not be needed until start of play. I appreciate that you want to make this whole process easier for me.
I still want to know how to call the dice roller from within the code, change the type of dice it's rolling on the fly and keep the user from interfering with the process unless they have chosen to roll a semi-random character/use real dice. |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
There is no way to call the diceroller.
The only way to get a random number is to call a random number function - which means that every time you run that script, you will get a new random number. |
#6 |
Junior Member
Join Date: Oct 2017
Posts: 1
|
If you called the script from a button, and then disabled the button after the roll, wouldn't that prevent the player from re-rolling?
|
#7 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
You can call it from an action script and then store it in a persistant user field with each button press. Here is an example of a button we use in PF.
Code:
<portal id="actRoll" style="actBig"> <action action="trigger"> <trigger><![CDATA[ ~make sure we're rolling a valid number of dice var iserror as number if (herofield[tSCRNumDce].value < 1) then iserror = 1 endif if (herofield[tSCRDceSiz].value < 1) then iserror = 1 endif if (herofield[tSCRMult].value < 0) then iserror = 1 endif if (herofield[tSCROver].value > 0) then iserror = 0 endif if (iserror <> 0) then notify "Sorry, no starting cash roll has been specified for this class." done endif ~for each die, generate a random number and add it to the total var i as number var basecoin as number for i = 1 to herofield[tSCRNumDce].value basecoin += random(herofield[tSCRDceSiz].value) + 1 next basecoin *= herofield[tSCRMult].value basecoin += herofield[tSCRBonus].value if (herofield[tSCROver].value <> 0) then basecoin = herofield[tSCROver].value endif ~update the starting cash ~first reset the existing fields. herofield[tStartCP].value = 0 herofield[tStartSP].value = 0 herofield[tStartGP].value = 0 herofield[tStartPP].value = 0 herofield[tStartCn1].value = 0 herofield[tStartCn2].value = 0 herofield[tStartCn3].value = 0 herofield[tStartCn4].value = 0 ~ Depending on which slot we have chosen, the base coin differs if (hero.childfound[Currency].field[curBaseSlt].value = 8) then herofield[tStartCn4].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 7) then herofield[tStartCn3].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 6) then herofield[tStartCn2].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 5) then herofield[tStartCn1].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 4) then herofield[tStartPP].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 3) then herofield[tStartGP].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 2) then herofield[tStartSP].value = basecoin elseif (hero.childfound[Currency].field[curBaseSlt].value = 1) then herofield[tStartCP].value = basecoin endif ]]></trigger> <buttontext><![CDATA[ ~it's only a "roll" if we don't have a fixed override value for our cash if (herofield[tSCROver].value <> 0) then @text = "Set Cash" else @text = "Roll" endif ]]></buttontext> </action> </portal> |
#8 |
|
|