Jump to content

Recommended Posts

  • 2 weeks later...

You only need to add the code below to your fight class and active the spell "--iron trap" in the options of yout fight class settings.

Then create a simple profile for your favorite farmplace.

Mabe you have to add the id of the mob you want to trap in the variable KillBeast

    <FightClassSpell>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>
local function UseContainerItemByName(search)   --[[ needed below ]]
  local found=nil;
  for bag = 0,4 do
    for slot = 1,GetContainerNumSlots(bag) do
      local item = GetContainerItemLink(bag,slot)
      if (item and item:find(search)) then
		if (GetContainerItemCooldown(bag,slot)==0) then
			UseContainerItem(bag,slot)
			found=1;
		end
      end
    end
  end
  return found;
end

if UnitExists("target") and not UnitIsFriend("player", "target") then 
	if not IsStealthed() then 
		local goodMountBuff={164222,165803}
		local goodMount=false
		for n=1,#goodMountBuff do goodMount=goodMount or (UnitBuff("player",GetSpellInfo(goodMountBuff[n]))~=nil); end
		if (not IsMounted()) or goodMount then
			local guid=UnitGUID("target");
			local type, zero, serverId, instanceId, zoneId, npcId, spawnUid = strsplit("-",guid);
			npcId=tonumber(npcId);

			--[[ Add your Mob-IDs to the list ]]
			local KillBeast="86932,87020,87021,86727,86730,86731"		--[[ list of ID's of Mobs to trap, comma seperated ]]
				
			local maxHealth=95;				--[[ start Trap at 95% of health for non-elite Mobs ]]
			if (UnitClassification("target") == "elite") then
				maxHealth=55				--[[ start Trap  at 55% of health if it is an Elite Mob ]]
			end
			if not (UnitIsPVP("target")) and ((UnitHealth("target") / UnitHealthMax("target") * 100) &lt; maxHealth ) and (string.find(','..KillBeast..',',','..npcId..',')) then
				if (UnitName("player")==UnitName("targettarget")) then   --[[ no Ninjaing, my Mob, my target, my trap ]]
					result=true
					if not (UseContainerItemByName(":115010:")) then			--[[ Level 3 Trap must be equiped and ready]]
						if not (UseContainerItemByName(":115009:")) then		--[[ Level 2 Trap .. ]]
							if not (UseContainerItemByName(":113991:")) then	--[[ Level 1 Trap .. ]]
								result=false
							end
						end
					end
				else						--[[ the fight is over, or another User fight to them ]]
					ClearTarget();
				end
			end
		end
	end;
end
</LuaScript>
            <VarRet>result</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>--Iron Trap</SpellName>
      <Priority>24</Priority>
      <CombatOnly>false</CombatOnly>
      <CastIfMounted>true</CastIfMounted>
      <CheckIfKnow>false</CheckIfKnow>
      <CheckIfSpellUsable>false</CheckIfSpellUsable>
      <CheckSpellDistance>false</CheckSpellDistance>
      <CheckIfView>false</CheckIfView>
      <AddToSettings>true</AddToSettings>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
    </FightClassSpell>

Thanks for the help with this, I did get this to work, but I should mention, since currently i have a lvl 2 barn i had to replace "Iron trapper" with "Improved Iron Trapper" in the code above to get this to work. Thanks again for the assist.  :)

looks great I am new to this I have tried to add those lines to the bottom of the Hunter - BeastMasterHunter 3.0.xml but I keep getting xml errors please help what am I doing wrong I went to the file location were the Hunter - BeastMasterHunter 3.0.xml is and clicked edit and tried to add it to the bottom of it and saved it as Hunter - BeastMasterHunter 3.0trapper.xml. I know it has to be something I am doing wrong here but have no clue as to what it is. Thank you bugreporter for your help on this

Thanks for the help with this, I did get this to work, but I should mention, since currently i have a lvl 2 barn i had to replace "Iron trapper" with "Improved Iron Trapper" in the code above to get this to work. Thanks again for the assist.  :)

The text Iron trap are only a comment. All 3 Traps are supported without any changes.

  • 1 month later...

I have another question.  I noticed that if im farming with an alt and he has aggro, my farming toon will deselect the target and will not lay a trap.  How can I change this behavior. 

(I am not a coder, but i see the comment "no Ninjaing, my Mob, my target, my trap".  I'm assuming a change needs to occur around here I just dont know what.)

P.S.  This also happens when I stun a target with my rogue.

Edited by ernvato21

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...