PDA

View Full Version : plugin::SetProx(X/Y Axis Range, Z Axis Range);


Akkadius
12-04-2010, 07:57 PM
This is another very simple, yet very useful plugin to help with speed in developing. I am going through and consolidating my plugins to be more appropriately placed for public use so you will see more on the way. This plugin sub routine is called "SetProx", takes to simple arguments and sets your mob's proximity trigger for whatever your heart desires:

#Akkadius
#Usage plugin::SetProx(X/Y Axis Range, Z Axis Range);
sub SetProx{
my $Range = $_[0];
my $Z = $_[1];
my $x = plugin::val('$x');
my $y = plugin::val('$y');
my $npc = plugin::val('$npc');
my $z = $npc->GetZ();
quest::set_proximity($x - $Range, $x + $Range, $y - $Range, $y + $Range, $z - $Z, $z + $Z);
}

return 1;

EXAMPLE:

Note: This example requires anim.pl plugins from the repository to function correctly

sub EVENT_SPAWN{
plugin::SetProx(20, 10);
quest::settimer("spawn", 5);
}

sub EVENT_ENTER{
plugin::SetAnim("stand");
}

sub EVENT_TIMER{
if ($timer eq "spawn"){
plugin::SetAnim("sit");
quest::stoptimer("spawn");
}
}

So in this case your mob spawns and then sits down. Whenever the proximity range is triggered (20 integers wide, and 10 integers up and down) the mob will stand up to your attention.

This would be the result of before and after of a script like this. Very simple. Just cuts down time of repeatedly doing the same functions instead of copy and pasting scripts pieces.


http://img.photobucket.com/albums/v450/Blade654/Grim1.png http://img.photobucket.com/albums/v450/Blade654/Grim2.png





This is available in the latest repository, see sticky.