Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit

Notices

Reply
 
Thread Tools Display Modes
Protector152
Junior Member
 
Join Date: Aug 2010
Posts: 23

Old January 30th, 2012, 01:01 AM
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 01:42 AM.
Protector152 is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 11,988

Old January 30th, 2012, 07:16 AM
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.
Mathias is offline   #2 Reply With Quote
Protector152
Junior Member
 
Join Date: Aug 2010
Posts: 23

Old January 30th, 2012, 09:36 PM
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.
Protector152 is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 11,988

Old January 30th, 2012, 11:04 PM
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.
Mathias is offline   #4 Reply With Quote
Protector152
Junior Member
 
Join Date: Aug 2010
Posts: 23

Old January 31st, 2012, 03:58 AM
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.
Protector152 is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 11,988

Old January 31st, 2012, 08:19 AM
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.
Mathias is offline   #6 Reply With Quote
ikvsabre
Junior Member
 
Join Date: Oct 2017
Posts: 1

Old October 28th, 2017, 09:02 PM
Quote:
Originally Posted by Mathias View Post
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.
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?
ikvsabre is offline   #7 Reply With Quote
Aaron
Senior Member
Lone Wolf Staff
 
Join Date: Oct 2011
Posts: 6,216

Old November 7th, 2017, 03:19 PM
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>
Aaron is offline   #8 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:34 AM.


Powered by vBulletin® - Copyright ©2000 - 2017, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.