• 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

Help with preq script

Kaleb

Well-known member
I am doing an alternate Pack flanking feat just changing the Prerequsites
new ones are Int 13 Pack Flanking and any other Teamwork feat. The 13Int is already taken care of.

How do I write the portion of the script for any other one teamwork feat?
 
Looks like HL assigns fCategory tags to the hero from all the feats they have. So if you check for fCategory.Teamwork, that should take care of it.
 
if that hero check doesn't work do a
Code:
foreach pick in hero from BaseFeat where "fCategory.Teamwork"
  @valid = 1
  nexteach

which should also work (assuming the tag is right)
 
This will also work

Code:
validif (hero.haschild[BaseFeat,"fCategory.Teamwork & !Helper.Helper & !Helper.Obsolete"] <> 0)

Avoids the foreach which can be expensive in CPU cycles. The last two tags are good to have to avoid counting feats that may be working internally as helpers or that have been made obsolete.
 
frumple - findchild (I think you've got a typo in yours, using "haschild") is about the same cost as foreach, so yours isn't much different from AndrewD2's in terms of the CPU cycles.
 
Mathias - haschild is a lot like findchild but instead of taking you too the fields or accessing tags on the pick it just returns 0/1 like a tagis for a tag.
 
Ok so which one returns the count of number of children that matches the conditions in the brackets, findchild or haschild. I thought findchild was a simple 0/1 and haschild returns a count, correct?
 
findchild lets you transition to an item via search, haschild is a 0/1 like childlives is a 0/1, the only counting I know is either using a foreach to count the number of times an item shows up or using tagcount[] and counting a tag.
 
Ok then the wiki is wrong. It says "Returns the number of child picks within the container that match the tag expression given by str."

To me that implies a count.
 
You may be right, I've only ever tested it for if it had more than 0, guess some debug checks could work.
 
OK I just tested it and it should have returned the number of "Active Skills" on my Shadowrun character and it only returned 1 so I assume it's a 0/1
 
Yeah, unfortunately that is only useful in the case where I know the id. I believe you cannot use childcount dynamically, i.e. pass it the id in a variable.

So this will not work
Code:
var myID as string
var count as number
myID = hero.findchild[xxxx,yyyyy].idstring
count = hero.childcount[myID]
 
nope, you could use tagcountstr (I think) to find that, but the find child as Matias says is just as intensive as a loop, you might as well just use what I wrote earlier except make an incrementer variable and then validif (incrementer >= XXX)
 
Back
Top