View Single Post
  #6  
Old 05-16-2011, 10:00 PM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default

Quote:
Originally Posted by KLS View Post
What Joligario says is the best solution. Get your npc with the entity list and hate random.

That said here is some quick untested code for manual hate list manipulation...

Code:
#hate_clone(npc1, npc2) = npc2 gains npc1's hate list
sub hate_clone
{
	my $cloned = shift;
	my $other = shift;
	my @hatelist1 = $cloned->GetHateList();

	foreach $ent (@hatelist)
	{
		my $h_ent = $ent->GetEnt();
		my $h_dmg = $ent->GetDamage();
		my $h_hate = $ent->GetHate();
		if($h_ent)
		{
			if($other->CheckAggro($h_ent)) {
				$other->SetHate($h_ent, $h_hate, $h_dmg);
			}
			else {
				$other->AddToHateList($h_ent, $h_hate, $h_dmg, 0, 0, 0);
			}
		}
	}
}

what are $cloned and $other?
Reply With Quote