Log in

View Full Version : Movegrp quest command fix


Rocker8956
10-08-2008, 01:34 PM
I have seen a few complaints about movegrp not moving the requesting character. Well here is why

Zone\groups.cpp
void Group::TeleportGroup(Mob* sender, int32 zoneID, float x, float y, float z, float heading)
{
uint32 i;
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
{
#ifdef IPC
if (members[i] != NULL && (members[i]->IsClient() || (members[i]->IsNPC() && members[i]->CastToNPC()->IsInteractive())) && members[i] != sender)
#else
if (members[i] != NULL && members[i]->IsClient() && members[i] != sender)
#endif
{
members[i]->CastToClient()->MovePC(int(zoneID), x, y, z, heading, 0, ZoneSolicited);
}
}
}

The code in red causes the requester to be skipped. (members[i] != sender)

This function appears to only be used twice in the code.
By QuestManager::movegrp in questmgr.cpp and XS(XS_Group_TeleportGroup) in perl_groups.cpp

I do not know where XS_Group_TeleportGroup is used. Can someone enlighten me before I remove (members[i] != sender) and break something?

Also what is IPC? I did not see any reference to it in my source.

Rocker8956
10-08-2008, 01:42 PM
Nevermind the IPC question. It appears to be a Unix thing. Sorry, I should have done more searching before asking.

Derision
10-08-2008, 02:36 PM
This function appears to only be used twice in the code.
By QuestManager::movegrp in questmgr.cpp and XS(XS_Group_TeleportGroup) in perl_groups.cpp

I do not know where XS_Group_TeleportGroup is used. Can someone enlighten me before I remove (members[i] != sender) and break something?


The XS(XS_<Function) syntax is just the way that the functions to be called from the Perl quest system are declared. It would be called by doing $group->TeleportGroup(<params>).


Also what is IPC? I did not see any reference to it in my source.

As well as Interprocess Communication, IPC also stood for Interactive Player Character, I believe. I'm not sure exactly what it was meant to do, or if it ever even worked.

Rocker8956
10-08-2008, 02:55 PM
Thank you, it makes more sense now.

I probably don't want to mess with the Group::TeleportGroup since it is likely being used.

Though I think I may have a fix for the quest initiator not being moved by movegrp.

Please note I am at work so this is untested. If someone with quests that use the movegrp function could give this a try I would be grateful.

zone\questmgr.cpp
Find void QuestManager::movegrp and replace line 10 with the line in red.
Line number for whole file is 720 on mine.

void QuestManager::movegrp(int zoneid, float x, float y, float z) {
#ifdef IPC
if (initiator && initiator->IsClient()|| (initiator->IsNPC() && initiator->CastToNPC()->IsInteractive()) )
#else
if (initiator && initiator->IsClient())
#endif
{
Group *g = entity_list.GetGroupByClient(initiator);
if (g != NULL){
g->TeleportGroup(owner, zoneid, x, y, z, 0.0f);
}
else {
initiator->MovePC(zoneid, x, y, z, 0.0f);
}
}
}

All I changed was the word in blue (owner). I replaced initiator with owner.

Derision
10-12-2008, 02:57 PM
Thanks. I tested this and it works fine. It's in Rev87.

KLS
10-12-2008, 03:59 PM
IPC was basically a system where a character could become a npc. It no longer works and probably should be fixed or removed.