View Single Post
  #2  
Old 03-27-2012, 09:01 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

You would save it in your quest/spells folder and name the file <spellid>.pl. So, if the spell is 12345, it would be 12345.pl as the name. Here is an example of one of my spell scripts so you can get an idea of how to do them:

Code:
# Script for setting a cap on Growth spells
	
%RaceSizes = (
	1 => 6, # Human
	2 => 8, # Barbarian
	3 => 6, # Erudite
	4 => 5, # Wood Elf
	5 => 5, # High Elf
	6 => 5, # Dark Elf
	7 => 5, # Half Elf
	8 => 4, # Dwarf
	9 => 9, # Troll
	10 => 9, # Ogre
	11 => 3, # Halfling
	12 => 3, # Gnome
	128 => 6, # Iksar
	130 => 6, # Vah Shir
	330 => 5, # Froglok
	522 => 6, # Drakkin
);

# Sub to handle the growth limits so it doesn't have to be repeated multiple times
sub DoGrowth {
	my $Mob = $_[0];
	my $CurSize = $Mob->GetSize();
	if (!$CurSize) {
		$CurSize = 6;
	}
	my $CurRace = $Mob->GetRace();
	my $BaseSize = $RaceSizes{$CurRace};
	if (!$BaseSize) {
		$BaseSize = 6;
	}
	if ($CurSize < $BaseSize + 5) {
		$Mob->ChangeSize($CurSize + 1);
	}
}

sub EVENT_SPELL_EFFECT_CLIENT {
	my $ClientID = $entity_list->GetClientByID($caster_id);
	if ($ClientID) {
		$ClientTarget = $ClientID->GetTarget();
		if ($ClientTarget) {
			DoGrowth($ClientTarget);
		}
		else {
			DoGrowth($ClientID);
		}
	}
}

sub EVENT_SPELL_EFFECT_NPC {
	my $NPCID = $entity_list->GetMobByID($caster_id);
	if ($NPCID) {
		$NPCTarget = $NPCID->GetTarget();
		if ($NPCTarget) {
			DoGrowth($NPCTarget);
		}
		else {
			DoGrowth($NPCID);
		}
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote