• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Random Number Script Clarification...

GodPole

Well-known member
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
 
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.
 
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
 
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.
 
Code for a custom cursed item

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!
 
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.
 
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.
 
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.
 
Okay i've tried to work the "Arcane Decay" Script onto a test item that applies two penalties to the Constitution score. Black Lotus Extract (poison)

However if I assign two Helper ShowSpec and ShowCharges fields to the gear then I get a duplicate Helper error. I presume that its an all or nothing penalty!!

If I remove the Helper for one of the charges then the item works fine, the Charge list shows on the in play tab but when I add a charge then the Constitution attribute is reduced by 2 and not 1 as I expected.

Heres the code i've got at the moment. Screenshots attached

HTML:
Black lotus extract

Contact DC 20

Initial Damage 3d6 Con

Secondary Damage 3d6 Con

Perils Of Using Poison

A character has a 5% chance of exposing himself to a poison whenever he applies it to a weapon or otherwise readies it for use. Additionally, a character who rolls a natural 1 on an attack roll with a poisoned weapon must make a DC 15 Reflex save or accidentally poison himself with the weapon. A creature with a poison attack is immune to its own poison and the poison of others of its kind.
Code:
~Primary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value
~Secondary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value
moz-screenshot.png
 

Attachments

  • Field Values.JPG
    Field Values.JPG
    34.7 KB · Views: 5
  • Edit Tags.JPG
    Edit Tags.JPG
    49.9 KB · Views: 4
  • Eval Scripts.JPG
    Eval Scripts.JPG
    37.7 KB · Views: 4
  • Gear Screen.JPG
    Gear Screen.JPG
    107.2 KB · Views: 5
  • Error Message.JPG
    Error Message.JPG
    67.3 KB · Views: 4
I've managed to get the "Twice as much than needed" penalty when a charge has been used error to go away.

New modified code

Code:
~Primary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value/2
~Secondary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value/2

One charge used one point of constitution subtracted!

I still can't get two charges to apply to the Same attribute though.

However i'm still getting this error when the qustion mark near the Primary and the secondary damage tick boxes is used

Attempt to access field 'CustDesc' that does not exist for thing 'gBlkPoison'
Location: 'mouse info' script for Template 'hPick' (in Portal 'hInfo') near line 8
- - -
Attempt to access field 'CustDesc' that does not exist for thing 'gBlkPoison'
Location: 'mouse info' script for Template 'hPick' (in Portal 'hInfo') near line 8

Any ideas?
 
Code:
if (field[hIsOn1].value <> 0) then
  hero.child[aCON].field[Penalty].value -= field[hUsed].value
  endif
if (field[hIsOn2].value <> 0) then
  hero.child[aCON].field[Penalty].value -= field[hUsed].value
  endif

There's no way to have separate selectors for these, so the primary and secondary damage will be the same, which doesn't match the way the item works.

Also, is the person who owns the poison item going to be the one who's going to suffer the damage from it? Or do you have to pay 4500gp and then suffer these effects? (just joking - you'd buy it for free).

I'd recommend just making poison items normal pieces of gear, with no activation, and leave it up to the victim to use adjustments to apply the effects.

Either that, or add a separate adjustment for the effects, rather than putting the effects on the gear - but there, you have the same problem that there's only one incrementer available. I still recommend using the normal adjustments to apply the effects of poison.
 
Last edited:
There appears to be a bug with giving general gear (but not armor, weapons, or magic items) an activation - a setting was missed in the definition of gear. I've fixed that for the next update. That's the source of the runtime error you're encountering in the mouseover.
 
Also, is the person who owns the poison item going to be the one who's going to suffer the damage from it? Or do you have to pay 4500gp and then suffer these effects? (just joking - you'd buy it for free).

Assassins in the module i'm running use the Poisons quite a lot and having the Players with them already equipped in the inventory would make it easier to apply the effects of the Primary and Secondary Damage, using the Charges indicator is brilliant!

As its a penalty they would stack, however if a poison has a Dex and a Str penalty that differ say 3d6 to Dex and 1d4 to str then the Duplicate ShowSpec Helper error doesn't help.

I'd recommend just making poison items normal pieces of gear, with no activation, and leave it up to the victim to use adjustments to apply the effects.

I actually wanted to use the Poison on a character without having to add two types of adjustments manually. one mouse click on one screen instead of add 2 temporary modifier with 2 mouse clicks
 
On the subject of poisons as gear, would it be possible to set up different poisoned conditions on the condition tab instead, similar to the new Spell conditions that change combat modifiers in the Pathfinder data part of hero lab?

Maybe these could provide a method of generating a random penalty to the attribute scores instead?
 
If your characters are getting the same poisons often, they can leave the appropriate adjustments on their character sheet - fill in the poison name as the source, fill in the appropriate duration, and then just uncheck it while you're not affected.

Just use the normal adjustments for poisons, not the conditions - that way, the conditions tab doesn't become too cluttered to find anything, which is what will happen if you add a dozen poisons, 3 dozen spells, etc. Conditions also can't have incrementers, so they're not usfeul for anything variable, like poisons.
 
They aren't getting the same poisons often, I decided to try and program them into HL so they would be available to purchase as gear. Then it occured to me that I could have the poisons affect the characters as well, kind of a situational modifier case.
Oh well maybe I'll try and get the poisons to add temporary modifier fields automatically when ticked instead of manually.
 
I've got an odd error, using this script for charges makes the ability scores have .5 adjustments, how can I round the score to a whole number.
It looks cool having 16.5 con but it's useless in game terms!

Code:
~Primary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value/2
~Secondary CON penalty
hero.child[aCON].field[Penalty].value -= field[hUsed].value/2

Thanks in advance!
 
-= round(field[hUsed].value/2,0,-1)

Rather than dividing and rounding, wouldn't it be easier to have the incrementer represent the penalty to be applied to each, instead of the total penalty? That seems easier for a user to understand - "I've rolled a 4 for both the initial and secondary damage rolls", rather than "My initial and secondary damage rolls total to 8".
 
Back
Top