Thread: quest::movepc()
View Single Post
  #21  
Old 04-27-2011, 08:04 PM
Packet's Avatar
Packet
Hill Giant
 
Join Date: Jun 2010
Location: Omicron Percei-8
Posts: 106
Default

I know this is an old post but I thought I might add some input on this. For those of you working on quest::movepc and getting frustrated with heading not working, I wrote up this work-around.

quest::movepc() still does not work with changing the heading upon zone-in as of 5/27/2011 so I wrote this up real quick. It modifies the /template/player.pl to check coords upon zone in. If the X & Y coords match perfectly, it will update your heading to whatever is specified in the var under each if statement. There are better ways to accomplish this I am sure however this is how I got around it.

Also if you are considering adding this in, I might recommend adding a zone_id check before running the coord checks considering it would be highly unnecessary to run a massive list of coord checks on every single zoneline that is hit.

/quests/template/player.pl
------------------------------

Code:
sub EVENT_ENTERZONE {
#Zone Name - X  - Y or it jacks up the $cy/$cx variables. Last time I used one, it gave me a 324.24920492094 for $cx in freeport.
my $cx =  $client->GetX();
my $cy = $client->GetY();

if($cx == "324" && $cy == "-432") { #Freeport Port-in XY coords
my $fp_head = 220; #Var containing heading.
$client->SetHeading($fp_head);
$client->SendPosUpdate($fp_head);
$client->Message(15, "Your XY Coords are - X: $cx Y: $cy"); 
$client->Message(15, "Sucessfully modified your heading to $fp_head. Check by typing #loc."); 
}
if($cx == "-66" && $cy == "658") { #Qeynos Port-in XY coords
my $qy_head = 220; #Var containing heading.
$client->SetHeading($qy_head);
$client->SendPosUpdate($qy_head);
$client->Message(15, "Your XY Coords are - X: $cx Y: $cy"); 
$client->Message(15, "Sucessfully modified your heading to $qy_head. Check by typing #loc."); 
}
}
And this is a teleporter to test with if you'd like to try it.


Code:
sub EVENT_SAY {
if($text=~/hail/i) {
quest::say("Hi! I can take you to [Qeynos] or [Freeport]. Choose whichever you would like.");
}
if($text=~/qeynos/i) {
quest::movepc(2,-66, 658, 3, 113); #Qeynos Coords
}
if($text=~/freeport/i) {
quest::movepc(9, 324, -432, -24, 202); #Freeport Coords
}
}
Anyways, I apologize for reviving an old thread. This was irritating me earlier and I hope it may help someone else.

(Edit: Final note, if this doesn't work then you probably have a player.pl file already in the zone folder (/quests/zonename/) which is causing /templates/player.pl to not run.)
__________________
Packet Loss
Current project:
Dark Horizons

Formerly "Richardo"
Reply With Quote