Thread: Porters
View Single Post
  #8  
Old 04-20-2015, 10:36 PM
markusdabrave's Avatar
markusdabrave
Sarnak
 
Join Date: Jan 2012
Location: Plano, TX
Posts: 70
Default

I figured it out about 30 minutes ago, then saw your PM. I really appreciate the help from everyone on this. Hopefully I can pay it forward. Here's what I came up with:

Code:
sub EVENT_SAY{
my %porthash = (
				# line# => [lname, zoneid, x, y, z, heading]
				1 => ["Surefall Glade", 3, -391, -209, 4.75, 0 ],
				2 => ["Butcherblock Mountains",68, 1984, -2135, 0 ],
				3 => ["The Feerrott", 47, -1885, 367, 13.57, 0 ],
				4 => ["North Karana", 13, -1494, -2706, -7.5, 0 ],
				5 => ["Lavastorm Mountains", 27, 460, 460, -84.88, 0 ],
				6 => ["Misty Thicket", 33, -1896, -490, 120.34, 0 ],
				7 => ["South Ro", 35, 317, -2034, -22.64, 0 ],
				8 => ["Steamfont Mountains", 56, 1668, -1779, -108.07, 0 ],
				9 => ["West Commonlands", 21, 1427, 479, -51, 0 ],
				10 => ["Toxxulia Forest", 56, -357, 1099, -57.93, 0 ],
				);
	if ($text=~/Hail/i) {
		plugin::Whisper("Hail! Where would you like to go? ");
		foreach my $key (keys %porthash) {
			$client->Message(315, "[".quest::saylink($key, 1, $porthash{$key}->[0])."]");
		}
	}
	elsif (defined $porthash{$text}) {
		quest::selfcast(34);
		quest::doanim(43);
		$client->SpellEffect(43,10);
		castdelay(9);
		quest::movepc($porthash{$text}->[1],$porthash{$text}->[2],$porthash{$text}->[3],$porthash{$text}->[4],$porthash{$text}->[5]);
		plugin::Whisper("Off to ".$porthash{$text}->[0]." you go!");
	}
}
My hash has some extra info in it but that's b/c I played with it a few times. I also stretched the cast delay so the spell effect made more sense aesthetically (at least to me it did). The good news is, I actually understand how hashes work now So it's not all Greek anymore.

The last thing I'd like to do with this is make the Superior Camo not be a self-cast (if its possible). Been looking at some other threads about group spells, but technically it's not a group spell. You just have to be in the group for it to land on you.

If there's a way to fake the NPC casting this on the player, I'm all ears:
Code:
quest::selfcast(34);
The below works, it just doesn't land on the player (presumably b/c the player is not grouped with the NPC).

Code:
$npc->CastSpell(34, $client);
I also messed around with CastGroupSpell but I'm reasonably sure that didn't work b/c this isn't a true group spell (like Group Wolf Form, Talisman of whatever, etc.).
Reply With Quote