Thread: Climb a tree
View Single Post
  #1  
Old 02-14-2013, 07:34 PM
Loxo
Fire Beetle
 
Join Date: Jun 2012
Posts: 5
Default Climb a tree

Code:
##a_Pine.pl
sub EVENT_SPAWN
{
	$x = $npc->GetX();
	$y = $npc->GetY();
	$z = $npc->GetZ();
	quest::set_proximity($x - 8, $x + 8, $y - 8, $y + 8, $z - 200, $z + 50);
}

sub EVENT_ENTER
{
$climberchar = ($client);
	$npc->SignalClient($climberchar, 1);
}
sub EVENT_EXIT
{
	$npc->SignalClient($climberchar, 2);
$climberchar = undef;
}
Code:
##player.pl
sub EVENT_SIGNAL
{
	if ($signal == 1) 
	{
	$weight = ($client->GetWeight() / 10);
	$basedex = $client->GetBaseDEX();
	$basestr = $client->GetBaseSTR();
	$climbertime = ((($basedex + $basestr) / ($weight + 1)*2));
		quest::settimer("treeclimb",3);
		quest::settimer("climber",$climbertime);
	}
	elsif ($signal == 2)
	{
		quest::stoptimer("climber");
		quest::stoptimer("treeclimb");
		$client->SetFlyMode(0);
	}
	else
	{
		quest::emote(" is broken");
	}
}

sub EVENT_TIMER
{
	if ($timer eq "treeclimb")
	{
		$client->SetFlyMode(1);
		$client->Message(10, "You begin to climb...");
		quest::stoptimer("treeclimb");
	}
	elsif ($timer eq "climber")
	{
	$climbervar = quest::ChooseRandom(1, 2, 3);
		if ($climbervar == 1)
		{
			$client->Message(10, "You almost lose your grip...");
			quest::doanim(12);
		}
		elsif ($climbervar == 2)
		{
			$client->Message(10, "You feel a bug crawl up your leg and almost lose your grip...");
			quest::doanim(23);
		}
		else
		{				
			$client->SetFlyMode(0);
			$client->Message(10, "You lose your grip...");
			quest::stoptimer("climber");
		}
	}
}
It always seems to work when all the parenthesis are there.
Reply With Quote