View Single Post
  #1  
Old 05-16-2011, 08:46 PM
Astal
Hill Giant
 
Join Date: Mar 2010
Posts: 236
Default Passing a random player on bosses hate list to another npc?

Can this be done?

I have 4 mobs which im going to have cast a spell at random times between every 60 - 120 seconds.

I want them to cast them on random targets on the mobs hate list.

Im not too sure how to go about doing that.

This is the code for the mobs which will be casting the spells.

I assume ill use GetHateList(); on the main mobs script when hes attacked or?

Im not sure how I would store the hate list, ive never done much with arrays ect..

I assume how it would work is get the hate list and store each person on it as a variable, then randomly pick a variable each time the timer triggers and have the mob cast the spell on that person

Any help will be appreciated

Code:
##Child of Laiboch 

sub EVENT_SPAWN {
	quest::settimer("CastPlague", 60);
}



sub EVENT_TIMER {
	
	my $range = 120; #maximum number
	my $minimum = 60; #minimum number

	my $random_number = int(rand($range)) + $minimum; #generate a number between $minimum and $range
  
	if (($timer eq "CastPlague" ) && (defined($entity_list->GetNPCByNPCTypeID(999426))))
	{
		plugin::CastOnTarget(21480); #Virulent Plague
		quest::shout("You cannot defeat our mother!!!");
		quest::settimer("CastPlague", $random_number);
	}	
}
Reply With Quote