Log in

View Full Version : Using group functions to get if player is in a group ect...


Astal
05-07-2011, 01:03 AM
Can anyone explain to me how this can be done? Basically this is what I have now and it dont work.

Im looking to see if player is in a group, if he is, get the group members and put em each in a variable. Then for each member update a task at the same time.

Since the tasks system doesnt have a way to do that.


sub EVENT_SAY
{
if($text=~/Hail/i) {
$member1 = $group->GetMember(1);
$member2 = $group->GetMember(2);
$member3 = $group->GetMember(3);
$member4 = $group->GetMember(4);
$member5 = $group->GetMember(5);
$member6 = $group->GetMember(6);
quest::shout("$member1 $member2 $member3 $member4 $member5 $member6");
}
}

joligario
05-07-2011, 01:34 AM
Look at the bic quest in qinimi on PEQ. I got all the group/raid members and pushed their names to an array. Mainly this portion:

...
$group = $entity_list->GetGroupByClient($client);
if ($group) {
for ($count = 0; $count < $group->GroupCount(); $count++) {
push (@player_list, $group->GetMember($count)->GetName());
}
...

sorvani
05-07-2011, 02:14 AM
this will fail if the people are in a raid group. at least it did for me when I played with getting the agnarr port up to work.

joligario
05-07-2011, 04:25 AM
I haven't heard of this failing. Agnarr port works off of getraid.. but I use this in the qinimi bic raid and it works fine there:

...
$raid = $entity_list->GetRaidByClient($client);
if ($raid) {
for ($count = 0; $count < $raid->RaidCount(); $count++) {
push (@player_list, $raid->GetMember($count)->GetName());
}
foreach $player (@player_list) {
$pc = $entity_list->GetClientByName($player);
$pc->MovePC(281,-521,36,-8,166);
}
...

joligario
05-07-2011, 05:17 AM
I will say that the group members must be in zone (not zoning) to catch each one.

sorvani
05-07-2011, 09:09 AM
The Agnarr code in the quest SVN doesn't work right. That's why I was playing with it. It builds the entity list but the raid members are not being moved.

edit to add: Removing the player.pl entirely the clicker still gets ported up so the door code is working just fine, which means it is only the player.pl which is failing. I put a bunch of emotes into the player.pl to verify what it was doing and it would emote back the entire array correctly, but it always stopped when using the movepc command.

edit 2: started new thread sorry to derail this one.

Astal
05-07-2011, 02:03 PM
np, this should help me out, i got a guy working with me thats better at coding than me somewhat. I think he can handle this with the help uve given me

Astal
05-07-2011, 07:28 PM
Is is possible to use $pc->quest::updatetaskactivity(504, 1,[1]);

like that?

with the $pc->?

joligario
05-07-2011, 10:14 PM
Not quite. If you are wanting to go around perl, the client has:

inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count)

So it would be $client->UpdateTaskActivity(taskid, activityid, count);
if you cast $pc to a client.

Astal
05-08-2011, 12:22 AM
Not quite. If you are wanting to go around perl, the client has:

inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count)

So it would be $client->UpdateTaskActivity(taskid, activityid, count);
if you cast $pc to a client.

thanks man, we have been working on this script all day and cant get it working right

joligario
05-08-2011, 12:31 AM
No prob. Anytime you want someone to look/troubleshoot, just post.

Astal
05-08-2011, 12:37 AM
Ok still having problems it doesnt trigger if im in a group or solo


$g = $client->GetGroup();
if(quest::istaskactive(504))
{
if(quest::istaskactivityactive(504,1)) {

if($text=~/Hail/i) {
quest::shout("Ahhh the orcses they are after meeez");
#despawn gollum and respawn him at the next location
quest::depop(999303);
#spawn orc lieutants
quest::spawn(999204,0,0,-866.3,357.1,90.3);
#spawn gollum in dif loc
quest::spawn(999303,0,0,-1023.7,-344.3,7.5);

if(!$g)# No Group
{
$c->UpdateTaskActivity(504, 1, [1]);
quest::shout("It works");
}

## Find Group Members
else
{
for($i = 0; $i < 6; ++$i)
{
$c = $g->GetMember($i);

if($c)
{
# Update the group task
$c->UpdateTaskActivity(504, 1, [1]);
quest::shout("It works");
}

}
}
}
}

joligario
05-08-2011, 01:06 AM
Try this:

$g = $client->GetGroup();

if(quest::istaskactive(504) && quest::istaskactivityactive(504,1)) {
if($text=~/hail/i) {
quest::shout("Ahhh the orcses they are after meeez");
#despawn gollum and respawn him at the next location
quest::depop(999303);
#spawn orc lieutants
quest::spawn(999204,0,0,-866.3,357.1,90.3);
#spawn gollum in dif loc
quest::spawn(999303,0,0,-1023.7,-344.3,7.5);
if(!$g) { #No Group
$client->UpdateTaskActivity(504, 1, 1);
quest::shout("It works");
}
## Find Group Members
else {
for($i = 0; $i < $g->GroupCount(); $i++) {
$c = $g->GetMember($i);
if($c) {
# Update the group task
$c->UpdateTaskActivity(504, 1, 1);
quest::shout("It works");
}
}
}
}
}

Astal
05-08-2011, 01:24 AM
Nope, this is how I have it, i copied what you posted He will do the shout but not execute the group code

sub EVENT_SAY {
$g = $client->GetGroup();

if(quest::istaskactive(504) && quest::istaskactivityactive(504,1)) {

if($text=~/hail/i) {
quest::shout("Ahhh the orcses they are after meeez");
#despawn gollum and respawn him at the next location
#quest::depop(999303);
#spawn orc lieutants
#quest::spawn(999204,0,0,-866.3,357.1,90.3);
#spawn gollum in dif loc
#quest::spawn(999303,0,0,-1023.7,-344.3,7.5);

if(!$g) { #No Group
$client->UpdateTaskActivity(504, 1, 1);
quest::shout("It works");
}

## Find Group Members
else
{
for($i = 0; $i < $g->GroupCount(); $i++)
{
$c = $g->GetMember($i);
if($c)
{
# Update the group task
$c->UpdateTaskActivity(504, 1, 1);
quest::shout("It works");
}
}
}
}
}

Astal
05-08-2011, 01:54 AM
yeah im lost, if anyone can rewrite this function and make it work, ill love u long time

joligario
05-08-2011, 02:18 PM
Yeah, that's my mistake. I didn't realize that UpdateTaskActivity wasn't exported to perl_client. Only the quest manager. So as it is now, I don't see a way to do mass task updates like that.

Astal
05-08-2011, 02:24 PM
Yeah, that's my mistake. I didn't realize that UpdateTaskActivity wasn't exported to perl_client. Only the quest manager. So as it is now, I don't see a way to do mass task updates like that.

oh ok that sucks