Aller au contenu

Photo

How to make feats


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

#26
Morbane

Morbane
  • Members
  • 1 883 messages

you might like to put a do once in the spellid spell just to be sure - infinite loop anyone? >:)



#27
Morbane

Morbane
  • Members
  • 1 883 messages

ya if it is a stat increase - receiving the feat will run your script once raising your stats then its final - in that cae i think it can be persistent so that it cannot be activ-ated over and over raising a stat to the limit in a few minutes

you might experiment with the choice of persistent or neither - given the possibility of it running once by default then bang - your stat feat is done and dusted



#28
kevL

kevL
  • Members
  • 4 052 messages

don't need to attach a spellscript/spellID

just create the feat, leave it like Bully, and in a custom script where the feat is granted, do the stat increase also


Once the feat is granted, you can further do a check for it to open special dialogs, enter locked areas, etc. SoZ Teamwork feats are like this; they don't have spellscripts, relying instead on the SoZ plot & scripting to check for TW feats and apply any consequences,

 

( meaning the TW feats are pretty useless unless playing SoZ or a mod that's designed to handle them )



#29
andysks

andysks
  • Members
  • 1 645 messages

This seems like a nice shortcut. "Fooling" the player that he got the stats via a feat, but it's scripted instead. In my experience, ga_effect didn't work for stats increase/decrease. Don't know why. I used a script made by lilacs for another instance where I needed something like that.

void main()
{
    effect eEffect;

    // Get the PC who is in this conversation.
    object oPC = GetPCSpeaker();

    // Apply an effect.
    eEffect = SupernaturalEffect(EffectAbilityIncrease(ABILITY_CONSTITUTION, 1));
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
}

 

I haven't tested if it goes away or anything. If I recall resting doesn't make it go away. Changing modules and stuff... no idea. The fact that it shows like a buff though, is there any way to remove this? This is a standalone script. I might have to make it a ga_ so that I use it more often. Also, skill increase the same way right? As attributes.



#30
kevL

kevL
  • Members
  • 4 052 messages

huh, here i thought it would be as easy as using a console command... But i notice this:

// MAP 3/15/2009
// !EXPERIMENTAL
// Note that any changes to skill rank will NOT be lost if the character is de-leveled.
// IMPORTANT: Most usages of this will cause characters to fail 'enforce legal character' restrictions.
void SetBaseAbilityScore(object oCreature, int nAbilityType, int nScore);

you could try GetAbilityScore() add one, then this. There's a corresponding function for skills too
  • Morbane aime ceci

#31
andysks

andysks
  • Members
  • 1 645 messages

I just tried a fast one, and it worked. I mean the feat was given to the character. The ga_effect is indeed malfunctioning.

I guess when messing with ability scores one needs to care about legal characters huh? I am already using some tomes as loot I found in the vault, but comments said they're safe I think. In any case, the scripted reward should make my life easier messing with 2das.

If I may ask, why you posted this function as problematic? Because of the legal past or the de-level? Because I think the lilacs won't have a problem. It uses the same function as in ga_effect. ApplyEffectToObject. Since I don't plan to give more than a +1 reward, I could create 6 script identical, but for each ability score. The skills are complicated. They're a lot, and a ga_ script is necessary. But I think now the topic is moving towards the scripting forums :).



#32
kevL

kevL
  • Members
  • 4 052 messages

yeh iirc ga_effect has problems. Try my rewrite if you like: ga_effect

'legal characters' -- for SP if it has any noticeable effect it can be changed clientside in the .Ini ( or so i think.. )

I didn't mark SetBaseAbilityScore() as !EXPERIMENTAL, btw. They did. But if it works, the effect icon probably won't appear, which'd be the big bonus to weigh off against the legal characters/ delevelling mumbo



#33
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

You also need the Feats.2da to make reference to the Spells.2da for useable types.

EDIT: Sorry, just noticed there was second forum page that I had not read.

Lance.

#34
andysks

andysks
  • Members
  • 1 645 messages

Hey something came to my mind right now. It might be a long shot, but let's see. Could one copy the line of the epic attribute feat, which anyway raises the attribute by 1, and just change the epic column to 0, name, description and the category to history? Won't this then have the same effect but with a different text and name?



#35
andysks

andysks
  • Members
  • 1 645 messages

Ah I just noticed that the epic feats also use to spellID so it's probably the epic part of them that makes the job of attribute increase.



#36
Morbane

Morbane
  • Members
  • 1 883 messages

 

huh, here i thought it would be as easy as using a console command... But i notice this:
 

// MAP 3/15/2009
// !EXPERIMENTAL
// Note that any changes to skill rank will NOT be lost if the character is de-leveled.
// IMPORTANT: Most usages of this will cause characters to fail 'enforce legal character' restrictions.
void SetBaseAbilityScore(object oCreature, int nAbilityType, int nScore);
you could try GetAbilityScore() add one, then this. There's a corresponding function for skills too

 

just as an FYI - the "enforce legal character" is usually just a setting for MP games, and can be changed on or off when loading every instance of the module. PWs would be different though, but like kevL said custom stuff like Feats are only useful in the Module they were designed to be used in. so that revives the issue of keeping the stat changes between single campaign modules....



#37
kevL

kevL
  • Members
  • 4 052 messages

I'd like to hear the results of that function.. 'cause i suspect it changes an ability permanently. That is, it'll write a new int_value straight into the GFF/ .Bic / character file ( like a console or DM command ). hence no effect icon because it's not an effect : it ought change the core value.

 

/eh?



#38
andysks

andysks
  • Members
  • 1 645 messages
I'll try it when I get home. And transit modules to see if it keeps the value.

#39
kevL

kevL
  • Members
  • 4 052 messages

Be careful, or at least 'aware' if you make a save after running that function in a script. I believe that's what makes the change to a character permanent-permanent. (although it can still be altered manually with a tool like TlkEdit2)



#40
andysks

andysks
  • Members
  • 1 645 messages
As morbane said, this is meant for single player module. Now, if someone wants to use this character on a PW... I mean come on :). But perhaps I should mention it on the description just in case. All this of course after the test. Maybe I should also check the tag based scripts for these tomes I use.

#41
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

I'd like to hear the results of that function.. 'cause i suspect it changes an ability permanently. That is, it'll write a new int_value straight into the GFF/ .Bic / character file ( like a console or DM command ). hence no effect icon because it's not an effect : it ought change the core value./eh?


Hi,

I have used this function in my campaign and it does alter abilities up and down according to the value used. It does it at core level, so changes are permanent! Great function ... :)

Lance.

#42
andysks

andysks
  • Members
  • 1 645 messages

Lance, I was thinking of talking to you about it. I know you use such rewards, and was wondering how you do it.



#43
-Semper-

-Semper-
  • Members
  • 2 256 messages

the stock feats as Bully for example have all their columns defaulted *****. Even the SpellID column. How does the game recognize that I need +1 to intimidate and fortitude and -1 to bluff -2 diplomacy? Surango said I need new IDs if I make background feats, so why the stock ones use none? I even opened the spells.2da, and the bully's ID is never to be found. I don't know if it's bullying the 2da, but... it is strange to me. How the attributes get raised or lowered with no reference.

 

 those feats are hardcoded directly in the engine and need no reference.



#44
andysks

andysks
  • Members
  • 1 645 messages

So the magic word is heard again. Hardcoded :).



#45
kevL

kevL
  • Members
  • 4 052 messages

tks Lance

 

 

[edit] andy, there's also one for skills ...



#46
andysks

andysks
  • Members
  • 1 645 messages

Hmm. I was just talking with Tchos about this, and he said something quite interesting. If you increase the skill, and then gain a level, maybe the engine won't let you put another rank on it if it's maxed with the boost... So this one's trickier :).

 

(Edit) Why is so complicated to add attribute boosts in this game via scripts? Is it plainly for the MP part of it? Because it makes no sense to me that a D&D game can have no such rewards and what not. Complicated I mean... what with the !EXPERIMENTAL parts of the scripts and the warnings.



#47
kevL

kevL
  • Members
  • 4 052 messages

Tchos is quite right: skills is trickier. Getting the base skill to do a modification from may or may not be nontrivial (haven't tried it), and i guess his point is: What happens on levelup?

Does the engine calculate from a skillrank-base of 0, or does it simply "add 5" each level (regardless of how many skill points have currently been spent)

!!SCIENCE!!


/dwarffortress

The 'enforce legal characters' thing must do calculations based on a 0th-level character, otherwise it'd lose its meaning. But what happens to an SP character IG can be, and i'm guessing probably is... different. These questions are why the functions are noted !Experimental; yet something to further consider is that, at least for abilities, a straightforward console command like "SetSTR" can be used to accomplish what I believe is exactly the same thing as the function does, at more or less any time.

But note the date which these two functions were broken out from hardcoding: 2009. That's late in development, for NwN2. Hence lack of testing and lack of understanding the full, or potential ramifications could have led to the warning.



#48
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Lance, I was thinking of talking to you about it. I know you use such rewards, and was wondering how you do it.


Hi andysks,

I am not sure I know what you mean? I mean all I did was use it in the format it says:-

E.g. SetBaseAbilityScore(oPlayer, ABILITY_CHARISMA, NewScore);

This then sets the CHARISMA to the NewScore on the oPlayer.

I have this on a magik device that the player can interact with. I do a few checks on the PC in question to make sure the new stat will not go above or below certain values and then apply the result if it's OK to do so.

I am not worried about any repercussions in any other respect, as I am not concerned about "strict ruling". i.e. Forward or backward ramifications to skills, etc.

Does that explain what you were after ... or have I not understood your question properly?

Lance.

EDIT: For your heads up, I checked things like racial adjustments (because the base attribute you work with does not consider this) and whether adjusted attributes would cause a PC to die. e.g. If the change lowered a PC's CONSTITUTION and caused them to drop enough HPs to kill them. On the plus side, I am really pleased with the results that make the device what it is, and look forward to players using it ... and seeing what feedback I get about it. :)

#49
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

<SNIP> ... But this is all I want to do. Add some feats that require no activation, are always there and raise some attributes or skills. Why is this so hard for me... :huh: ?


Hi Again,

I have done this. It is not as simple or straightforward as you may think. Here is my approach:-

1) Define feat constants: E.g. const int FEAT_EPITHET_ACCIDENTS = 2874; // 2874 if the feat line number. (*)
2) Feat name and description in feat.2da refer to entries in a custom.tlk file.
3) Make a non-drop item that the PC carries. I have a book called "Trade Skills", which "new feats" update as they are acquired.
4) Keep track of *all* feats (and skills they affect) via a single "feat script" where you can add the total amount of "skill benefits" in one function and apply the skill bonuses (or penalties) to the item as item properties.
5) Destroy item and create new at each new skill that alters skills.

(*) I have a separate "constants" file, where I list all these constants.

Cheers,
Lance.

EDIT: BEWARE: I would recommend treating only skill adjustments with feats and NOT attributes. While they may appear similar, my experience is they should definitely be treated differently. i.e. Bonus/penalty kills via feats, but NOT attributes!

EDIT 2: I also have some "tomes" that must be learned over a period of time. At the end of which, attributes are raised using the function like this:-

int NewScore = GetAbilityScore(oPC, iAbility, TRUE) + iBonus;
SetBaseAbilityScore(oPC, iAbility, NewScore);

EDIT 3: I have done a load of this kind of thing for my campaign. Once that gets released, I reckon there should be enough examples in it to provide builders with enough info for all sorts of things. ;)

#50
andysks

andysks
  • Members
  • 1 645 messages

I think the matter is pretty much resolved now. Lance, thanks for the feedback. Your campaign I believe will be a tutorial for many people. The custom things you do is pretty amazing I have to say.

As for the topic itself, ga_ sripts are my doom. Tchos helped me once again with them. So I will have the feat as a simple reference as to what the PC gets, and the moment he gets it the script will fire with the function SetBaseAbilityScore adding a value. Skills I forget about. I won't make my life TOO hard :D.

 

Edit: Lance, the attribute raise BEWARE part. If it is done through a convo, using the cool function... it shouldn't be a problem right? This way, the feat is there just for player reference and the boost is given behind the scenes.