Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2013, 10:36 AM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default 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
Reply With Quote
  #2  
Old 08-15-2013, 01:39 PM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

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
Reply With Quote
  #3  
Old 08-15-2013, 04:13 PM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default

Quote:
Originally Posted by Kingmen30264 View Post
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.
Reply With Quote
  #4  
Old 08-15-2013, 04:45 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Quote:
Originally Posted by lumiya View Post
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.
__________________

Reply With Quote
  #5  
Old 08-15-2013, 06:22 PM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default

Would I use GetFactionLevel(FactionID) to extract the faction from the entity list of a PC on the hate list?
Reply With Quote
  #6  
Old 08-16-2013, 09:45 AM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default

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?
Reply With Quote
  #7  
Old 08-16-2013, 10:03 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

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.
Reply With Quote
  #8  
Old 08-16-2013, 12:21 PM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default

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?
Reply With Quote
  #9  
Old 08-16-2013, 01:02 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

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)
Reply With Quote
  #10  
Old 08-16-2013, 03:58 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

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);
Reply With Quote
  #11  
Old 08-16-2013, 11:09 PM
lumiya
Fire Beetle
 
Join Date: Jun 2010
Posts: 12
Default

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);
Reply With Quote
  #12  
Old 08-16-2013, 11:12 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

No problem
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:15 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3