• 0

    posted a message on How to get gender of TargetInfo.HOSTILE_TARGET?
    I got the answer on another forum. The gender is encoded in the name. It actually ends with “^m”, “^M”, “^f”, or “^F”, but when you print the name in the debug screen the “^” and anything after it don't show up. I wrote the following function to get the target's gender:

    function VictoryCry.CalcTargetGender()
        local rawName = TargetInfo:UnitName(TargetInfo.HOSTILE_TARGET)
        local pos = rawName:find(L"^", 1, true)
        local rawGender = nil
        if pos then
            rawGender = rawName:sub(pos + 1)
        end
        if rawGender ~= nil and rawGender:upper() == L"M" then
            return GameData.Gender.MALE
        end
        if rawGender ~= nil and rawGender:upper() == L"F" then
            return GameData.Gender.FEMALE
        end
        return nil
    end


    -- Skoop
    Posted in: Need Help?
  • 0

    posted a message on How to get gender of TargetInfo.HOSTILE_TARGET?
    I'm writing an addon and I want to customize the message based on the gender of my target in RvR. Any idea how I can get this info?

    -- Skoop
    Posted in: Need Help?
  • To post a comment, please or register a new account.