• 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

Prereq question

dartnet wrote:
>
>
> How do you set up a prereq that is:
>
> Race: Elf or Dwarf


The Dwarf and Elf races assign tags to the hero when they're present.
The tags are Race.Elf and Race.Dwarf. To check for those tags in a
prereq, you'd do this:

if (tagis[Race.Elf] <> 0) then
@valid = 1
endif
if (tagis[Race.Dwarf] <> 0) then
@valid = 1
endif

The first 'if' statement checks for the elf tag - the second checks for
the dwarf tag. If either is present, the validity is set to 1.


A shorter (but perhaps less clear) version of the same thing would be:

@valid = tagis[Race.Elf] + tagis[Race.Dwarf]

This works because tagis returns 1 if a tag is found, and 0 otherwise.
So if the "Elf" tag is present, this translates into:

@valid = 1 + 0

or simply

@valid = 1


Hope this helps,

--
Colen McAlister (colen@wolflair.com)
Chief Engineer, Lone Wolf Development
http://www.wolflair.com/
 
Back
Top