Author Topic: possable to set PC to Special faction script, On player Enter script.  (Read 752 times)

Legacy_Araticus

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0


               so i ve been wondering how would one go about Adding a PC to a faction in the game.
ex. John is a PC and who also wants to join the Knights of Alexandria, the KoA are fighting the Knights of Kione. is it possable to giv the player eiter an item that makes him part of the faction? or is there a Special script i can use to add the PC to the Faction?

Also i want a Script were when the player enters the server, if Part of a faction he or she will recive Gold and EXP, the gold and Exp of course being for there training while being part of the faction.

Anyone thing they can help me out?
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #1 on: December 17, 2010, 07:15:30 pm »


               Your PCs faction is who you like, not who likes you. A PC has his own faction.  The player gets to decide who he likes, the programmer has no say in it.  You can, however, make the NPC's hostile or friendly to the PC using their factions.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #2 on: December 17, 2010, 07:41:00 pm »


               On SM, we split the PCs into good/evil by giving the PC a no-drop item. Then when the NPCs perceive the PC they will check weather the PC has the good or evil item. If the NPCs are part of the good faction and the PC has the good item no probs but if the PC has the evil item they attack. So you could create the different factions then have items for them and have the differing factions check for said items and react accordingly.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #3 on: December 17, 2010, 08:09:21 pm »


               Note

In terms of factions and how they work in nwn.

A faction is basically another term for 'party'



If you use the AddToFaction function or whatever it is called, on two Players, it will make them 'join' eachothers party.



If you do however manage to 'set' the faction of a player to one of the NPC general factions, it can have adverse results.



Eg - Hundreds of npcs appearing as party members, sometimes not possible to get out through doorways etc...



I have used the dm console to set factions mainly for roleplay reasons, allowing me to make a dragon friendly to players, or to make a commoner suddenly become hostile. etc



In short, if you want to affect how a faction feels towards you or your players, you need to Alter your reputation in the eyes of that faction.



This is how alot of PW's are set up, making vampire players friendly to other vampires, but hostile to humans, or humans friendly with Humans, but hostile to the undead etc....

Note  - if you want to take this one step further, you can actually force pvp via setting player hostility towards one another, if they are of differing factions.



I do this in my new module, and have the pvp controls hooked in nwnx, preventing friendly behavior towards others of different race. (Partying however allows co-op - Im not a completely evil person)
               
               

               
            

Legacy_Araticus

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #4 on: December 17, 2010, 09:07:58 pm »


               ok i may have to look into the Non-drop items. any idea where i could start for finding a script to make the items?



And what of the on player enter gold exp script? how would i go about doing that?
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #5 on: December 18, 2010, 01:09:40 pm »


               Vidorin's Factions By Token System

Kingdom of Paramon PW

If you use the Kingdom of Paramon module there is a faction system in there that allows you to do some nice things.

Second God War

2nd God has some great features and ideas as well.



And for a easy to use set up script of gold and all that, Sir Elric's Simple New Player Setup v1.5 does not get much easier to use.
               
               

               
            

Legacy_MiraQ

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #6 on: January 07, 2011, 04:45:14 pm »


               Say you create an item for the Knights of Alexandria. Let's give it the tag "faction_koa". In the OnClientEnter event in your module, the PC (GetEnteringObject()) will be oPC below.
- Create two NPCs in areas in your module where they won't be disturbed by anything. They can't be invulnerable or immortal. Their tags could be "factionnpc_koa" and "factionnpc_kok".
- Include nw_i0_plot in your OnClientEnter script, so HasItem will work (#include "nw_i0_plot").
- Do the following modification to the OnClientEnter event:

if(HasItem(oPC, "faction_koa"))
{
   //Set factions friendly and hostile
   AdjustReputation(oPC, GetObjectByTag("factionnpc_koa"), 100);  //KoA faction will be friendly
   AdjustReputation(oPC, GetObjectByTag("factionnpc_kok"), -100);  //KoK faction will be hostile

   if(!(GetLocalInt(oPC, "faction_koa"))
   {
      //Reward gold and exp
      GiveXPToCreature(oPC, 100);
      GiveGoldToCreature(oPC, 100);
      SendMessageToPC(oPC, "You have received gold and exp for training as a Knight of Alexandria.");

      //Make sure this only happens the first time you log in so it can't be exploited by logging in and out all the time.
      SetLocalInt(oPC, "faction_koa", 1); 
   }
}
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #7 on: January 07, 2011, 07:25:12 pm »


               

MiraQ wrote...

Say you create an item for the Knights of Alexandria. Let's give it the tag "faction_koa". In the OnClientEnter event in your module, the PC (GetEnteringObject()) will be oPC below.
- Create two NPCs in areas in your module where they won't be disturbed by anything. They can't be invulnerable or immortal. Their tags could be "factionnpc_koa" and "factionnpc_kok".
- Include nw_i0_plot in your OnClientEnter script, so HasItem will work (#include "nw_i0_plot").
- Do the following modification to the OnClientEnter event:

if(HasItem(oPC, "faction_koa"))
{
   //Set factions friendly and hostile
   AdjustReputation(oPC, GetObjectByTag("factionnpc_koa"), 100);  //KoA faction will be friendly
   AdjustReputation(oPC, GetObjectByTag("factionnpc_kok"), -100);  //KoK faction will be hostile

   if(!(GetLocalInt(oPC, "faction_koa"))
   {
      //Reward gold and exp
      GiveXPToCreature(oPC, 100);
      GiveGoldToCreature(oPC, 100);
      SendMessageToPC(oPC, "You have received gold and exp for training as a Knight of Alexandria.");

      //Make sure this only happens the first time you log in so it can't be exploited by logging in and out all the time.
      SetLocalInt(oPC, "faction_koa", 1); 
   }
}


I've not tried it yet, but since placeables use factions, couldn't they be used for referrences instead of NPCs as is usually suggested? I'm just curious. '<img'> If they can, would that be the best method as well? IE... would a placeable demand fewer resources?
               
               

               


                     Modifié par kalbaern, 07 janvier 2011 - 07:26 .
                     
                  


            

Legacy_MiraQ

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
possable to set PC to Special faction script, On player Enter script.
« Reply #8 on: January 08, 2011, 01:59:17 am »


               According to the NWN Lexicon, it won't work to use a placeable as reference.
http://www.nwnlexico...reputation.html