Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old February 4th, 2011, 04:43 AM
I think this might be instructional for other people who might want to make eval scripts, but mostly I am just posting it because I feel proud of this chunk of code. Feel free to offer constructive criticism though, if you see a better way of doing things.

This is for the Marilith race, one of their things is when using the Multiweapon fighting feat they take no penalties, regardless of the weapons wielded in the main or off hand.

Post Levels 10000
~ Do we have the Multiweapon fighting feat? If not we are done.
doneif (#hasfeat[fMultiWep] = 0)

~ Search through all base weapons and make sure that we are two weapon fighting (that is have at least 1 weapon equipped in only the main hand and at least 1 in only the off hand)

var MainHand as number
var OffHand as number

foreach pick in hero from BaseWep
~ Are we equipped in both hands? If so skip to the next weapon and do nothing, otherwise check if we are equipped in the main hand.
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value = 2) then

elseif (eachpick.field[gIsEquip].value = 1) then
MainHand = 1
endif

~ Are we equipped in both hands? If so skip to the next weapon and do nothing, otherwise check if we are equipped in the off hand.
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value = 2) then

elseif (eachpick.field[wIs2nd].value = 1) then
OffHand = 1
endif
nexteach

~ Now check if we are two weapon fighting, if not, done.
doneif (MainHand + OffHand <> 2)

~ We are two weapon fighting, so we need to know what weapons are in off hands.

~ Possible configurations
~ 1. Main = 1 Hand & Off = 1 Hand.
~ 2. Main = 1 Hand & Off = Light
~ 3. Main = Light & Off = Light
~ 4. Main = Light & Off = 1 Hand

~ The way HL works, if any of the off hand weapons are light the Main hand takes -2 Pen, regardless of anything else, so check to see that at least one light weapon is equipped in the off hand. We still need to beware of things equipped in 2 hands.

var OffLight as number
foreach pick in hero from BaseWep where "wClass.Light"
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value = 2) then

elseif (eachpick.field[wIs2nd].value = 1) then
OffLight = 1
endif
nexteach

~ If OffLight = 1 then add +2 to the main weapon's to hit to counteract penalty. Still beware weapons equipped in 2 hands.
if (OffLight = 1) then
foreach pick in hero from BaseWep where "Hero.MainHand & !Hero.OffHand"
eachpick.field[wAttBonus].value += 2
nexteach

~ Otherwise all off hand weapons are 1 Handed, add +4 to the main weapon's to hit to counteract penalty.
elseif (OffLight = 0) then
foreach pick in hero from BaseWep where "Hero.MainHand"
eachpick.field[wAttBonus].value += 4
nexteach
endif

~ Now we need to go through and modify all the Off Hand weapons, if they are light add +2 to counteract the penalty, if they are 1 handed add +4 to counteract the penalty.
foreach pick in hero from BaseWep where "Hero.OffHand & !Hero.MainHand"
if (eachpick.tagis[wClass.Light] <> 0) then
eachpick.field[wAttBonus].value += 2
elseif (eachpick.tagis[wClass.OneHanded] <> 0) then
eachpick.field[wAttBonus].value += 4
endif
nexteach
Lawful_g is offline   #1 Reply With Quote
Bidmaron
Senior Member
 
Join Date: Dec 2010
Posts: 468

Old February 4th, 2011, 02:07 PM
Wow, I kneel at the feet of a Herolab master. Impressive.
Bidmaron is offline   #2 Reply With Quote
Kendall-DM
Spy
 
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220

Old March 2nd, 2012, 11:46 AM
I just finished doing my version of the Marilith, and I decided to see if anyone else had done one. Of course, I should have realized that Lawful_g had, since he had been working on the d20 monsters. Anyhow, I wanted to put my version up here. We pretty much selected the same timing, nice coincidence.

And my version has a small error, once I sort that out, I'll put it back up. UPDATE: Turns out it wasn't an error with my code, it's an error in HeroLab itself processing the multiweapon fighting feat incorrectly when a light weapon is equipped in an off hand and a one-handed weapon is in the off hand. It's defaulting on the main hand weapon to the light weapon penalties, when it should still be giving the one-handed weapon penalty.

Code:
~ Adjust our attack bonus with multiweapon fighting.
doneif (#hasfeat[fMultiWep] = 0)

var flag as number
flag = 0
foreach pick in hero from BaseWep where "Hero.MainHand"
  foreach pick in hero from BaseWep where "!Hero.MainHand & Hero.OffHand"
    flag = 1
  nexteach
nexteach
doneif (flag = 0)

flag = 0
foreach pick in hero from BaseWep where "!Hero.MainHand & Hero.OffHand"
  if (each.tagis[wClass.Light] <> 0) then
    each.field[wAttBonus].value += 2
  elseif (each.tagis[wClass.OneHanded] <> 0) then
    each.field[wAttBonus].value += 4
    flag = 1
  endif
nexteach

foreach pick in hero from BaseWep where "Hero.MainHand & !Hero.OffHand"
  if (flag = 0) then
    each.field[wAttBonus].value += 2
  else
    each.field[wAttBonus].value += 4
  endif
nexteach

Last edited by Kendall-DM; March 2nd, 2012 at 01:12 PM. Reason: Error.
Kendall-DM is offline   #3 Reply With Quote
Reply


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 12:39 PM.


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