Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
dwobbit
Junior Member
 
Join Date: Jan 2020
Posts: 12

Old March 27th, 2023, 12:02 PM
I am trying to allow my players to generate random attribute scores when they create their characters, using HL ability to generate random numbers. I have no problem generating the values as the system requires. What I need help with is, How do I get those values to be assigned to the attributes and persist when the portfolio is saved and then reopened???

I know it is possible as the 5e SRD uses something along these lines for Background Personality Traits, Ideal, Bond, and Flaw random picks....

Can someone please help?
dwobbit is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old March 27th, 2023, 01:28 PM
You'd create an action script that rolls the dice and overwrites the user fields on the appropriate attributes and create a trigger button to run the action script. Then, the user will click the button to get the die rolls. Depending on your game, you may have separate buttons for each attribute, or one button that adds to all of them.
Mathias is online now   #2 Reply With Quote
dwobbit
Junior Member
 
Join Date: Jan 2020
Posts: 12

Old March 27th, 2023, 02:11 PM
This is what I did but the button does not generate any numbers:

Code:
<portal
	id="Random"
	style="actBig"
	tiptext="Click here to randomly generate attributes.">
	<action
		action="trigger"
		buttontext="Roll Stats"
		confirm="This will generate random values for all attributes. Proceed?">
		<trigger><![CDATA[
		hero.child[attrStr].field[trtUser].value = random(6) + random(6) + 1
		hero.child[attrAgl].field[trtUser].value = random(6) + random(6) + 1
		hero.child[attrCon].field[trtUser].value = random(6) + random(6) + 1
		hero.child[attrInt].field[trtUser].value = random(6) + random(6) + 1
		hero.child[attrEdu].field[trtUser].value = random(6) + random(6) + 1
		hero.child[attrChr].field[trtUser].value = random(6) + random(6) + 1
		]]></trigger>
	</action>
</portal>
Any ideas?

Last edited by dwobbit; March 27th, 2023 at 05:47 PM.
dwobbit is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old March 27th, 2023, 02:39 PM
That looks as though it should work. There's no error messages? When you click the button, what exactly happens? At this point, I need to know exactly what the error is.

Note: random(6) gives 0-5, so 2d6+1 wound be random(6) + random(6) + 3

http://hlkitwiki.wolflair.com/index....age_Intrinsics


Oh, and if you switch to advanced mode when writing a reply on this forum, there's a "Code" button you can use to present things better.
Mathias is online now   #4 Reply With Quote
dwobbit
Junior Member
 
Join Date: Jan 2020
Posts: 12

Old March 27th, 2023, 03:32 PM
I get no error message, I just also get no values for the attributes. When I click the button I get the message "This will generate random values for all attributes. Proceed?". When I click the "Yes" button I get nothing.

Understood on the way random works... I am actually shooting for 2d6-1 (which random(6) + random(6) + 1 gives me).
dwobbit is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old March 27th, 2023, 04:17 PM
Hmm. I'm not sure where to look next. Let's add some debugging - test what's going on.

Within the trigger script:
Code:
debug "Strength"
debug "Minimum: " & hero.child[attrStr].field[trtMinimum].value
debug "Maximum: " & hero.child[attrStr].field[trtMaximum].value
debug "Initial: " & hero.child[attrStr].field[trtUser].value hero.child[attrStr].field[trtUser].value = random(6) + random(6) + 1
debug "After Adding Random: " & hero.child[attrStr].field[trtUser].value
To look at the results of the debugs, in the Develop menu, first make sure "Enable Data File Debugging" is turned on, then near the bottom, find floating info windows...show debug output.
Mathias is online now   #6 Reply With Quote
dwobbit
Junior Member
 
Join Date: Jan 2020
Posts: 12

Old March 27th, 2023, 04:34 PM
So I figured out this part...Thank you! The portal was outside the attribute pick template.

Now I need to figure out how to get the button to appear once, either above or below the attributes.... OR, is there a way to get it to work from outside the attribute picktemplate???

This is what I currently have:
Attached Images
File Type: jpg 2023-03-27_21-19-47.jpg (32.9 KB, 2 views)

Last edited by dwobbit; March 27th, 2023 at 06:26 PM.
dwobbit is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old March 28th, 2023, 07:52 AM
The trigger portal is expected to be outside the attribute pick template. The way I'd do this is to create a template, which contains the trigger button, and then place that template into the same layout as the attribute table with a templateref and then arrange the two visual elements as you like.
Mathias is online now   #8 Reply With Quote
dwobbit
Junior Member
 
Join Date: Jan 2020
Posts: 12

Old March 28th, 2023, 02:54 PM
Thank you! This has been super helpful and I now have this portion working!
dwobbit is offline   #9 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 08:28 AM.


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