Author Topic: Give Feat  (Read 640 times)

Legacy_Ralthis

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Give Feat
« on: June 16, 2011, 11:16:23 pm »


               Hi all,

Is there a function, or a series of functions, that allow a PC to permanently gain a feat?

Thanks!
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Give Feat
« Reply #1 on: June 16, 2011, 11:23:51 pm »


               With NWNX, yes. Otherwise, the best you can do (that I know of) is adding the feat to the PC skin, which is what I had been doing before I finally switched over to NWNX as well.
               
               

               


                     Modifié par Failed.Bard, 16 juin 2011 - 10:24 .
                     
                  


            

Legacy_Ralthis

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Give Feat
« Reply #2 on: June 17, 2011, 02:01:00 am »


               I'm not sure if I can convince my friends to switch over to NWNX. How would I add the feats to the PC's skin?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Give Feat
« Reply #3 on: June 17, 2011, 02:34:27 am »


                 This is all you need in a script to add a feat to any item, in this case the PC skin.  I chose Knockdown as an example for this script.  You'll still have to determine the method of assigning the PC, OBJECT_SELF really only gets the PC if it's done in a spell script.
  The easiest way to see what bonus feats can be added is to copy/past this into the script editor, move the cursor to the IP_CONST_*, and press F2.  That should give you the full list of constants you can choose from.


#include "x2_inc_itemprop"
void main()
{
 // You'll have to decide what method you're using to assign the feat to know how
 // you're determining oPC.  OBJECT_SELF is just so it'll compile as is right now.
 object oPC   = OBJECT_SELF;
 
// if present, the creature skin is always in this slot, whether PC, NPC, or creature.
 object oSkin = GetItemInSlot (INVENTORY_SLOT_CARMOUR, oPC);

 // As an example, I've chosen knockdown as the bonus feat, but it can be any that's
 // been defined as being able to be a bonus feat.  I can't remember the 2da offhand.
 itemproperty ipSkin = ItemPropertyBonusFeat (IP_CONST_FEAT_KNOCKDOWN);
 
// I greatly prefer the safe add script to the standard add item property script.
 // You need the include in this script in order to access it, but it's worth it.
 // Four straight-forward lines and you're done.
 IPSafeAddItemProperty(oSkin, ipSkin, 0.0f, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, FALSE, FALSE);
}
               
               

               


                     Modifié par Failed.Bard, 17 juin 2011 - 01:35 .
                     
                  


            

Legacy_Ralthis

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Give Feat
« Reply #4 on: June 17, 2011, 02:55:46 am »


               Cool! Thanks Bard! That really helps a lot.

The reason I was asking for this is that I have some custom feats and I'm planning on doing some scripted checks to see whether the PC's have them or not. If I add the feats to their skins, would I have to check to see if their skins have the feat?
               
               

               


                     Modifié par Ralthis, 17 juin 2011 - 01:56 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Give Feat
« Reply #5 on: June 17, 2011, 02:59:36 am »


               If they're custom feats, that'll involve changes having to be made to iprp_feats.2da in order to support them being added as bonus feats.  That can be done entirely serverside as far as I know.

 As for checking it, GetHasFeat used on the player should report back that the player has the feat, whether they have it normally or it's granted by an item or on the skin.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Give Feat
« Reply #6 on: June 17, 2011, 08:20:55 am »


               It might also be worth checking if the feats granted by an item are acceptable as prerequisites for some other feats. I'm not sure, but I don't think it's the case. If you don't need the item feats as prerequisites, never mind. Otherwise, NWNX would be the way to go, as mentioned by Failed.Bard. If you ever need, I'll be glad to help you setup NWNX + Letoscript, wich will allow you to modify almost everything you want on your toons.

Kato
               
               

               


                     Modifié par Kato_Yang, 17 juin 2011 - 07:28 .
                     
                  


            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Give Feat
« Reply #7 on: June 17, 2011, 08:27:38 am »


               
               
               

               


                     Modifié par Kato_Yang, 17 juin 2011 - 07:28 .
                     
                  


            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Give Feat
« Reply #8 on: June 17, 2011, 10:36:24 am »


               NWNX is really quite easy to get up and running. You just throw stuff into your main folder and execute your server through a different exe, thats it.
               
               

               


                     Modifié par Xardex, 17 juin 2011 - 09:36 .
                     
                  


            

Legacy_Ralthis

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Give Feat
« Reply #9 on: June 17, 2011, 03:15:53 pm »


               Thanks again Bard.

Xardex, would that require the people who play my module to have NWNX as well?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Give Feat
« Reply #10 on: June 17, 2011, 03:51:33 pm »


               NWNX is essentially a script extender for the server, allowing extra functions to be hooked into the game.  While there is a playerside version of it, which I think acts as a preloader for haks for a mod, it's normally run entirely server side.
 The Linux version of it is far more developed at the moment, since the functions are generally written for it first then ported to windows, but both versions allow for permanent adding and removing of feats, as well as event hooking and other useful options not available in NWScript normally.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Give Feat
« Reply #11 on: June 17, 2011, 07:53:19 pm »


               I once thought like you now. Trust me, once you put it up once you'll never take it down. As I said, its simply another .exe from which to start your server, and with it you'll have more functions for scripts and events.
               
               

               


                     Modifié par Xardex, 17 juin 2011 - 06:53 .
                     
                  


            

Legacy_MyKiara

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Give Feat
« Reply #12 on: June 18, 2011, 03:22:58 am »


               How do you do the changes to the toons through NWNX.  I have it up and running our server but only as a watchdog for reboots and such.  I haven't used it for much else.  (Mainly because I had no idea what it all it is capable of!)

As far as changes can it change names and such without the player having to make a whole new toon?
               
               

               


                     Modifié par MyKiara, 18 juin 2011 - 02:23 .
                     
                  


            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Give Feat
« Reply #13 on: June 18, 2011, 06:27:22 am »


               

MyKiara wrote...

How do you do the changes to the toons through NWNX.  I have it up and running our server but only as a watchdog for reboots and such.  I haven't used it for much else.  (Mainly because I had no idea what it all it is capable of!)

As far as changes can it change names and such without the player having to make a whole new toon?

NWNX-Leto allows you to edit the .bic file of any toon. it means virtually any field of the bic file can be edited. Although FunkySwerve could probably tell you more than anyone on the subject, a good place to start to get the infos would probably be the NWNX web site. Simply google NWNX and you're there.(besides, it's amazingly instructive to examine the Higher Ground Legendary Levels system, wich uses NWNX-Leto to modify toons on level-up. Look at the script: hgll_inc_leto and many things will become clear)

Kato 
               
               

               
            

Legacy_MyKiara

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Give Feat
« Reply #14 on: June 18, 2011, 06:32:39 am »


               

Kato_Yang wrote...


NWNX-Leto allows you to edit the .bic file of any toon. it means virtually any field of the bic file can be edited. Although FunkySwerve could probably tell you more than anyone on the subject, a good place to start to get the infos would probably be the NWNX web site. Simply google NWNX and you're there.(besides, it's amazingly instructive to examine the Higher Ground Legendary Levels system, wich uses NWNX-Leto to modify toons on level-up. Look at the script: hgll_inc_leto and many things will become clear)


:crying:I will check all this out but as far as looking at a script to figure it out I may end up more lost than I am right now!  I have figured out some scripts and learned how to change by looking at them, but others give me a headache and I have no idea how to figure anything out on those.

Thanks though and I will go back to the NWNX website and see what I can learn from there too.  I am trying hard to learn the scripting and how things work.  I just did my first script completely from scratch and it didn't quite work the way I wanted it to.  
               
               

               


                     Modifié par MyKiara, 18 juin 2011 - 05:33 .