Page 1 of 1

is target in party?

Posted: Sat Sep 12, 2015 7:54 am
by noobbotter
How would i run a check for if my current target is in my party? I'm working on an auto buffing script and want to make sure that if I forget to join party that the bot won't spam party buffs.

Re: is target in party?

Posted: Sat Sep 12, 2015 8:53 am
by Bill D Cat
This is completely untested, but I think most of it is correct. It should at least get you going in the right direction.

Code: Select all

local _targetInParty = false
local _numInParty = RoMScript("GetNumPartyMembers()")
if _numInParty > 1 then -- A party of one is just you.  But most likely if you are not in a party then the value will be 0.
   for _loop = 1, _numInParty
      local _partyMember = RomScript("GetPartyMember(".._loop..")")
      if player:target.Name == _partyMember then -- Not sure if this is correct to get the name of your target.
         _targetInParty = true
      end
   end
end
     

Re: is target in party?

Posted: Sat Sep 12, 2015 5:41 pm
by lisa
Also untested, should work fine for a party, I believe they changed how memory works for raids but I can't remember.

Code: Select all

player:updateTargetPtr()
local target = CPawn(player.TargetPtr)
if target and target.InParty == true then 
--means your target is in your party.

end

Re: is target in party?

Posted: Fri Oct 02, 2015 5:52 am
by kenzu38
Or this function. You just have to get the name of your target.

EDIT: Yep, just tested.

This works:

Code: Select all

local name = player:getTarget().Name; 
if name ~= "<UNKNOWN>" and RoMScript("InPartyByName('..name..')") then