LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   How to access the party info now available? (https://www.lotrointerface.com/forums/showthread.php?t=1636)

KRc 10-02-2011 08:25 PM

How to access the party info now available?
 
I can't seem to get a list of party members in a fellowship. I can get the number of members and info about the leader (such as the name), but nothing about the non-leader members of the group. How does it work?

It's driving me crazy. :confused:

Is there any place where the new RoI lua been documented?

Garan 10-02-2011 10:13 PM

Once you get the Party, you simply call GetMember() to get a PartyMember object which has the same methods as the Player object:
GetName()
RegisterForClickHandling()
GetBaseMaxMorale()
GetBaseMaxPower()
GetEffects()
GetLevel()
GetMaxMorale()
GetMaxPower()
GetMorale()
GetPower()
GetAlignment()
GetClass()
GetParty()
GetRace()
GetReadyState()
IsLinkDead()
IsVoiceEnabled()

for example, the routine below will list the party member names and class codes.
Code:

local localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
local party=localPlayer:GetParty();
if party~=nil then
  local memberIndex, member;
  for memberIndex=1,party:GetMemberCount() do
    member=party:GetMember(memberIndex);
    Turbine.Shell.WriteLine("Member("..memberIndex..") Name:"..member:GetName().." Class:"..member:GetClass())
  end
end


MrJackdaw 10-03-2011 12:37 AM

I didn't know you could get the effects on the party - this makes a huge difference. Buff helpers could now be a clear reality, with a whole heap of effort that is. Can you also register for when a party members buffs change?

Garan 10-03-2011 07:29 AM

Quote:

Originally Posted by MrJackdaw (Post 7183)
I didn't know you could get the effects on the party - this makes a huge difference. Buff helpers could now be a clear reality, with a whole heap of effort that is. Can you also register for when a party members buffs change?

I haven't played with the Party stuff at all yet. I imagine that since the PartyMember has the same exact Methods as Player, it is probably an extension of Player, so it probably inherits the same Event handlers.

EDIT: I did get to test it with PowerChanged() and the event fired properly (each member had to have a separate event handler). I'm not sure how you would go about managing adding and removing the event handlers unless there is a Party:MemberJoined() event or something. Unfortunately, possible Events are a lot harder to locate than Methods - Lua provides the names of the Methods in each objects' metatable.

KRc 10-03-2011 08:20 AM

Thank you so much! I'd gone so far down meandering roads I doubt I could have come back to anything so simple by myself. What a relief.

*Wipes brow and gets on with things.*

Garan 10-03-2011 08:44 AM

Quote:

Originally Posted by KRc (Post 7186)
Thank you so much! I'd gone so far down meandering roads I doubt I could have come back to anything so simple by myself. What a relief.

*Wipes brow and gets on with things.*

PS though, a little typo in your example: you need to change tmpIndex to memberIndex in the line:

Code:

Turbine.Shell.WriteLine("Member(".. tmpIndex ..") Name:"..member:GetName().." Class:"..member:GetClass())
Regardless, it worked great.

Thanks for catching the typo. It's a pain copying and pasting from my Interactive Debug window so I got lazy and retyped it.

I accidentally made a slightly misleading statement earlier, while PartyMember has the same methods as Player, it isn't because it inherits from Player, more likely it inherits from Actor. If you want to see the Methods and Events that are likely available on the PartyMember, you should probably look at the Actor object in the Turbine Lua API docs.

MrJackdaw 10-03-2011 09:14 AM

*Avoids temptation to start working on yet another plugin*

Damn you Garan, for giving me this info... *AGH!*

:)
.
.
.
*Still tempted*

Garan 10-03-2011 10:36 AM

Quote:

Originally Posted by MrJackdaw (Post 7188)
*Avoids temptation to start working on yet another plugin*

Damn you Garan, for giving me this info... *AGH!*

:)
.
.
.
*Still tempted*

LOL :) Yeah, I know. I am suffering from Potential Plugin Syndrome (PPS) myself. So MANY possibilities, so little time. Despite the fact that I was disappointed that we can't equip items programatically, I am sort of relieved since it allowed me to put at least one of those many, many ideas back on the back burner.

KRc 10-03-2011 12:08 PM

Quote:

Originally Posted by MrJackdaw (Post 7188)
*Still tempted*


You knew it was there...you know you want it... The party member stats — they taunt you!

:D

Pengoros 10-03-2011 02:25 PM

I've been waiting on the docs to see if there is an event for party member joined/left. Otherwise the only alternative is to poll the fellowship every so often which seems suboptimal.


All times are GMT -5. The time now is 11:32 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI