PDA

View Full Version : plugin::DoAnim && plugin::SetAnim


Akkadius
05-05-2010, 01:09 PM
So as I work on BotA, and I use as many things to liven NPC's up as possible. I thought hrm, there should be an easily little plugin where you could simply type in the name of the animation in the plugin instead of memorizing integers.

This plugin can go in the same file, and has two uses:

plugin::DoAnim(wave); ### NPC will wave

plugin::SetAnim(dead); ### NPC will permanently lay dead

You can refer to the list of animations in the plugin, the strings should be a lot easier to memorize than integers...

I may make some revisions to this plugin but this should help you all out quite a bit...

Just call it npcanimations.pl in your plugin folder and you should be set!

Gotta jet!


sub DoAnim {
###Usage: plugin::DoAnim(salute);
my $client = plugin::val('$client');
my $text = $_[0];
%Animlist = (
"kick" => 1,
"pierce" => 2,
"2hslash" => 3,
"2hblunt" => 4,
"2hpierce" => 4,
"throw" => 5,
"offhand" => 6,
"bash" => 7,
"mainhand" => 8,
"bow" => 9,
"swim" => 10,
"roundkick" => 11,
"gethit" => 12,
"gethit2" => 13,
"falling" => 14,
"drowning" => 15,
"death" => 16,
"standby" => 17,
"standby2" => 18,
"lunge" => 19,
"jump" => 20,
"falling2" => 21,
"duckwalk" => 22,
"ladderclimb" => 23,
"crouch" => 24,
"swim2" => 25,
"idle" => 26,
"cheer" => 27,
"disgusted" => 28,
"wave" => 29,
"rude" => 30,
"yawn" => 31,
"movetoside" => 33,
"iceslide" => 35,
"kneel" => 36,
"swim3" => 37,
"sit" => 38,
"cast" => 42,
"cast2" => 43,
"cast3" => 44,
"flykick" => 45,
"tigerclaw" => 46,
"eaglestrike" => 47,
"nodyes" => 48,
"shakeno" => 49,
"plead" => 50,
"clap" => 51,
"blush" => 52,
"chuckle" => 54,
"headtilt" => 57,
"dance" => 58,
"disagree" => 59,
"glare" => 60,
"peer" => 61,
"kneel" => 62,
"laugh" => 63,
"point" => 64,
"shrug" => 65,
"handraise" => 66,
"salute" => 67,
"shiver" => 68,
"tapfoot" => 69,
"bowto" => 70,
);
quest::doanim($Animlist{$text});
}

sub SetAnim {
##Usage: plugin::SetAnim(sit);
my $npc = plugin::val('$npc');
my $SetAnimVal = $_[0];
%SetAnimList = (
"stand" => 0,
"sit" => 1,
"duck" => 2,
"dead" => 3,
"kneel" => 4,
);
$npc->SetAppearance($SetAnimList{$SetAnimVal});
}
return 1;

mastajon
05-05-2010, 03:25 PM
Well thats going to make for some interesting npc to player interaction.

- Nice job boss.

Akkadius
05-05-2010, 03:33 PM
Script examples: (Pardon some of the slop organization as it warped on copy and paste)

plugin::DoAnim:


sub EVENT_SAY
{
if($text=~/Hail/i){
quest::say("Well hello there ol' lad! How are yeh today!");
plugin::DoAnim(wave);
}
if($text=~/repond to text above/i){
quest::say("Hah! If you weren't such a kidder $name I'd call yeh a fool!");
plugin::DoAnim(laugh);
}
}

plugin::SetAnim:

This would be a diseased Iksar in the overthere theme people will see. Lays on the ground dead after spawn to avoid clients from seeing them standing up right using the timer instead of straight up using it in a sub EVENT_SPAWN:
sub EVENT_SPAWN
{
quest::settimer("Die",1);
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
quest::set_proximity($x - 5, $x + 5, $y - 5, $y + 5, $z - 4, $z + 4);
}

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

sub EVENT_ENTER {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
$client->Message(15, "The Iksar appears to be a test subject instead of using their own race, the Shissar.");
}
}