|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Quests::Q&A This is the quest support section |  
	
	
		
	
	
	| 
			
			 
			
				03-27-2012, 07:57 PM
			
			
			
		 |  
	| 
		
			
			| Sarnak |  | 
					Join Date: Aug 2010 
						Posts: 33
					      |  |  
	| 
				 Need help on where to put this script. 
 I am making a spell that summons eight temporary pets that fight for the summoner for a limited time. When these temp pets are summoned their features and race are randomized. Is this possible? Where would the .pl files go so it works with every zone?  Templates?
 Kind of confused on this one, but I think I can figure everything else out once somebody gets me in the right direction.
 
 
 Thanks.
 |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				03-27-2012, 09:01 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Aug 2006 Location: USA 
						Posts: 5,946
					      |  |  
	| 
				  
 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);
		}
	}
} |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				03-27-2012, 10:05 PM
			
			
			
		 |  
	| 
		
			
			| Sarnak |  | 
					Join Date: Aug 2010 
						Posts: 33
					      |  |  
	| 
 Thank you very much. This helped a ton. |  
	
		
	
	
	| 
			
			 
			
				03-28-2012, 12:21 AM
			
			
			
		 |  
	| 
		
			
			| Sarnak |  | 
					Join Date: Aug 2010 
						Posts: 33
					      |  |  
	| 
 Figured it out. It was actually easier than I thought and all I had to do was put the name of the npc file from the spell into the quest/templates folder and when that npc is spawned by the temporary spell each one of those npcs change to something random. 
	Code: #Put in eqemu/quests/templates folder.  Name it NPCname.pl
sub EVENT_SPAWN
{
my $randomrace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 128, 130, 330, 522);
my $randomgender = quest::ChooseRandom(0, 1);
quest::npcgender($randomgender);
quest::npcrace($randomrace);
} 
Question: What would I need to add to this to get all of these NPC's to change to the right size?  I tried the line of If $randomrace == X but they don't seem to work. |  
	
		
	
	
	| 
			
			 
			
				03-28-2012, 03:35 AM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Aug 2006 Location: USA 
						Posts: 5,946
					      |  |  
	| 
 LOL, the script example I gave above just happens to be related to handling player race sizes.  So, you should be able to use the array from that script and set the size of the NPC with something like this: 
	Code: %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
);
$npc->ChangeSize($RaceSizes{$randomrace}); Of course, you would need to do that after you set the $randomrace variable. |  
	
		
	
	
	| 
			
			 
			
				03-29-2012, 11:42 PM
			
			
			
		 |  
	| 
		
			
			| Sarnak |  | 
					Join Date: Aug 2010 
						Posts: 33
					      |  |  
	| 
 Worked like a charm :P  Alright, so I got random races and sizes aced. Now I just need to learn how to get their full armor model working on spawn. Right now, they spawn with their mail chest piece and that's it. |  
	
		
	
	
	
	
	| Thread Tools |  
	|  |  
	| Display Modes |  
	
	| 
		 Linear Mode |  
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is Off 
 |  |  |  All times are GMT -4. The time now is 11:04 PM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |