|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Quests::Q&A This is the quest support section |  
	
	
		
	
	
	| 
			
			 
			
				08-15-2013, 10:36 AM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
				 Looking to prevent engage with Faction 
 Hi everyone I"m in the process of creating an event and I'm looking for ways to prevent players who have a $faction > 9 from engaging the NPCs.  I thought about using the Banish code from Vox/Naggy or possibly having them DT anyone who engages and isn't Scowling(faction = 9).
 There will be an entire zone full of NPCs with this script on them and I'm not sure  if the Banish/DT scripts would cause sever strain on the system or not.
 
 If anyone has an ideas on ways to handle this the help would be greatly appreciated.
 			 Last edited by lumiya; 08-15-2013 at 10:36 AM..
				Reason: spelling
 |  
	
		
	
	
	| 
			
			 
			
				08-15-2013, 01:39 PM
			
			
			
		 |  
	| 
		
			
			| Hill Giant |  | 
					Join Date: Sep 2006 
						Posts: 112
					      |  |  
	| 
 Perhaps you can run a check on the player to see how their faction stands with the mob and if it isn't within the chosen parameters then instead of "banishing" them, you can maybe teleport them to another part of the zone, or send them back to bind point?
 If you don't want the player to be able to attack and deal damage to said mobs, then you might could make could run the same check and if the faction holds true to your parameters, then you can have the mob not attack and not be attacked (invul) and this should prevent the player(s) in question from progressing.
 
 It has been a while since I messed around with Perl code, and I haven't had the chance to check out the new LUA scripts/coding since it was implemented , otherwise I would have posted a script similar to what I would think you are wanting.
 
 ~Kingmen
 |  
	
		
	
	
	| 
			
			 
			
				08-15-2013, 04:13 PM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by Kingmen30264  If you don't want the player to be able to attack and deal damage to said mobs, then you might could make could run the same check and if the faction holds true to your parameters, then you can have the mob not attack and not be attacked (invul) and this should prevent the player(s) in question from progressing.
 ~Kingmen
 |  Would this make the NPC not aggro/invulnerable to that player only or to everyone.  Say someone who is scowling engages the NPC and then someone is indifferent engages and triggers the invulnerable/non aggro state. I would need the NPC to continue attacking and being attacked by the client that is Scowling. |  
	
		
	
	
	| 
			
			 
			
				08-15-2013, 04:45 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Dec 2005 
						Posts: 435
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by lumiya  Would this make the NPC not aggro/invulnerable to that player only or to everyone.  Say someone who is scowling engages the NPC and then someone is indifferent engages and triggers the invulnerable/non aggro state. I would need the NPC to continue attacking and being attacked by the client that is Scowling. |  Nope, wont work. Just move the offending player out of the area or out of the zone or even better freeze them in place.
				__________________
 
 |  
	
		
	
	
	| 
			
			 
			
				08-15-2013, 06:22 PM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
 Would I use GetFactionLevel(FactionID) to extract the faction from the entity list of a PC on the hate list? |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				08-16-2013, 09:45 AM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
				  
 This is what I have so far. 
	Code: sub EVENT_AGGRO {
  # a 1 second leash timer.
  quest::settimer(1,1);
}
sub EVENT_TIMER {
  if ($timer == 1) {
    quest::say("timer set");
    my @hate_list = $npc->GetHateList();
	my $hate_count = @hate_list;
	if ($hate_count > 0) {
	quest::say("hate count >0");
      foreach $ent (@hate_list) {
            my $h_ent = $ent->GetEnt();
	    my $h_dmg = $ent->GetDamage();
	    my $h_hate = $ent->GetHate();
        if ($h_ent->IsClient()) {
		quest::say("Is Client named $h_ent hate list is $hate_count ");
          if ($h_ent->GetCharacterFactionLevel(GetNPCFaction()) > 1) {
            quest::ze(0,"You are not my enemy! ");
            $h_ent->CastToClient()->MovePC(34,823.3,1373.4,10.33,0);
             }
           }
	  }
    } else {
      WIPE_AGGRO();
	}
  }
}
sub WIPE_AGGRO {
  quest::stoptimer(1);
} I've getting the callbacks up to 
quest;;say("Is Client named $h_ent hate list is $hate_count ");
 
so what I am having issue with is 
 if ($h_ent->GetCharacterFactionLevel(GetNPCFaction()) > 1) {
 
It is this the correct way to full the PC who is on the hatelist's faction with the NPC?
			
			
			
			
				  |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				08-16-2013, 10:03 AM
			
			
			
		 |  
	| 
		
			
			| Administrator |  | 
					Join Date: May 2013 Location: United States 
						Posts: 1,604
					      |  |  
	| 
 Pretty sure it should be $npc->GetNPCFactionID. Suggestion below. Personal preference, but when you post code would you mind putting it in better formatting, looks really bad when everything's jumbled together. 
This:
 
	Code: ($h_ent->GetCharacterFactionLevel(GetNPCFaction()) > 1) Becomes this:
 
	Code: ($h_ent->GetCharacterFactionLevel($npc->GetNPCFactionID()) > 1) For future reference, Objects are located here . |  
	
		
	
	
	| 
			
			 
			
				08-16-2013, 12:21 PM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
 Thanks for the response.  I will clean up my code for future posts. 
The faction check is still not firing it seems. As before it gets to the 
 Is Entity a Client check which passes.
 
I have also tried to specifiy the faction id with no success.
 
	Code: if ($h_ent->GetCharacterFactionLevel(1117) > 1) 
I also tried to store the faction ID as a variable and call it back in a quest::say with no success
 
	Code: my $h_faction = $ent->GetCharacterFactionLevel(1117);
if ($h_ent->IsClient()) {
quest::say("Is Client named $h_ent hate list is $hate_count and faction is $h_faction ");
} So my question now becomes can I pull the Faction for each entity in the hate list or is that not supported? |  
	
		
	
	
	| 
			
			 
			
				08-16-2013, 01:02 PM
			
			
			
		 |  
	| 
		
			
			| Administrator |  | 
					Join Date: May 2013 Location: United States 
						Posts: 1,604
					      |  |  
	| 
 Likely because GetCharacterFactionLevel happens to be a $client call, weird I didn't notice, rather tired at the moment. Try the below suggestion, please. 
	Code: ($client->GetCharacterFactionLevel($npc->GetNPCFactionID()) > 1) |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				08-16-2013, 03:58 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Dec 2012 
						Posts: 515
					      |  |  
	| 
				  
 
	Code: sub EVENT_COMBAT {
 # a 1 second leash timer.
	if($combat_state == 1)
	{
		quest::settimer(1,1);
	}
	else
	{
		quest::stoptimer(1);  #we left combat stop timer
	}
}
sub EVENT_SAY {
	$client->Message(315, "you are $faction level faction");
        #This was for resting :p
}
sub EVENT_TIMER {
	if ($timer == 1) 
	{
		#quest::say("timer set");
		my @hate_list = $npc->GetHateList();
		my $hate_count = @hate_list;
		if ($hate_count > 0) 
		{
			#quest::say("hate count >0");
			foreach $ent (@hate_list) 
			{
				my $h_ent = $ent->GetEnt();
				if ($h_ent->IsClient()) 
				{
					#quest::say("Is Client named $h_ent hate list is $hate_count ");
					$h_ent = $h_ent->CastToClient(); 								#h_ent WAS a client CASTING to client now!
					my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc);  #Holy crap that is long (thats what she said)
					if ($FACTION != 9) # We are not READY TO ATTACK
					{
						#we are faction 6-9 .. aka they wanna keel us  (at least dubious 
						quest::ze(0,"You are not my enemy! ");
						$h_ent->MovePC(34,823.3,1373.4,10.33,0);
						#id suggest moving them to a new zone :)
					}
				}
			}
		} 
		else 
		{
			WIPE_AGGRO();
		}
	}
}
sub WIPE_AGGRO {
	#might wanna add some wipe aggro code here :)
  quest::stoptimer(1);
} 
Thats how you seem to get faction level when its not in a client activated script.
 
	Code: my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc);
			
			
			
			
				  |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				08-16-2013, 11:09 PM
			
			
			
		 |  
	| 
		
			
			| Fire Beetle |  | 
					Join Date: Jun 2010 
						Posts: 12
					      |  |  
	| 
 This is exactly what I needed.  I had tried over 30 different ways and I would have never figured this out without your help.  Thank You! 
	Code: my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc); |  
	
		
	
	
	| 
			
			 
			
				08-16-2013, 11:12 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Dec 2012 
						Posts: 515
					      |  |  
	| 
 No problem   |  
	
		
	
	
	
	
	| 
	|  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 09:14 AM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |