• 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

"Its effects do not stack. Each time it applies to a different creature type."

Redcap's Corner

Well-known member
"Its effects do not stack. Each time it applies to a different creature type."

I have a non-unique custom ability (cEnsCoSpe), where the user has to pick a different creature type each time they select it. They choose from appropriate creature types, which are worked out and displayed in an array at First/500. That part's working. I've come up with the following evalrule at First/600:

Code:
if (hero.tagcount[HasAbility.cEnsCoSpe] > 1) then
  perform setfocus
  foreach pick in hero where "thingid.cEnsCoSpe & !state.isfocus"
    if (compare(eachpick.field[usrSelect].text, focus.field[usrSelect].text) <> 0) then
      @valid = 1
    else
      @valid = 0
      endif
    nexteach
else
  @valid = 1
  endif

So far no results have been yielded. Any thoughts on what I'm doing wrong?
 
I have a non-unique custom ability (cEnsCoSpe), where the user has to pick a different creature type each time they select it. They choose from appropriate creature types, which are worked out and displayed in an array at First/500. That part's working. I've come up with the following evalrule at First/600:

Code:
if (hero.tagcount[[COLOR="Red"]HasAbility[/COLOR].cEnsCoSpe] > 1) then
  perform setfocus
  foreach pick in hero where "thingid.cEnsCoSpe & !state.isfocus"
    if (compare(eachpick.field[usrSelect].text, focus.field[usrSelect].text) <> 0) then
      @valid = 1
    else
      @valid = 0
      endif
    nexteach
else
  @valid = 1
  endif

So far no results have been yielded. Any thoughts on what I'm doing wrong?

The HasAbility tags are forwarded far too late to be useful in anything outside of validation elements such as expression requirements. You should be looking for Ability. tags instead, as those are forwarded early enough to work with.
 
Thanks! That's definitely useful to know. I've made that change, and am still playing around with other little tweaks, but the code still doesn't seem to be working. Is the "thingid.cEnsCoSpe & !state.isfocus" expression sound? Is setting a focus in order to exclude the live copy of the ability from the foreach statement a problem? I assume that foreach statements cycle through each search result one at a time, more or less independently, but I don't really know.
 
If this is a custom ability where the user has to select a creature type why aren't you just creating a configurable for it that uses creature types? Is this ability something that works like a ranger's favored enemy?
 
As a note, state.isfocus is a line of code, not a tag, so you can't use it in a tag expression.
 
If this is referring to Creature Type, with a capital T, like Undead, Humanoid, Outsider, etc. I recommend just making a single user-once selection for each type.

Think about how many options you're offering - if it's less than around a dozen, I recommend letting the user just choose from among several pre-defined selections, instead of adding a selection, and then filling something in.
 
That's definitely my fallback plan if I can't make this work, but I always hate those on the player end, so I'm trying to avoid it if possible. That's good to know about the focus issue. Maybe instead of using setfocus I should try assigning a custom tag.
 
Back
Top