Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - 4th Edition (http://forums.wolflair.com/forumdisplay.php?f=60)
-   -   Scripting Question (http://forums.wolflair.com/showthread.php?t=42387)

DMayhew469 March 12th, 2013 05:58 AM

Scripting Question
 
Using the code below does anyone know how to access the enhancement bonus of each weapon? For example, if the pick is a +3 longsword I want to pull the "+3" from the data.


var EnhBonus as number
foreach pick in hero from WeapMelee
EnhBonus = eachpick.field[??????].value
nexteach

MagicSN March 16th, 2013 06:49 AM

Quote:

Originally Posted by DMayhew469 (Post 148852)
Using the code below does anyone know how to access the enhancement bonus of each weapon? For example, if the pick is a +3 longsword I want to pull the "+3" from the data.


var EnhBonus as number
foreach pick in hero from WeapMelee
EnhBonus = eachpick.field[??????].value
nexteach

For a non-weapon Magic Item (Implement) you would use mgBonus. Sadly this does not work for Weapons. It seems to me that wpDamage should work for Weapons, but I am not 100% sure if nothing asides from the Enhancement Bonus modifies this field.

Alternatively (if you know what type of weapon this is) you might check for relevant thingid's (admitted, this would be an extremely clunky and badly maintenancable way of handling this)

Best regards,
MagicSN

DMayhew469 January 20th, 2015 06:28 AM

I know it's been a while but I'm back to working on the inherent attack bonus script. Here is what I have:

~Inherent Attack Bonus

var AttBonus as number
var BonusDif as number

if (#level[] < 2) then
AttBonus = 0
elseif (#level[] < 7) then
AttBonus = 1
elseif (#level[] < 12) then
AttBonus = 2
elseif (#level[] < 17) then
AttBonus = 3
elseif (#level[] < 22) then
AttBonus = 4
elseif (#level[] < 27) then
AttBonus = 5
else
AttBonus = 6
endif

~doneif (tagis[Equipped.Equipped] = 0)
foreach pick in hero from WeapMelee
perform eachpick.field[wpDamage].modify[+,AttBonus,""]
perform eachpick.field[wpBonus].modify[+,AttBonus,""]
nexteach

foreach pick in hero from WeapRange
perform eachpick.field[wpDamage].modify[+,AttBonus,""]
perform eachpick.field[wpBonus].modify[+,AttBonus,""]
nexteach

This works fine as long as you don't add an actual magic weapon. I need a way to get the wpBonus of the current pick and then compare it to the AttBonus do determine wich bonus to use in the modify section. I have tried the following:

CurrentValue = eachpick.field(wpBonus)
CurrentValue = eachpick.field(wpBonus).value

Neither worked. Does anyone know how to get or reference that value inside the foreach loop?

Thanks


All times are GMT -8. The time now is 11:19 AM.

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