Thread Tools Display Modes
10-11-06, 05:16 PM   #1
Xerogen
A Deviate Faerie Dragon
 
Xerogen's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 16
Feign Death troubles...

Alright, im fairly new to coding although im use to some LUA coding (mainly RDX bossmods) so i know some of the stuff. I browse through WoWWiki LUA events/api and their XML guides, but i always end up with trouble. One thing that has been pestering was my Hunter Feign Death retarget.

Here is the code:

Code:
local tarClass, engClass = UnitClass("target");

function Test_OnLoad()	
	this:RegisterEvent("PLAYER_TARGET_CHANGED");
	if( DEFAULT_CHAT_FRAME ) then
		DEFAULT_CHAT_FRAME:AddMessage("Retarget Loaded");
	end
end

function Test_OnEvent()
	if (engClass == "HUNTER") and UnitCanAttack("target", "player") then
	if (event == "PLAYER_TARGET_CHANGED") then TargetLastTarget();
	end
end
Alright, I can get it to start up fine, no errors or anything, but when I duel a hunter and he feign deaths, nothing happens. It just doesnt retarget like it should. Im just wondering what im doing wrong.

Here is my XML incase it may be this:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="Test.lua"/>
<Frame name="TestMainFrame" parent="UIParent" hidden="true">
	<Scripts>
		<OnLoad>Test_OnLoad();</OnLoad>
		<OnUpdate>Test_OnUpdate();</OnUpdate>
		<OnEvent>Test_OnEvent();</OnEvent>
	</Scripts>
</Frame></Ui>
  Reply With Quote
10-18-06, 07:20 AM   #2
Zeksie
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 24
Originally Posted by Xerogen
Alright, im fairly new to coding although im use to some LUA coding (mainly RDX bossmods) so i know some of the stuff. I browse through WoWWiki LUA events/api and their XML guides, but i always end up with trouble. One thing that has been pestering was my Hunter Feign Death retarget.
You're probably getting some issues with variable latency in WoW's systems. So sure enough you'll get the target changed event, but the server hasn't yet informed the client that the target is not really dead and can attack you, so UnitCanAttack is not being entirely accurate at that point.

You'd need to print out the results of each of your logical tests when a hunter FDs to see if this is true though.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Feign Death troubles...


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off