View Single Post
  #1  
Old 12-29-2014, 03:15 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,604
Default NPC Armor Color Plugin.

Just something cool I wrote that some people might like, it allows you to set an NPC's armor color based on RGB, currently it sets all pieces at once, but it could be changed to set eat piece individually, example script after plugin. The following code should be placed in a .pl file in your plugins folder. Example: mob_color.pl
Code:
sub SetMobColor {
	plugin::val('npc')->WearChange($_, plugin::val('npc')->GetTexture(), plugin::MobColor($_[0], $_[1], $_[2])) for (0..6);
}

sub MobColor {
	my $color = 0;
	$color += (((256 ** 2) * $_[0]) + (256 * $_[1]) + $_[2]);
	return $color;
}

return 1;
Here is the example code.
Code:
sub EVENT_SPAWN {
	plugin::SetMobColor(quest::ChooseRandom(0..255), quest::ChooseRandom(0..255), quest::ChooseRandom(0..255));
}
Here's a picture of what this looks like.
Reply With Quote