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
Degenpaladin
Junior Member
 
Join Date: Mar 2010
Posts: 4

Old August 19th, 2014, 07:44 PM
Im trying to code a new flaw, Elven Pride of Arms.

You only consider those weapons designed specifically for use by the noblest of elves to be fit to wield. Using any other object as a weapon is beneath your dignity.
Prerequisite: Elven blood.
Effect: You suffer a -4 penalty on attack rolls when using a weapon other than a longsword, rapier, or bow (long, short, or composite). Attacks made while fighting unarmed, touch attacks (including ranged touch attacks), or attacks made with natural weaponry also incur this penalty.
Suggested Class/Race: Elf
Source: Dragon Magazine #328 (Nobody’s Perfect – New Flaws for Nonhumans)

Im really at a loss on how to proceed and any help would be appreciated.
Degenpaladin is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old August 20th, 2014, 05:20 AM
I ran this at Post-attributes/12000:

Code:
foreach pick in hero from BaseWep where "!IsWeapon.wRapier & !IsWeapon.wLongsword & !IsWeapon.wLongbow & !IsWeapon.wShortbow"
 eachpick.field[wAttBonus].value -= 4
nexteach
To understand what's happening here, I'll break down the different sections and explain them.

Code:
foreach pick in hero from BaseWep
foreach loops go through the various "picks" on your character. A pick is basically anything your character has, from skills to ability scores to the various armor classes and of course weapons. BaseWep is a reference to a tag that all weapons have -- component.BaseWep. All things have component flags, and when you are doing a foreach loop you can use component flags to limit the searching. In this case, we only care about weapons, so we use this flag.

Note: To see flags on a weapon, you can right-click on them in the portfolio and select "Show Debug Tags for XXX"

Code:
 where "!IsWeapon.wRapier & !IsWeapon.wLongsword & !IsWeapon.wLongbow & !IsWeapon.wShortbow"
This part of the foreach statement defines which items you are looking for...or in this case which items to exclude. The "!" at the beginning means "not this", so this part is telling the foreach loop that any items with these tags are omitted from the search. Any weapons that don't have these tags will then be used for any scripting that takes place within the foreach loop.

Code:
eachpick.field[wAttBonus].value -= 4
This part just says that any pick that qualifies based on the restrictions we provided get a -4 to their attack bonus. Like tags, you can see the various fields on a weapon by right-clicking on it. In this case, we are using wAttBonus. We could have used the Penalty field, but that would have reduced both attack and damage from the item, which we don't want.

Code:
nexteach
This closes the foreach loop. It's essentially the same thing as endif for if statements, and is required to compile.

A couple of things to note. After I created this in the editor and added it to a portfolio it gave me a weird error about timing. The message suggests reloading the code, which I did and it seems to be fine now. Also, in regards to the weapon tags that I chose, these should also cover any composite bows, and any weapons that count the same as a rapier or a longsword for the purposes of proficiency (assuming they've been properly tagged).
Sendric is offline   #2 Reply With Quote
TobyFox2002
Senior Member
 
Join Date: Nov 2013
Location: Andover, Ma
Posts: 632

Old August 20th, 2014, 10:05 AM
I like this, I hope you consider adding and any other content you have made to the Community Files.
TobyFox2002 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 10:30 AM.


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