Author Topic: trying to restrict a party  (Read 464 times)

Legacy_AwakenerOfArmageddon

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
trying to restrict a party
« on: October 20, 2010, 08:29:58 pm »


               Is there a way to restrict good/evil players from partying together? I have been looking for a while.

Thanks
AoA
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
trying to restrict a party
« Reply #1 on: October 20, 2010, 08:35:23 pm »


               Depends on what you mean by restrict. If you mean literally boot from party, then sure, just use:



// Remove oPC from their current party. This will only work on a PC.

// - oPC: removes this player from whatever party they're currently in.

void RemoveFromParty(object oPC)



Of course, there is no 'joined party' event, so that's of limited use.



You can also alter monster death scripts to only award xp if the party is of the same good/evil axis, or do any number of other things to require same-alignment parties practically, rather than absolutely.



Funky
               
               

               
            

Legacy_AwakenerOfArmageddon

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
trying to restrict a party
« Reply #2 on: October 20, 2010, 08:42:03 pm »


               sorry I was not specific enough. I mean I would like to stop them from partying up at all, though booting them from parties will work too.



would it be possible (or reasonable, I dont want it to lag the server) to use a heartbeat script to check alignments and boot players? Or a way to make the players hostile to each other? I have heard of a mod that did this, but I cannot remember which one it was.



Thanks for the quick reply

AoA
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
trying to restrict a party
« Reply #3 on: October 20, 2010, 10:32:56 pm »


               Yes, you can certainly loop through the pc's faction and boot them from the heartbeat - that's not going to create much overhead at all. The only issue is deciding whether to boot the good or the evil ones. You could choose to keep whichever the first pc scanned happens to be, which would be simplest, or you could instead opt to tally up good and evil counts and boot the minority. Then, the only trick is making sure you don't check a pc more than once as you loop through them all. Here's the simplest example I could whip up. It won't do exactly what you want in all cases, but it's pretty streamlined. I did the boots in a separate loop so it wouldn't affect faction averages:

void main() {
    object oMember, oPC = GetFirstPC();
    int nFactionAlign;

    while (GetIsObjectValid(oPC)) {
        nFactionAlign = GetFactionAverageGoodEvilAlignment(oPC);

        if ((nFactionAlign < 50 && GetAlignmentGoodEvil(oPC) == ALIGNMENT_GOOD) ||
            (nFactionAlign >= 50 && GetAlignmentGoodEvil(oPC) == ALIGNMENT_EVIL))
            SetLocalInt(oPC, "AlignmentBoot", 1);

        oPC = GetNextPC();
    }
    oPC = GetFirstPC();
    while (GetIsObjectValid(oPC)) {
        if (GetLocalInt(oPC, "AlignmentBoot")) {
            DeleteLocalInt(oPC, "AlignmentBoot");
            RemoveFromParty(oPC);
        }
        oPC = GetNextPC();
    }
}
That's not compiled, but it should work. A more precise method would involve looping each pc's factionmembers with GetFirstFactionMember and checking for GetAlignmentGoodEvil mismatches, but then you'd need a second variable so you didn't recheck pcs as you continued through the primary loop. Again, I don't think lag would be an issue, I just don't feel like coding up another highly redundant example. LMK if you want the other.
 
Funky
               
               

               


                     Modifié par FunkySwerve, 20 octobre 2010 - 09:34 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
trying to restrict a party
« Reply #4 on: October 21, 2010, 12:27:51 am »


               Just out of curiosity..what do you want to happen to neutral aligned players? Should they also be in their own party or can they join with anyone?
               
               

               
            

Legacy_AwakenerOfArmageddon

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
trying to restrict a party
« Reply #5 on: October 21, 2010, 12:35:59 am »


               Thanks funkyswerve. that looks like it will do what I want.

GhostOfGod wrote...

Just out of curiosity..what do you want to happen to neutral aligned players? Should they also be in their own party or can they join with anyone?


for now I have removed neutral (true nuetral) characters by making them pick either good or evil when they first enter the mod.

AoA
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
trying to restrict a party
« Reply #6 on: October 21, 2010, 01:01:02 am »


               Just another way of doing it by checking the faction leader. Also added a line and commented it out for future use if you want to allow neutral alignment. If I thought it out correctly it should work as well.


void main()
{
object oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
    {
    object oLeader = GetFactionLeader(oPC);
    if (GetIsObjectValid(oLeader))
        {
        int iAlign1 = GetAlignmentGoodEvil(oLeader);
        int iAlign2 = GetAlignmentGoodEvil(oPC);
        if (iAlign1 != iAlign2)
        //if (iAlign1 != iAlign2 && iAlign2 != ALIGNMENT_NEUTRAL)
            {
            RemoveFromParty(oPC);
            SendMessageToPC(oPC, "You have been removed from party due to an alignment conflict.");
            }
        }
    oPC = GetNextPC();
    }
}
               
               

               
            

Legacy_AwakenerOfArmageddon

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
trying to restrict a party
« Reply #7 on: October 21, 2010, 09:42:30 pm »


               Thanks! I cant test either of them yet but when I do I will let you know how it goes



AoA