Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System

Notices

Reply
 
Thread Tools Display Modes
draco963
Member
 
Join Date: Jul 2015
Location: Ottawa
Posts: 58

Old July 27th, 2019, 01:29 AM
Ok, another one. I've got an item that needs to be able to substitute the normal Str bonus to melee attacks with the Dex bonus instead. Here's the script I've written for the item to (not ) do this:

Code:
~ "Precision Assault" Use Dex instead of Str for attacks

~ If we're not enabled, get out now.
doneif (field[gIsEquip].value = 0)

var HD as number
HD = hero.tagcount[Hero.HitDice] + 2
var Rit as number
Rit = field[Value].value
var vDex as number
vDex = hero.child[aDEX].field[aModBonus].value
var vStr as number
vStr = hero.child[aSTR].field[aModBonus].value
var Diff as number
Diff = vDex - vStr

~ Change our base attack bonus.
    if (HD >= 5) then
        if (Rit >= 1) then
            hero.child[Attack].field[tAtkMelee].value += Diff
        endif
    endif
Now, as written, it doesn't work. However, if I change the final math line to a hard value, say, +4 or +18 or whatever I please, it works.

Best I can think of, my script is firing in the wrong place. right now, I've tried both Pre-levels 10000 and Post-levels 10000. Both places work for a hard-coded amount, but not a variable amount.

Any suggestions what I've done wrong?
Thanks!
draco963 is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,144

Old July 29th, 2019, 06:50 AM
Quote:
Originally Posted by draco963 View Post
Any suggestions what I've done wrong?
Thanks!
Yes. You need to run any scripts working with ability score modifiers during Post-Attributes. Otherwise you get nothing but 0's.
Sendric is offline   #2 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 05:36 AM.


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