• 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

weapon focus prerequisite

psych777

Well-known member
i've got a feat that requires Weapon Focus (any crossbow or firearm) as a prerequisite.
i couldn't seem to find any tags or fields other than the actName, sbName or shortname that reference the weapon selected.
is there a way to specify which weapon is selected on Weapon Focus for a prereq validation?
or a weapon grouping (such as all crossbows and all firearms)?
 
Take a look at the feat "Aldori Dueling Mastery" for how you test for a specific weapon. Testing for a group of any crossbows would be a little harder but can be done.

Pre-Reqs
Code:
      ~ Default not valid
      @valid = 0

      var sTags as string
      var iX    as number
      ~ Build a search string of crossbow tags
      foreach thing in BaseWep where "wFtrGroup.Crossbows"
        ~ after adding the first tag add an "OR"
        if (iX <> 0) then
          sTags &= "|"
        endif  
        sTags &= eachthing.tagids[WepFocus.?]
        iX += 1
      nexteach

      ~ Check hero for any matching weapon focus tags. If we find
      ~ any of them we are valid.
      if (hero.tagsearch[sTags] <> 0) then
        @valid = 1
      endif
Above is an example. I have not actually tested it but it should work. That builds a list of all Weapon Focus tags for Crossbows and then does a tagsearch.

The really bad of this script is it is MASSIVE CPU overhead. Between the foreach and the tagseach. Then add in the Pre-Req that fires like 6 times and is BAD BAD BAD.

It will work. Honestly I think from a point of view of adding this the community stuff we would be better off just hard-coding the tests of the different crossbows that are already in the game. I can't see many or any more crossbows being added to the game.
 
looking at the Aldori Dueling Mastery was great hint.

so far this code seems to work (and how do you all keep getting the code in that separate 'box' in the post??):
(tagis[WepFocus.wCrsDouble] + tagis[WepFocus.wCrsHand] + tagis[WepFocus.wCrsHeavy] + tagis[WepFocus.wCrsLight] + tagis[WepFocus.wCrsRpHvy] + tagis[WepFocus.wCrsRpLgt]) <> 0

it validates on each of the separate crossbows.
how can i find a list of the firearms out there? when i did a search for crossbow i got all of the above (plus bolts) returned, but when i try searching 'firearm' i only get "Exotic Weapons: Firearms (wHdrFire)" and a bunch of bullets.
 
So take a look at the Exotic Weapon Prof (Firearms) feat (thingid.fExoticGun). It assigns a single tag to the hero you can check for. :)

To have code display in you use code tags around your stuff. You can do this by pressing the "#" image. Or put the code tags yourself. So you do this as follows:
{code}
{/code}
Just replace the { with [ to get it work. :)
 
so looking at Exotic Weapon Proficiency (firearms) it does say this:
Even though Exotic Weapon Proficiency (firearms) grants you proficiency with all firearms, when you take feats that modify a single type of weapon (such as Weapon Focus or Rapid Reload), you must still pick one type of firearm (such as musket or pistol) for those feats to affect.

so it sounds like the tag it gives the hero isn't quite specific enough for a weapon focus prereq. or am i reading too much into it?
 
The feat Prone Shooter from Ultimate Combat has this exact pre-req and is covered by

Code:
        ~search through all the crossbows and firearms (and maybe also slings)
        ~in the game, and compare them to the list of weapons we have weapon
        ~focus in - if there's a match, then we're valid
        foreach thing in BaseWep where "wFtrGroup.Crossbows | wCategory.Firearm"
          validif (eachthing.intersect[WepFocus,WepFocus] <> 0)
          nexteach
 
The feat Prone Shooter from Ultimate Combat has this exact pre-req and is covered by

Code:
        ~search through all the crossbows and firearms (and maybe also slings)
        ~in the game, and compare them to the list of weapons we have weapon
        ~focus in - if there's a match, then we're valid
        foreach thing in BaseWep where "wFtrGroup.Crossbows | wCategory.Firearm"
          validif (eachthing.intersect[WepFocus,WepFocus] <> 0)
          nexteach
Yep that would be a little better. I should have thought about using validif in the middle for the foreach loop. That way it ends as soon as it finds the very first crossbow or firearm.

That is one step better than building the whole list and checking all at once like I did. :p
 
Doesn't validif only finish if the result is true?

So the loop will find the first crossbow/firearm with weapon focus?
 
Back
Top