PDA

View Full Version : Looking to prevent engage with Faction


lumiya
08-15-2013, 10:36 AM
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.

Kingmen30264
08-15-2013, 01:39 PM
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

lumiya
08-15-2013, 04:13 PM
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.

wolfwalkereci
08-15-2013, 04:45 PM
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.

lumiya
08-15-2013, 06:22 PM
Would I use GetFactionLevel(FactionID) to extract the faction from the entity list of a PC on the hate list?

lumiya
08-16-2013, 09:45 AM
This is what I have so far.


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?

Kingly_Krab
08-16-2013, 10:03 AM
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:
($h_ent->GetCharacterFactionLevel(GetNPCFaction()) > 1)

Becomes this:
($h_ent->GetCharacterFactionLevel($npc->GetNPCFactionID()) > 1)

For future reference, Objects are located here (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects).

lumiya
08-16-2013, 12:21 PM
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.


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



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?

Kingly_Krab
08-16-2013, 01:02 PM
Likely because GetCharacterFactionLevel happens to be a $client call, weird I didn't notice, rather tired at the moment. Try the below suggestion, please.

($client->GetCharacterFactionLevel($npc->GetNPCFactionID()) > 1)

NatedogEZ
08-16-2013, 03:58 PM
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.




my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc);

lumiya
08-16-2013, 11:09 PM
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!


my $FACTION = $h_ent->GetFactionLevel($h_ent->CharacterID(), $npc->GetID(), $h_ent->GetRace(), $h_ent->GetClass(), $h_ent->GetDeity(), $npc->GetPrimaryFaction(), $npc);

NatedogEZ
08-16-2013, 11:12 PM
No problem :)