Author Topic: Player Selected Faction - For PvP  (Read 396 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Player Selected Faction - For PvP
« on: May 13, 2012, 05:32:13 pm »


               I'm wondering what the best practice is to have players choose a constant faction throughout a persistant world with pvp?

 On entering the world, they need to select either to fight for the good guys or the bad guys. I know a few way around this, but I am wondering the 'best practice' version (as I'm sure if I wing it, I'll be banging my head after a few days.)

Thanks as always.


*Side note* BEST community and player base in any game ever. Thanks to you all for keeping this freaktastic game alive.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #1 on: May 14, 2012, 09:50:46 pm »


               bump
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #2 on: May 14, 2012, 10:23:24 pm »


               <seeing lf's bump...>

From a play perspective or scripting?
From a play perspective, confront the player with a series of confrontations and see who they aid (if any). Assign faction based on actions rather than convo. Give them the option of helping the poor caravan or helping to loot it.

(edit to be clear: I'm suggesting you put NPCs of opposing factions into situations where the new PC can be the deciding factor without any other personal commitment (he gains/risks the same regardless of decision). In fact, turn the tables later on and see if he sticks to the same faction. If yes, he's commited to that faction. If not, return to step one.)

Just make sure there are mechanisms later to adjust that faction if they are unhappy.

My opinion, of course. ;-)

<...and raising it>
               
               

               


                     Modifié par Rolo Kipp, 14 mai 2012 - 09:30 .
                     
                  


            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #3 on: May 15, 2012, 02:49:56 am »


               It looks like the player enters with the faction PC. Upon entering, I would like the player to select what faction they want to play for: faction1, faction2, faction3 etc.

I've added the factions I would like in my module, but need to be able to set the player to faction2 from a conversation and I'm not sure how to.
               
               

               
            

Legacy_SKIPPNUTTZ

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #4 on: May 15, 2012, 02:54:41 am »


               Sounds similar to Bastions of War pvp server, who just did this with a conversation file. You couldn't access the actual gameworld without choosing Good or Evil via a conversation in the starting area. Which would change your alignment to the side you chose. This was probably done with DB entries for persistence though. I guess you could alternately make undroppable player tokens for each faction instead.

Without knowing more about what kind of gameworld you are making, it's rather hard to give you an ideal way to do this.

under the function ChangeFaction:

"PCs cannot change factions."

Guess this is why BoW was strictly Good alignment VS Evil alignment.
               
               

               


                     Modifié par SKIPPNUTTZ, 15 mai 2012 - 02:02 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #5 on: May 15, 2012, 03:58:48 am »


               I've never messed with factions much but just thinking about it now I have a couple ideas. Not sure how usefull they'll be since this isn't actully from "practice".

As far as just being a part of a faction you would have the players pick a faction via a conversation (same thing you were already thinking) which could do one of a few things:
-If you are using NWNx you could just set a variable for that player that indicates which number faction they are in.
-You would do basically the same thing even if you are not using NWNx but by setting the variable on an item the player has.
-Or if you want you could just give each player a different item that is specific to each faction and just check for the item rather than a variable.

Once you've done the above you could then do simple checks in conversations, quests, perception or whatever you need to, for the player's faction simply by checking for the variable or the item.

Now if you want to enforce players disliking eachother if they are in different factions you might be able to give all players an AOE, that when any other player enters it, would check to see which faction the entering player is in and if it was different then you could use the "SetPCDislike" function to make the players hostile to eachother. You could also make use of the AOE's heartbeat script to ensure that if a player manually sets it back to "Like" while inside the AOE, the script would turn it back to dislike.

You could even alter your module's OnDeath script to check the last killer and see which faction they are in for something like faction kill rewards or what not.

Again not sure if any of this is usefull. Just figured I'd share some thinking outloud so to speak.
               
               

               


                     Modifié par GhostOfGod, 15 mai 2012 - 09:58 .
                     
                  


            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #6 on: May 16, 2012, 01:30:58 am »


               What about an Area OnEnter script that would change the individual reputation of players and nps in the area based on a data saved to an inventory item? If that's possible, how would that even look?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Player Selected Faction - For PvP
« Reply #7 on: May 16, 2012, 03:27:24 am »


               Now just so you know there is no actual reputation functions or actual faction functions that can be used with players. These only work for NPCs. You need to make everything up with variables. So as far as players being hostile to eachother you can only use the "SetPCLike" or SetPCDislike" functions. This is the same thing that happens when a player manually gos into the player list and sets the Like/Dislike for other players. That being said, you can script this in an area's OnEnter event BUT the player can then just go into the list and manually set it back. They can do this at any time which is why I suggested an AOE. Even in an AOE the player can manually set the like/dislike back but if the AOE is also using a heartbeat script to keep checking then at least it will keep changing the like/dislike to the appropriate setting every 6 seconds. It's by no means a fool proof way for people to keep hostile to appropriate factions but at least it is a deterent and a means.

But anyway this is what an area's OnEnter script might look like for something like this (and this script uses a database item as example for persistence) and this is ONLY for players not NPCs:

void main()
{
    object oPC = GetEnteringObject();
    object oMyArea = OBJECT_SELF;
    object oMyDBItem = GetItemPossessedBy(oPC, "Tag Of DB Item");
    int iMyFaction = GetLocalInt(oMyDBItem, "MY_FACTION");
    object oOther = GetFirstPC();
    object oOtherArea;
    object oOtherDBItem;
    int iOtherFaction;

    while (GetIsObjectValid(oOther))
    {
        oOtherArea = GetArea(oOther);
        if (oMyArea == oOtherArea)
        {
            oOtherDBItem = GetItemPossessedBy(oOther, "Tag Of DB Item");
            iOtherFaction = GetLocalInt(oOtherDBItem, "MY_FACTION");
            if (iMyFaction != iOtherFaction)
            {
                SetPCDislike(oPC, oOther);
            }
            else
            {
                SetPCLike(oPC, oOther);
            }
        }
        oOther = GetNextPC();
    }
}


As for NPCs there are some things to take into consideration.  Like if the NPCs in the area will even exist when a player first enters. And then do you really want to loop through all the objects in the area to get each NPC and then set is friend enemy etc.
Instead you might want to give NPCs a custom perception script or alter the default one (which would probably be easier).
Something like this might work for a custom OnPerception script which would then also run the default one:

void main()
{
    object oPercep = GetLastPerceived();
    int iMyFaction = GetLocalInt(OBJECT_SELF, "MY_FACTION");
    object oPercepDBItem = GetItemPossessedBy(oPercep, "Tag of DB item");
    int iOtherFaction = GetLocalInt(oPercepDBItem, "MY_FACTION");

    if (iMyFaction != iOtherFaction)
    {
        SetIsTemporaryEnemy(oPercep, OBJECT_SELF);
    }

    ExecuteScript("nw_c2_default2", OBJECT_SELF);
}

Again this is not in practice just thoughts but I still hope it helps ya. Good luck.
               
               

               


                     Modifié par GhostOfGod, 16 mai 2012 - 02:49 .