PDA

View Full Version : Group Teleport in ToFS.


Shin Noir
10-01-2009, 11:42 AM
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 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).


#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);
}
}
}
}

cavedude
10-11-2009, 09:07 PM
Thanks, I added this to the PEQ repo with an added item check.

OscarGrouch05
01-16-2010, 06:14 AM
cavedue this is what i made up for teleports from bazaar zone
Translocator_Blue.pl
sub TL
{
movepc(1213.00,921.00,3.28); }
}
movepc(88.00,265.00,36.00); }
}

Translocator_Red.pl
sub TL
{
movepc(1212.00,-891.00,3.28); }
}
movepc(261.64,-91.47,36.00); }
}

click on the circle at your feet it'll teleport ya
-----------------------------
for guildlobby
High_Priest_Of_Luclin.pl

#generic soulbinder quest
sub EVENT_SAY {
plugin::soulbinder_say($text);
}

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
quest::signal(202273,5); #Qadar
}

High_Priestess_Of_Luclin.pl

#generic soulbinder quest
sub EVENT_SAY {
plugin::soulbinder_say($text);
}

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
quest::signal(202273,5); #Qadar
}

RichardoX
02-24-2010, 06:24 PM
Great contribution! Good work.