LUA question (UnitIsEnemy)

I tried to add UnitIsEnemy to trigger a raid warning scrip that otherwise works. I tried a couple different things and below is one of my attempts.

/run if UnitIsEnemy(target) then RaidNotice_AddMessage(RaidBossEmoteFrame, “ENEMY TARGETED”, ChatTypeInfo[“RAID_WARNING”])

UnitIsEnemy(”target”)

1 Like

Thank you Elvenbane.

Its not working for me. When i disable all addons I get a blank LUA Error window. I originally tried your solution and even: UnitIsEnemy(“target”,true). Not sure what else to try. I’m inserting the code directly from my macro in case I misspelled something.

/run if UnitIsEnemy(“target”) then RaidNotice_AddMessage(RaidBossEmoteFrame, “ENEMY TARGETED”, ChatTypeInfo[“RAID_WARNING”])

If it works for you then at least i know its an issue on my end.

Oh, my bad it’s a comparison of two units.
UnitIsEnemy("player","target")
https://wow.gamepedia.com/API_UnitIsEnemy

1 Like

I think i must have upset a gypsy or something cause its still not working. I disabled my addons again and still no go. Just to confirm i am targeting an enemy mob when i test this. Like before the error window is blank.

Here is what i have in case i mispelled something.

/run if UnitIsEnemy(“player”,“target”) then RaidNotice_AddMessage(RaidBossEmoteFrame, “ENEMY TARGETED”, ChatTypeInfo[“RAID_WARNING”])

Thanks for helping Elvenbane. If it works for you I’ll work on something else for awhile.

You’re missing end to close the if statement.

/run if UnitIsEnemy("player","target") then RaidNotice_AddMessage(RaidBossEmoteFrame, "ENEMY TARGETED", ChatTypeInfo["RAID_WARNING"]) end

The error makes it pretty clear lol

Message: [string "if UnitIsEnemy("player","target") then RaidNotice_AddMessage(Ra..."]:1: 'end' expected near '<eof>'
3 Likes

Thank you Elvenbane!