Sadly, I couldn't mirror the functionality of checking one's cursor for a key item at initial entry. Code should be like this:
$client->CastToClient()->GetInv().GetItem(30) == 20033
However, the method GetInv() was returning perl runtime errors. This is nearly an exact replica of the code found in doors.cpp line 211
Code:
const ItemInst *lockpicks = sender->GetInv().GetItem(SLOT_CURSOR);
What does this mean? until resolved, this code will teleport group members only if the key is inside your key ring. (this occurs after you use the key the first time). Once the above is resolved, it will teleport when you first use from cursor, or via key ring.
I use a 40 meter range verification from the location of the player who has the key (mainly because getting the door's location was kind of annoying via script).
Put this in your quests\frozenshadow\player.pl file (probably will have to create it).
Code:
#Tower of Frozen Shadow Group-Based Teleporting on key usage by Shin Noir.
sub EVENT_CLICKDOOR {
if ($client->IsGrouped()) { #This code is purely for grouped members teleporting.
my $destx = 0;
my $desty = 0;
my $destz = 0;
my $d_id = ($doorid % 256);
if ($d_id == 2 || $d_id == 166) { #First Floor Door
if ($client->KeyRingCheck(20033)) { # || $client->CastToClient()->GetInv().GetItem(30) == 20033) {
$destx = 660;
$desty = 100;
$destz = 40;
}
}
if ($d_id == 4 || $d_id == 167) { #Second Floor Door
if ($client->KeyRingCheck(20034)) {
$destx = 670;
$desty = 750;
$destz = 75;
}
}
if ($d_id == 16 || $d_id == 165) { #Third Floor Door
if ($client->KeyRingCheck(20035)) {
$destx = 170;
$desty = 755;
$destz = 175;
$desth = 0;
}
}
if ($d_id == 27 || $d_id == 169) { #Fourth Floor Door
if ($client->KeyRingCheck(20036)) {
$destx = -150;
$desty = 160;
$destz = 217;
}
}
if ($d_id == 34 || $d_id == 168) { #Fifth Floor Door
if ($client->KeyRingCheck(20037)) {
$destx = -320;
$desty = 725;
$destz = 12;
}
}
if ($d_id == 1) { #Sixth Floor Door
if ($client->KeyRingCheck(20039)) {
$destx = 20;
$desty = 250;
$destz = 355;
}
}
if ($destx != 0) { #Key trigger found. Teleport nearby group members.
my $tmpclient = 0;
for ($i = 0; $i < 2000; $i++) { #I would use a cycle of $client->GetGroup()->members[] but was having issues with it!
$tmpclient = $entity_list->GetClientByID($i);
if (defined($tmpclient)) {
if ($tmpclient->GetGroup()->IsGroupMember($client) #Grouped with key holder?
&& $tmpclient->CalculateDistance($client->GetX(), $client->GetY(), $client->GetZ()) < 40) {
$tmpclient->CastToClient()->MovePC(111, $destx, $desty, $destz, 0);
}
}
undef($tmpclient);
}
}
}
}