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 & !Her
ffHand"
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 "Her
ffHand & !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
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 & !Her

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 "Her

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