View Single Post
  #1  
Old 12-24-2013, 12:16 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default Plugin: Persistent Nimbus

Purpose:

The purpose of this plugin was intended for setting Nimbus effects on NPC's persistently for all players. The problem with using any Nimbus is that the server does not always send Nimbus'es to new clients entering a zone, so this plugin is responsible for resending what the NPC has assigned to it.

When a client enters the zone after the nimbus was assigned to the NPC, it will only send the Nimbus packet to the client after an entity list iteration.


Name File: Akka_Custom.pl under plugins folder.

Code:
sub PersistentNimbus{
	$npc = plugin::val('$npc');
	$n = 0;
	while($_[$n]){ 
		$npc->SpellEffect($_[$n], 500, 0, 1, 3000, 1); 
		$npc->SetEntityVariable("PersistentNimbus_" . $n, $_[$n]);
		$n++;
	}
}
HOW TO USE:

Under global_player.pl under the templates or 'global' folder, this section of code needs to be placed underneath EVENT_ENTERZONE:

* Note you can assign as many as you want, you simply add more Nimbus #'s

Code:
plugin::PersistentNimbus(1, 2, 4, 5, 6, 7, 8, 9, 10);
Code:
sub EVENT_ENTERZONE {
	### Persistent Nimbus Plugin ###
	@nlist = $entity_list->GetNPCList();
	foreach my $NPC (@nlist){
		$n = 0;
		if($NPC->GetEntityVariable("PersistentNimbus_" . $n) > 0){
			while($NPC->GetEntityVariable("PersistentNimbus_" . $n) > 0){
				$NPC->SpellEffect($NPC->GetEntityVariable("PersistentNimbus_" . $n), 500, 0, 1, 3000, 1, $client);
				$n++;
			}
		} 
	}
	################################
}
Example Use, Assigning to an NPC:

This is an example of a default.pl for NPC's in a zone, this applies to many NPC's and has conditionals based on NPC name:

Code:
sub EVENT_SPAWN{
	$nn = $npc->GetCleanName();
	if($nn=~/pumpkin/i){ plugin::PersistentNimbus(550, 548, 611, 406); $npc->TempName(""); }
	if($nn=~/scare/i){ plugin::PersistentNimbus(550); }
	if($nn=~/zonein/i){ plugin::PersistentNimbus(445, 548, 516); $npc->TempName(""); }
	if($nn=~/ring/i){ plugin::PersistentNimbus(414); $npc->TempName(""); plugin::SetProx(25, 25); }
	if($nn=~/halloween orange/i){ plugin::PersistentNimbus(403); $npc->TempName(""); }
	if(($nn=~/minion of the underworld/i) && ($npc->GetRace() == 279)) { plugin::PersistentNimbus(473); } #Fairy thingie
	if(($nn=~/minion of the underworld/i) && ($npc->GetRace() == 293)) { plugin::PersistentNimbus(462); } #Imp
	if(($nn=~/minion of the underworld/i) && ($npc->GetRace() == 362)) { plugin::PersistentNimbus(319); } #Golem
	if(($nn=~/minion of the underworld/i) && ($npc->GetRace() == 270)) { plugin::PersistentNimbus(446); } #Undead
}