• 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

Race PreReq

Angela2013

Well-known member
I was putting some flaws in and one of them had a prerequiste by being either a half-elf or a half-orc. I thought I had seen somewhere on how to do this under Expr-reqs like this:

#hasrace[rHalfElf] | #hasrace[rHalfOrc] <> 0

but it is not working. Any ideas?
 
Use the + sign instead of |

#hasrace[rHalfElf] + #hasrace[rHalfOrc] <> 0

EDIT: last line removed to reduce confusion due to my being factually incorrect
 
Last edited:
The | is an "or", so you were telling it "if either of these is invalid, give an error". Since you can't have two races, you are guaranteed an error
Um actually you can't use "|" in an IF statement in HL. That only works when doing searches or loops.

By putting the + you are adding together the return value of both macros and saying if either one is true then then whole thing is true. In essence saying if either a Half-Orc OR Half-Elf.

In example:
Race is a Half-Orc you get an answer back of "0 + 1 <> 0" which is true.
Race is a Half-Elf you get an answer back of "1 + 0 <> 0" which is also true.
Race is a Dwarf you get an answer back of "0 + 0 <> 0" which is false.

If you wanted to do this as a AND statement instead of OR you would have to use a Pre-req script like so. In this case saying you are both a dwarf and elf. Yea I know it can't actually happen its just an example. :p

Code:
@valid = 0
~ Check if we are a elf
If (#hasrace[rElf] <> 0) Then
   ~ Check if we are also a dwarf
   if (#hasrace[rDwarf] <> 0) Then
      @valid = 1
   Endif
Endif
 
I'd never tried it so I wasn't sure. prob shoulda stuck with just the first line but then I just had to keep talking and try to sound smart...

:-p
 
ShadowChemosh - you can use |:

if (hero.tagexpr[HasRace.rElf | HasRace.rDwarf] <> 0) then

will get you the same effect as

if (#hasrace[rHalfElf] + #hasrace[rHalfOrc] <> 0) then

You could also use

if (hero.tagexpr[HasRace.rElf & HasRace.rDwarf] <> 0) then
 
ShadowChemosh - you can use |:

if (hero.tagexpr[HasRace.rElf | HasRace.rDwarf] <> 0) then
To be clear yes it works with a Tag Expression but not when doing:
Code:
#hasrace[rHalfElf] | #hasrace[rHalfOrc] <> 0
correct?

I was trying to give a way of doing OR using #hasrace[] instead of showing a totally different method.
 
Correct - #hasrace[XXXXX] is hero.tagis[Race.XXXXX], so by replacing tagis with tagexpr, you get the option to construct an expression that you can test for, instead of testing for the simple presence of a tag.

(Ignore the HasRace tags in my earlier post - I should have typed Race).
 
Back
Top