Quantcast
giving loot automatically to someone - WoWInterface
Thread Tools Display Modes
04-11-21, 04:52 AM   #1
Believe82
A Murloc Raider
Join Date: Sep 2020
Posts: 4
giving loot automatically to someone

Hi,

Apologies if this has been covered, but I ran google and searches and couldn't find anything.
So I very new to coding in lua, and I saw that if I want to give out loot to myself I can use:

Code:
local playerName = UnitName("player")
	SetLootMethod("Master",playerName,"2")
        for ci = 1, 40 do
        local mMaster = GetMasterLootCandidate(li, ci)
	     if mMaster == UnitName("player") then
	            GiveMasterLoot(li, ci)
	     end
	end
I would like to pass code to the addon using either a slash command + player name or slash command + selected player, so when I am the master looter all loot would go to that player.

this is the code I tried at the end of my slash command:

Code:
elseif input == "" then
        print("NLoot: Invalid Command, Input '/nl help' to get a list of available commands")
	else
		local rString = input
                for ci = 1, 40 do
                   local mMaster = GetMasterLootCandidate(li, ci)
	           if mMaster == rString then
	               GiveMasterLoot(li, ci)
	           end
                end
	end
But it returns an error.
Is there an easier way to do this?
Thank you for the help in advance.
  Reply With Quote
04-11-21, 06:59 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 817
Wouldnt it be easier to make him masterlooter?
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
04-11-21, 07:12 AM   #3
Believe82
A Murloc Raider
Join Date: Sep 2020
Posts: 4
Originally Posted by Rilgamon View Post
Wouldnt it be easier to make him masterlooter?
Not every loot goes to the person. The idea is for me or the person with the addon to be the Master looter and at the end the Raid leader only has the epic, rare loot and some other exceptions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » giving loot automatically to someone

Thread Tools
Display Modes

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