Member
Join Date: Feb 2010
Location: Charlotte, NC
Posts: 81
|
I am trying to confirm how the random() function works.
For example, the if a script says: random (8) Does that return a 1,2,3,4,5,6,7,8 or does it return 0,1,2,3,4,5,6,7? The .pdf seems to imply the latter, but I just wanted to confirm. Thanks. -GP |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
0 - 7
May I ask what you want to use a random number for? If you're putting it in an Eval Script, a new random number will be generated EVERY time Hero Lab recalculates the character. The normal way to handle this is to let the user roll their own dice, and use HL to record the result. |
#2 |
Member
Join Date: Feb 2010
Location: Charlotte, NC
Posts: 81
|
Trying to code the spell, "Heroes' Feast" as an adjustment Condition.
-GP |
#3 |
Member
Join Date: Feb 2010
Location: Charlotte, NC
Posts: 81
|
This also leads into a related question:
If I wanted to create a condition for Heroes Feast, but I wanted to allow the player to roll their own d8 for the HP buff, is there a way to get a window to pop up which allows me to enter in the result of the roll and assign it to a variable? Something similar to what "Weapon Focus" does? -GP |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
I wouldn't recommend putting adjustments for a spell into the conditions tab - you lose the ability to add an incrementer. Make it a normal adjustment, and use the incrementer to have the user set the HP to add. Take a look at the "Effect: Inspire Greatness" adjustment - you can just pull the code out of that for how to use an incrementer to add temp HP.
Think about what the conditions list will look like once you have more than a few spells added - it'll be a huge list of spells, and you won't be able to find specific conditions among that list. I think it's better for all the spells to be in the regular adjustments list - let the user choose which spell adjustments they do or don't want to add to their character. |
#5 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
On a similar tack Re: Random number. I will be trying to code an item that whilst equipped reduces attribute scores by a random amount.
For example whilst wearing A helm of idiocy the users intelligence and wisdom is reduced by 3d4 points. Et al. It doesn't matter if the random number alters each time the program resets as it's conditional anyway. Are there any code examples in current datasets that I could scavenge or is there anybody that has something similar that they can provide an example of. Any help greatly appreciated! |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
The random number wouldn't just change when the program reset - it would change any time the user changed anything about the character.
You can use the Attribute (temporary) adjustment on the Adjust tab to enter the change you've rolled with your dice. |
#7 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Okay is there a way to automatically set the temporary adjustments with a script on an item also utilising the dropdown boxes? Instead of adding them manually one at a time?
What I'd like is to be able to make an custom piece of gear add it to the inventory of a character equip it and the adjustments be set. Entering the number wouldn't be too much of a hassle then. |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
You can use the charges of the item as the field where the user controls the amount of adjustment to apply, and then use that information to apply the INT and WIS adjustments you want to make.
There's a Special called "Arcane Decay" (from Rise of the Runelords) that provides an example of this. Actually, it's applying a penalty to INT, WIS, and CHA, so it's a pretty complete example for what you want to do. |
#9 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Thanks Mathias I'll check that out!
|
#10 |
|
|