Aller au contenu

Photo

Give Feat


  • Veuillez vous connecter pour répondre
26 réponses à ce sujet

#1
Ralthis

Ralthis
  • Members
  • 55 messages
Hi all,

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

Thanks!

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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 .


#3
Ralthis

Ralthis
  • Members
  • 55 messages
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?

#4
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
  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 .


#5
Ralthis

Ralthis
  • Members
  • 55 messages
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 .


#6
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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.

#7
Kato -

Kato -
  • Members
  • 392 messages
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 .


#8
Kato -

Kato -
  • Members
  • 392 messages

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


#9
Xardex

Xardex
  • Members
  • 217 messages
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 .


#10
Ralthis

Ralthis
  • Members
  • 55 messages
Thanks again Bard.

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

#11
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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.

#12
Xardex

Xardex
  • Members
  • 217 messages
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 .


#13
MyKiara

MyKiara
  • Members
  • 11 messages
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 .


#14
Kato -

Kato -
  • Members
  • 392 messages

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 

#15
MyKiara

MyKiara
  • Members
  • 11 messages

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 .


#16
Kato -

Kato -
  • Members
  • 392 messages
No problem. If you need any help, simply pm or email me, and although I could never replace Funky(who could anyway?), I'll be glad to help you with the basics.

Kato
(kato2200@gmail.com)

#17
Xardex

Xardex
  • Members
  • 217 messages
Use nwnx_funcs. Unlike letoscript, its just a bunch of new functions in an include script and you can do pretty much everything with it that leto can, and more. Letoscript is hard to get into, no matter what anyone says. Also to my understanding leto requires player booting to change the .bic's while nwnx_funcs does not.

Modifié par Xardex, 18 juin 2011 - 04:21 .


#18
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

Xardex wrote...

Use nwnx_funcs. Unlike letoscript, its just a bunch of new functions in an include script and you can do pretty much everything with it that leto can, and more. Letoscript is hard to get into, no matter what anyone says. Also to my understanding leto requires player booting to change the .bic's while nwnx_funcs does not.

That's all correct. The thing that motivates most people to use leto instead is unrelated to any of this, and something I make a point of posting when I mention it: nwnx_funcs requires linux.

Funky

#19
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
There is a version of nwnx_funcs for windows. Stat changes, feat adding and removing, and the other basics are there.

That said, since most of the scripts are developed in the linux version then ported over, the linux version of nwnx has far more options.

#20
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
Fair enough. I tend not to count it, but it looks like it's seen quite a bit of work since I last took a peek. :P

Funky

#21
acomputerdood

acomputerdood
  • Members
  • 219 messages
i don't know if i'm missing something here, but i installed the nwnx_functions plugin, but don't see how one would implement this with the following functions available:


int GetArmorAC(object oObject);
void SetArmorAC(object oObject, int iAC);
void SetGoldPieceValue(object oObject, int iValue);
void SetTag(object oObject, string sValue);
void SetRacialType(object oObject, int nRacialType);
int GetDescriptionLength(object oObject);
string GetDescription(object oObject);
string SetDescription(object oObject, string sNewDescription);
string GetConversation(object oObject);
int GetUndroppableFlag(object oItem);
void SetUndroppableFlag(object oItem, int bUndroppable);
int GetItemWeight(object oObject);
void SetItemWeight(object oObject, int nWeight);
string GetEventHandler(object oObject, int nEventId);
void SetEventHandler(object oObject, int nEventId, string sScript);
int GetFactionID(object oObject);
void SetFactionID(object oObject, int nFaction);
float GetGroundHeight(location lLocation);
int GetIsWalkable(location lLocation);
object GetFirstArea();
object GetNextArea();
void Set2DAString(string s2DA, string sColumn, int nRow, string sValue);
void SetMovementRate(object oCreature, int nMovementRate);
void ActionUseItemOnObject(object oItem, object oTarget, int nPropertyNum = 0);
void ActionUseItemAtLocation(object oItem, location lLocation, int nPropertyNum = 0);
int GetPCPort(object oPlayer);
void BootPCWithMessage(object oPC, int nStrRef);
int JumpToLimbo(object oObject);
int GetIsVariableValid(struct scriptvar svVariable);
struct scriptvar GetFirstLocalVariable(object oObject);
struct scriptvar GetNextLocalVariable(object oObject);
int GetItemCount(object oTarget);
object GetItemByPosition(object oTarget, int nPosition);
object IntToObject(int nObjectID);

this was the "complete function list" from the readme of 1.9.0.  is there more complete documentation somewhere else?

Modifié par acomputerdood, 11 septembre 2012 - 09:52 .


#22
Squatting Monk

Squatting Monk
  • Members
  • 444 messages
No, you want nwnx_funcs, not nwnx_functions.

Modifié par Squatting Monk, 12 septembre 2012 - 12:17 .


#23
acomputerdood

acomputerdood
  • Members
  • 219 messages
i'm going to go ahead and guess you have to turn off Enforce Legal Characters on the server if you use the AddKnownFeat() func, yes?

or is there another way around it?

#24
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

acomputerdood wrote...

i'm going to go ahead and guess you have to turn off Enforce Legal Characters on the server if you use the AddKnownFeat() func, yes?

or is there another way around it?


Having never used nwnx,  I am going to guess yes,

A Way Around it,  Hmm,  If the AddFeat function lets you remove feats also,  Or if there is a function that allows you to remove feats.    I guess that you could add a  few extra Dummy feats to the Character class, and remove them when you add a new feat.   I dont know I would have to think about and work that out.

Main Question: Can you also remove feats?

#25
Squatting Monk

Squatting Monk
  • Members
  • 444 messages
You will need to turn off ELC (or replace it with a scripted system), yes. If you're going to be consistently giving the same feats out, you may see if there are any 2da edits that would make your feat changes legal. Ravine mentions having done this here.