• 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

Another Dumb Question (about usrIndex!)

Jaunt

Member
So, I'm trying to make it such that a race gets a bonus to either Charisma or Intelligence. I've set up the array-based menu just fine, but I'm trying to steal the code from +2 attribute boost. However, that code fails because usrChosen1 is where it goes when you do it the way the existing attribute boosts do, and usrIndex seems to be where it goes when you're using an array based menu.

That said, I have no idea how to interact with usrIndex. This is what I've got, I'm relatively sure most people who read this will laugh and then be able to easily tell me how to fix it:

Code:
   field[usrIndex].value.field[aStartMod].value += 2

The error I get is that only derived fields can be modified. Thanks in advance.
 
Why are you using an array-based menu? Is it because you're not sure how to cut down the choices available with usrChosen1? We can show you how to do that, but I want to make sure I understand your problem first.
 
Yes. The presets are all like "attributes" "mental attributes", "physical attributes" and so forth. I need to cut my choice down to INT/CHA. Thanks!
 
So the field you'll be using here is usrCandid1. Also, I'm not in front of my HL machine at the moment so I may get some minor details wrong. Finally, I'm assuming you've turned on file debugging (do that if you haven't already, it's in the Develop menu).

Some background info: You know the dropdown in the editor that lets you set up pre-baked selection sets like "Attributes" or "Exotic Weapons"? Those choices are really just shortcuts that cause usrCandid1 to be auto-loaded with some string that matches a frequently-used set of choices. But you can also ignore that selector and put any tag expression you want/need into usrCandid1.

I know I said you can ignore the selector, and you eventually will, but first set it to "Mental Attributes" and compile the data. Then look at the character, right-click the ability with the selector, and choose "View Fields for [abilityID]". In the window that appears, scroll down until you find usrChosen1. Take a look at the string in its value column, copy it down somewhere. The tag expression is what tells the ability "Only show things whose tags match these specific criteria". This is your starting point.

Next, you'll need to make the expression a little more specific. What you're looking to do is take the existing tag expression and add a clause that means "either INT or CHA". Right-click your character's INT or CHA on the character sheet and choose "View tags for [attribute]". There's a lot of tags that you could use here, I usually use the IsAttr tag. You'll see that INT has IsAttr.aINT and CHA has IsAttr.aCHA.

Check out this page for a primer on how tag expressions work. If you've done any kind of programming it'll probably be fairly intuitive, if not then it might seem a bit foreign at first but it's not too bad.

Now you have what you need to restrict the choices by building a tag expression and putting into the usrCandid1 field for your ability. Give it a try and let us know if it works, or if you need some more help.
 
Thanks, both of you. So I punched in some things hoping it was really that simple, but it seems that I'm still missing some things. The pre-filled custom expression for "mental attributes is:
Code:
component.BaseAttr & AttribCat.Mental

That works. Here's what I've tried:
Code:
component.BaseAttr & IsAttr.aINT
component.BaseAttr & IsAttr.aINT | IsAttr.aCHA
IsAttr.aINT

That doesn't seem to be chopping the choices down at all. I tripled checked my capitalization. The first attempt was just aping the "mental attributes" prefill, the second was just in case the editor quietly laughs at me unless there's at least 2 valid options. The third is just to see if I can force it to work using the simplest possible expression of what I'm changing from the working example.

Any thoughts about what I'm doing wrong?
 
It looks like using a selection helper (the "Select From..." dropdown in the editor) overrides a custom value in the usrCandid1 field. I could have sworn it was the other way around. Regardless, what you need to do now is set that dropdown back to "None".

After that, your second tag expression should work, because it's working for me when I test it. Technically, it should probably be "component.BaseAttr & (IsAttr.aINT | IsAttr.aCHA)" (note the parentheses), but what you've written worked fine for me too.
 
Back
Top