• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Racial ability to provide weapon proficiency or weapon focus (timing issue?)

neoraistlin

New member
I'm a new user who's been hard at work coding a custom campaign into HL. I've really enjoyed he process and I've looked through the tutorials and many of the threads to get ideas and techniques. However, I've come to a section that I'm having trouble coding and would like some suggestions.

An ethnicity in our campaign gets the following "At First level, a Praethian
must choose between two kinds of Weapon Familiarity: either Lance or Praethian sarcissa (longhafted throwing axe) familiarity.Praethians who pick Lance familiarity receive the lance proficiency if they would otherwise be nonproficient and if they are already proficient, they receive the Weapon Focus: Lance feat".

So I've created the ethnicity under R Cust Special and bootstrapped the ability under Racial Special to the ethnicity. The eval script under the Racial Special is:

Code:
First/500
~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)

if (field[usrChosen1].chosen.tagis[thingid.wLance] <> 0) then
   if (#hasfeat[fWepMart] <> 0) then
      perform hero.assign[Custom.PraLanFoc]
   elseif (#hasfeat[fWepMart] = 0) then
      perform hero.assign[Custom.PraLanPro]
      perform hero.assign[WepProf.wLance]
   endif

elseif (field[usrChosen1].chosen.tagis[thingid.wPraSarc] <> 0) then
   perform hero.assign[Custom.PraSarc]

endif

No matter how I test for martial weapon prficiency (#hasfeat[fWepMart] or Hero.ProfMart) it always fails. I suspect that it is a timing issue because I read somewhere that the feats and proficiencies are not added until around 2500 priority?

I know I could get it to work from a configurable, but I would really like the selector to appear under the racial section of teh background tab and that is why I have it set up like I do now. Is there any work around to make this work?
 
#hasfeat checks for a tag which isn't added until way late, it's pretty much not an option for eval scripts (though frequently used for expr-reqs).

I'd use either hero.childlives[] or hero.findchild[]. Both are a bit costly, but most other things won't work at First 500.
 
Thanks so much, that works perfectly! I really love the community here (been lurking for a while).

I do have a followup question. I have a different ethnicity who gets the same selection, but with scimitar. Since scimitar can potentially be a deity's favored weapon or racial bonus weapon, I cannot rely on a feat check like in the above script. Is there anyway to check directly for WepProf.wScimitar anywhere from First/100 to First/2300? When I look through the deity Serenrae for examples it appears the WepProf is added through DeityWeap so theres no other tag for me to use that would be universal except for WepProf.wScimitar, which does appear in the hero tag list, but I just fon't know how to query for it.

I've tried hero.childlives[WepProf.wScimitar] and hero.findchild[WepProf.wScimitar] but to no avail.
 
Well, fortunately, the character can only have 1 diety and 1 race so that simplifies things

Unfortunately, the most common class special which grants the deities weapon proficiency is the cleric ability, which has to run after archetypes have a chance to replace it (at First 10000, too late for your purposes), so if you want to check for it things get a bit messy.

First 1500
Code:
var checkdei as number

~ If we have cleric levels, then we need to check the deity by default, so set our variable to 1
if (#levelcount[Cleric] <> 0) then
  checkdei = 1
  endif

~ Cycle through our archetypes and check if any of them replace the "Deities Favored Weapon" class ability. If so, don't check our deity (set the variable to 0)
foreach pick in hero from BaseVary where "AbReplace.cClrDeiWep"
  checkdei = 0
  nexteach

~ Even though our variable may be 0, it's possible something else might be granting the deity favored weapon (for example, the Graven Guardian race grants this ability), so check for the tag on the hero as well.
if (checkdei + hero.tagis[Hero.DeityWeap] <> 0) then
  perform hero.findchild[Deity].setfocus

  if (focus.tagis[WepProf.WHATEVERWEAPONPROFICIENCYYOUSEEK] <> 0) then
    DO WHATEVER
    endif
  endif

I think that should catch most instances, but as always, no assurances on the code, test and tweak as needed.

For the race, you'd need to do something similar, but probably simpler. The core races have their racial weapon proficiencies separated out onto racial specials (so that they can be replaced by certain ARTs), but I don't think any of them grant Scimitar proficiency. Because of that you needn't worry about the replacements, you can probably just use a findchild and set the focus to the race, and then check for the WepProf tag you seek there.
 
A note, childlives[] checks for a certain pick being present and live, it can't check for a tag like WepProf.wScimitar.

findchild has 2 elements to it. The first is mandatory and consists of the Component (components are types of things with a shared set of behaviours) of things you want to search in. The second part is a tag expression which further narrows the options within a component. For components which only ever have a single pick on the hero (like Races and Deities), you can omit the second part, like so:

hero.findchild[BaseRace].field[WHATEVER].value

For anything with multiple members of the component present, you need the second part (or you'll end up with the findchild picking one at random). For example, this findchild searches among the class abilities (component BaseClSpec), finds the bardic lore special which is bootstrapped to the Bard class at 5th level, and then performs a tagreplace so that it is now bootstrapped at 2nd level.
perform hero.findchild[BaseClSpec,"thingid.cBrdLore & SpecSource.cHelpBrd & ClSpecWhen.5"].tagreplace[ClSpecWhen.5,ClSpecWhen.2]
 
Back
Top