• 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

Pulling a value from a chosen thing

Sendric

Well-known member
So now that I have the ability to choose spells working properly, I am trying to set up the DC for the spell chosen. This isn't a huge deal imo, but it would be nice if I could get it to work.

I am attempting to access the sLevel field of the chosen spell and set a variable equal to it with this:

Code:
SL = field[usrChosen1].chosen.field[sLevel].value

However, this always returns 0 regardless of the level of the spell chosen. There are no error messages. Is it possible to pull this info or am I just not scripting it correctly? Note that I am using a Class Special, hence why "usrChosen1" is being used here.

Also of note may be the debug output for SL shows this:

Code:
[Unnamed 1.1] 0

I don't recall ever see the Unnamed part in debug output before
 
Code:
[Unnamed 1.1] 0

I don't recall ever see the Unnamed part in debug output before

If you're debugging while there are multiple characters in a portfolio (like hero + animal companion), it will put the name of the particular character where the debug is running in square brackets, so you can tell where to look.
 
If you're debugging while there are multiple characters in a portfolio (like hero + animal companion), it will put the name of the particular character where the debug is running in square brackets, so you can tell where to look.

Ah. That makes sense.
 
I always use priorities with at least 4 digits, usually 5. There may still be internal calculations going on at 101 in any phase.

Try some other phases. Final would be the first one I'd try.
 
I always use priorities with at least 4 digits, usually 5. There may still be internal calculations going on at 101 in any phase.

Try some other phases. Final would be the first one I'd try.

Gave the following a try:

Attributes/10000
Final Phase/10000
Render/10000

None of them worked. I had also previously tried an earlier time just to see, but that also hadn't worked.
 
sLevel is calculated and set at First/10000, so it's not the issue. This issue, unfortunately, is how you are using it. I know this, because I've tried several different methods of making a chooser (which is what you have here) and learned quite a bit. Choosers can be created on Custom Abilities, Class Specials, and Feats. Technically you can have a chooser on an Adjustment too, but you can't use a custom expression with it. If you have Traits & Flaws in your game, you can make a chooser with them, but I have no idea how they operate since I don't use them at all, and there could be limitations on how they are used.

Custom Expressions can have a chooser, but you have to have a field for allowing a number of custom abilities to activate them, which means it has to be a Class or it won't work at all. Unless it is class related, it simply can't be used as a generic chooser (it expects it to exist as a custom ability that is live on a hero).

Class Specials do the same thing, but don't require a field for the number of custom abilities. It needs to know a class and a class level to become active. So, assuming that you have no class input, it will never meet the requirements, because it is looking for a spell that has to have a class and class level on the hero that meets the requirements. Since no class is listed, it doesn't find anything. If you do list a class, it will work on that class and ignore other classes altogether. PITA I know.

So you are left with Feats, which is always what I use for the generic chooser, and for which no requirements are necessary. But you do have to bootstrap it to all the things that are going to use it. This is the only solution I've been able to do to make generic choosers work.

Not sure if this is the issue, it could be some kind of live state issue, but I wouln't know without knowing what exactly you are trying to achieve and how you are going about doing it.
 
Last edited:
I tried doing the same thing with a feat chooser, but that didn't work either.

I'm working on the Factotum class from Dungeonscape. It has an ability that allows it to choose any wizard spell (up to 7th level) and cast it as a spell-like ability. The DC is 10 + Int modifier + spell level. I was hoping to easily determine the spell level of the chosen spell so I can put the DC in the summary description. Frankly, it's not a big deal. I can always just require the user to know what level spell they are choosing and add it in themselves.

Anyway, the chooser works fine. I haven't yet looked into/determined how to either bootstrap the chosen spell or carry over the description. It might be necessary to find a way to bootstrap the spell before solving the DC problem.

The other problem I'll have to tackle once I tackle this is the ability to choose any 3 extraordinary abilities. I have the chooser working ok, but again, do I bootstrap the ability or just carry over the description? Can either actually be done?
 
Try this instead. Look for the tag sLevel.X, so you'll be looking at a possibility of 10 tags. Psuedo-coding here...

if (chosen.tagis[sLevel.0] <> 0) then
SL = 0
elseif (chosen.tagis[sLevel.1] <> 0) then
SL = 1
etc...
 
tagvalue[sLevel.?]

or

tagmax[], tagmin[]

(tagvalue will grab a random tag if there happened to be multiple tags with a value that fit the filter, but in this case, where there will never be more than one sLevel tag, it's faster for HL to execute than tagmax).
 
Last edited:
The other problem I'll have to tackle once I tackle this is the ability to choose any 3 extraordinary abilities. I have the chooser working ok, but again, do I bootstrap the ability or just carry over the description? Can either actually be done?

Don't make a chooser for this. This is easier done as a choice of custom ability (much like the rogue gets the special ability option). So each of the extraordinary abilities should be bootstrapped to a custom ability of the same name (make sure only one shows in the specials). Then allow the Factorum set its custom abilities available field at the right level and those choices should be there. I'd look at the rogue's special abilities for guidance on this.
 
Try this instead. Look for the tag sLevel.X, so you'll be looking at a possibility of 10 tags. Psuedo-coding here...

if (chosen.tagis[sLevel.0] <> 0) then
SL = 0
elseif (chosen.tagis[sLevel.1] <> 0) then
SL = 1
etc...

Nice. This works with the following code:

Code:
if (field[usrChosen1].chosen.tagis[sLevel.0] <> 0) then
SL = 0
elseif (field[usrChosen1].chosen.tagis[sLevel.1] <> 0) then
SL = 1
endif
 
tagvalue[sLevel.?]

or

tagmax[], tagmin[]

(tagvalue will grab a random tag if there happened to be multiple tags with a value that fit the filter, but in this case, where there will never be more than one sLevel tag, it's faster for HL to execute than tagmax).

This also appears to work:

Code:
SL = field[usrChosen1].chosen.tagvalue[sLevel.?]
 
Don't make a chooser for this. This is easier done as a choice of custom ability (much like the rogue gets the special ability option). So each of the extraordinary abilities should be bootstrapped to a custom ability of the same name (make sure only one shows in the specials). Then allow the Factorum set its custom abilities available field at the right level and those choices should be there. I'd look at the rogue's special abilities for guidance on this.

And lastly,

Yea, I was thinking this is what I was going to end up having to do. Seems like a huge project, but maybe it won't be as bad as it seems.

I've run out of time for the day, so I'll have to pick this back up next week. Thanks for your help, Kendall and Mathias.
 
tagvalue[sLevel.?]

or

tagmax[], tagmin[]

(tagvalue will grab a random tag if there happened to be multiple tags with a value that fit the filter, but in this case, where there will never be more than one sLevel tag, it's faster for HL to execute than tagmax).

Is there something similar that can pull text fields?

For instance, if I wanted to pull the description text of the chosen spell. This is what I started with:

Code:
field[CustDesc].text = field[usrChosen1].chosen.field[CustDesc].text

I tried a few different phases and priorities, but again, it doesn't seem to work. There are no errors reported.
 
Do you mean:

Code:
field[CustDesc].text = field[usrChosen1].chosen.field[descript].text

Very few things make use of CustDesc, so it'd be empty in most cases. That's why I'm wondering if you want to get the description of the chosen thing instead.
 
Do you mean:

Code:
field[CustDesc].text = field[usrChosen1].chosen.field[descript].text

Very few things make use of CustDesc, so it'd be empty in most cases. That's why I'm wondering if you want to get the description of the chosen thing instead.

Yes, I'm looking for the description. When I create a sorcerer and add a spell then right-click to look at fields, I see CustDesc is filled with the description text. I didn't see any other fields containing it, so that's what I went with. Your suggestion works. Thanks.
 
Back
Top