Thread Tools Display Modes
11-26-14, 02:37 AM   #1
alucard51
A Defias Bandit
Join Date: Nov 2014
Posts: 3
Add follower to garrison mission

Hi,

I've tried for a few days now to make my own add-on for the garrison mission UI. It is kind of a hobby to relax from the day job. but this hobby became very frustrating...

I got stuck on adding a follower to a mission. I checked what others have done, but I don't understand why it works for them. To be more precise, the calls to the functions GarrisonMissionPageSetFollower, GarrisonMissionPageAddFollower or directly CGarrison.AddFollowerToMission result in: usage error CGarrison.AddFollowerToMission(missionID, followerID)

I checked a hundred of times and it seems I do call the functions with the right arguments. I saw that it was reported as a bug on the beta version a few months back.

Any help?

Thank you all!
  Reply With Quote
11-26-14, 02:58 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by alucard51 View Post
I checked a hundred of times and it seems I do call the functions with the right arguments.
Post your code.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-26-14, 04:12 AM   #3
alucard51
A Defias Bandit
Join Date: Nov 2014
Posts: 3
Originally Posted by Phanx View Post
Post your code.
Hi Phanx, thank you for your reply.

Here is the part concerned:

Code:
local MissionPageFollowers = GarrisonMissionFrame.MissionTab.MissionPage.Followers;
for idx = 1, #MissionPageFollowers do
    GarrisonMissionPage_ClearFollower(MissionPageFollowers[idx])
end;

local MissionPageFollowers = GarrisonMissionFrame.MissionTab.MissionPage.Followers;
local missionID = "263"; local followerID = "207"; local missionID;
-- For now, I have been testing with 1 follower mission only. 
for idx = 1, #MissionPageFollowers do
    local follower = C_Garrison.GetFollowerInfo(followerID);
    local followerFrame = MissionPageFollowers[idx];
    if follower then
        GarrisonMissionPage_SetFollower(followerFrame, follower);
    end;
end;
I also tried running the GarrisonMissionPage_AddFollower(followerID) method with still the same usage error.

Even calling /run GarrisonMissionPage_AddFollower("206"); from the chat while on a mission gives the same result.

Do you have an idea on what is going on?
  Reply With Quote
11-26-14, 05:34 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Without actually testing anything, I'd assume your problem is related to passing strings -- eg. "263" -- instead of numbers -- eg. 263. Typically anything in the WoW API that asks for any kind of ID expects a number.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-26-14, 06:09 AM   #5
alucard51
A Defias Bandit
Join Date: Nov 2014
Posts: 3
I have to admit, my code is not the cleanest one...

But shouldn't it be possible for me to use a /run GarrisonMissionPage_AddFollower(460); while on a mission page to add the follower with ID 460?

Because even this gives me the same error.
  Reply With Quote
11-28-14, 02:06 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Just add hooks for each function you're interested in and print the arguments so you can see how the game is using them:

Code:
/run hooksecurefunc("GarrisonMissionPage_AddFollower", function(...) print("AddFollower:", ...) end)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-16-14, 09:17 AM   #7
rowaasr13
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 27
I'm pretty sure follower IDs are much longer, somewhat like GUIDs. Try /dump C_Garrison.GetFollowers() and look for .followerID fields.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Add follower to garrison mission


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