Aller au contenu

Photo

How to make feats


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

#51
Morbane

Morbane
  • Members
  • 1 883 messages
effect eSpot = EffectSkillIncrease(SKILL_SPOT, 3);
effect eListen = EffectSkillIncrease(SKILL_LISTEN, 3);
effect eSurvival = EffectSkillIncrease(SKILL_SURVIVAL, 3);
effect eSkills = EffectLinkEffects(eSpot, eListen);

eSkills = EffectLinkEffects(eSurvival, eSkills);
		
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSkills, oSelf);

oSelf is the PC

 

works fine but iirc the increase is shown on the character portrait - but for me it has meaning in the story.



#52
Morbane

Morbane
  • Members
  • 1 883 messages
// MAP 3/15/2009
// !EXPERIMENTAL
// set bTrackWithLevel = TRUE if you wish for the skill change to be associated with
// the character's level.  In other words, should the character lose the skill change
// if they lose their current level?
// IMPORTANT: Most usages of this will cause characters to fail 'enforce legal character' restrictions.
void SetBaseSkillRank(object oCreature, int nSkill, int nRank, int bTrackWithLevel = TRUE);

here is the skill version - i might use this for an advancement for what is happening in the above post - in my custom Feat domain :)



#53
andysks

andysks
  • Members
  • 1 645 messages

So here's how it went after testing it. The feat was given, and the ability score Strength of Aduin Harbor went from 14 to 15. Happy moments. Rested, still there. Then I changed module via the world map, and a weird thing happened. The attribute was still 15. But under history feats, instead of having one called TESTMYFEAT, I had Alertness. Now... this can't be right. Why Alertness as a history feat. The description and everything were from alertness as well. And now the clue! The icon I had picked for my TESTMYFEAT, was actually ife_CM_mysticunion, which looks like a bright person, with two more on his sides. This was the icon that alertness appeared with, and not with it's own. Head explosion! Then I noticed that alertness is the very first feat on the feat.2da. Maybe that's the best clue here.

Something I maybe should mention. Does it matter in which line I add my own feats? I guess it does. I saw the reserved ranges just now. Maybe my testing feat should be around 2570-2860 and alertness problem solved?

 

I put it to 2600 and I still see Alertness with a wrong icon when I change modules. Bright side, the ability score is there. I need to think of the bright side before I go crazy... :D



#54
Morbane

Morbane
  • Members
  • 1 883 messages

ResRef?



#55
andysks

andysks
  • Members
  • 1 645 messages

ResRef? You mean the tlk reference of the custom feat?

Or maybe the constant column? In any case, the tlk reference is on my custom tlk: 16777505 and 16777506.

The CONSTANT is *****. I saw on the read me file that it's totaly irelevant, and it's just for reference in the nwnscript.nss



#56
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi andysks,

Good to hear you almost have it as you want it. :)

With respect to switching modules, there are two things I have done that may be what you need to do:-

1) Make sure you have set your modules in a "campaign" and are associating scripts as "campaign scripts" and not "module" ones.
2) Make sure you have defined the feat as a constant somewhere in the campaign scripts: E.g. const int FEAT_EPITHET_ACCIDENTS = 2874;

This done, they should remain the same in all modules In your campaign.

Lance.

EDIT: Just tested mine and they work fine. On the other hand, I noticed another bug I have somehow introduced to do with module transfers ... oh well.

#57
andysks

andysks
  • Members
  • 1 645 messages

The 1st part is done. My module script sets are campaign scripts. But the second not. Good to know. Should I define it on the mod load event? Or it can be a library just for the custom feats that's included to the mod load?



#58
Morbane

Morbane
  • Members
  • 1 883 messages

ResRef? You mean the tlk reference of the custom feat?

Or maybe the constant column? In any case, the tlk reference is on my custom tlk: 16777505 and 16777506.

The CONSTANT is *****. I saw on the read me file that it's totaly irelevant, and it's just for reference in the nwnscript.nss

 

ya, thats what i meant - going from memory :)

 

i havent done much in the way of campaign style building - only single modules - so my input from here on will be kept in reserve for when my experience actually applies  :wacko:



#59
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

The 1st part is done. My module script sets are campaign scripts. But the second not. Good to know. Should I define it on the mod load event? Or it can be a library just for the custom feats that's included to the mod load?


Hi andysks,

All I did was to:-

1) Make a script called alb_constants and then add lines relating to these types of constants. i.e. There is NO void main or anything like that, but just a list of lines, like this :-

// FEAT CONSTANTS
const int FEAT_ALTHEA_ABILCONV = 2871;
const int FEAT_ALTHEA_ABILPAUSE = 2872;
const int FEAT_ALTHEA_ABILSORRY = 2873;

2) Made sure this file was added as an include at the top of the scripts that called these const ints.

 

This then (in my limited understanding of what is going on) allows the code to reference the feat constant lines all over the place wherever you use them.

 

Lance.



#60
andysks

andysks
  • Members
  • 1 645 messages

I got the library part. And this is what I was thinking about. I thought putting the script library as an include at my mod_load script, will cause the module to recognize my feat even if I enter a new module. Tested it and got alertness again. Might have to dig deep to see what happens there.



#61
andysks

andysks
  • Members
  • 1 645 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.

The skill works by the way. I had 2 in bluff, script made it 3. Leveled up, put it on 3 at the level up screen, and in game I had 4.



#62
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

I got the library part. And this is what I was thinking about. I thought putting the script library as an include at my mod_load script, will cause the module to recognize my feat even if I enter a new module. Tested it and got alertness again. Might have to dig deep to see what happens there.


Hi andysks,

It's not the fact that the library is an "include" in the module's load, but that your campaign scripts that call the feat in question, (e.g. 2871 in my example of the FEAT_ALTHEA_ABILCONV) refer to it via the const int throughout the campaign.

For example, when you give the PC the feat, you must do something like FeatAdd(oPC, 2871);. You have to make sure your library is added as an include at the top of the script that makes this AddFeat call, so that the function knows what feat you are talking about (i.e. Your new one).

Does that make sense?

Lance.


EDIT: Can you post your script that adds your new FEAT so that I can see what you are doing. Post the whole script, including any #include references. Thanks! Then, can you post your #include script so I can see how you are writing the library script.

EDIT 2: The other thing that occurred to me, did you make sure that your custom.tlk file is in the correct place and is the only one the campaign is referring. i.e. There are not any other feat.2da files hidden away anywhere else that the second module may be referencing by mistake?

#63
andysks

andysks
  • Members
  • 1 645 messages

Hi Lance. Thanks a lot for the help. The script I use to give the feat is actually a ga_give_feat. I noticed that this global script has
#include "ginc_param_const". I should probably duplicate this sript, name it as I wish, but include my library, "roe_ginc_const". It makes sense now that I saw this.

My include script is a test one created just for this purpose at the moment. It only has 1 line.

 

/*
*************************************************
Library defining feat constants
so that the feat stays between module transitions.

Placeholder. Move it to roe_ginc_const after making it work.

Andy 06.03.2014
************************************************
*/

const int FEAT_ROE_SPIRIT_SPEAKER = 2600;

 

That's all. I am familiar with writing libraries, that even have functions in them. I use them especially to control my companions and world travel. But anyway, I think the problem lies to the script that I used for giving the feat. If they have ginc_param_const as an include, there must be a reason for it :).



#64
Morbane

Morbane
  • Members
  • 1 883 messages
object GetTarget(string sTarget, string sDefault=TARGET_OWNER)
{
	object oTarget = OBJECT_INVALID;
	
	// If sTarget is blank, use sDefault
	if ("" == sTarget || "0" == sTarget) sTarget = sDefault;
	
	// Check if sTarget is a special identifier
	if (IsParameterConstant(sTarget))
	{
		string sIdentifier = sTarget;
		sIdentifier = GetStringUpperCase(sIdentifier);
		
		if (TARGET_OWNER == sIdentifier) 			oTarget = OBJECT_SELF;
		else if (TARGET_OBJECT_SELF == sIdentifier)	oTarget = OBJECT_SELF;
		else if (TARGET_OWNED_CHAR == sIdentifier)	oTarget = GetOwnedCharacter(OBJECT_SELF);
		else if (TARGET_PC == sIdentifier)			oTarget = GetPCSpeaker();
		else if (TARGET_PC_LEADER == sIdentifier)	oTarget = GetFactionLeader(GetFirstPC());
		else if (TARGET_PC_NEAREST == sIdentifier)	oTarget = GetNearestPC();
		else if (TARGET_PC_SPEAKER == sIdentifier)	oTarget = GetPCSpeaker();
		else if (TARGET_MODULE == sIdentifier)		oTarget = GetModule();
		else if (TARGET_LAST_SPEAKER == sIdentifier) oTarget = GetLastSpeaker();
		else
		{
			PrettyError("GetTarget() -- " + sIdentifier + " not recognized as special identifier!");
		}
	}
	else
	{
		oTarget = GetNearestObjectByTag(sTarget);	// Search area
		

		//EPF 4/13/06 -- get nearest misses if the owner is the object we're looking for
		//	so check and see if the target is OBJECT_SELF.  I'm putting this after the GetNearest()
		// call since string compares are expensive, but before the GetObjectByTag() call, since
		// that's liable to return the wrong instance.  We can move this to before the GetNearest() call
		// if this becomes a problem.
		if(!GetIsObjectValid(oTarget))	
		{								
			if(sTarget == GetTag(OBJECT_SELF))
			{
				oTarget = OBJECT_SELF;
			}	
		}
		// If not found
		if (GetIsObjectValid(oTarget) == FALSE) 
		{	
			oTarget = GetObjectByTag(sTarget);		// Search module
		}
	}

	// If not found
	if (GetIsObjectValid(oTarget) == FALSE)
	{
		PrettyDebug("GetTarget() -- Could not find target with tag: " + sTarget);
	}
	
	return (oTarget);
}

ginc_param_const.nss defines the above function :)

 

just for interest and the possibility of your defining your own GetTarget() without the fluff - if needed or desired.



#65
andysks

andysks
  • Members
  • 1 645 messages

Ah cool. ginc_prama_const just defines what we use in our scripts, like targets, durations etc etc. I thought it would be a library like we were talking about. But in any case, a duplicate of ga_give_feat with my library included will be tested later today :).

This topic huh...? :)



#66
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi Lance. Thanks a lot for the help. The script I use to give the feat is actually a ga_give_feat. I noticed that this global script has
#include "ginc_param_const". I should probably duplicate this sript, name it as I wish, but include my library, "roe_ginc_const". It makes sense now that I saw this.
My include script is a test one created just for this purpose at the moment. It only has 1 line.
 
/*
*************************************************
Library defining feat constants
so that the feat stays between module transitions.
Placeholder. Move it to roe_ginc_const after making it work.

Andy 06.03.2014
************************************************
*/

const int FEAT_ROE_SPIRIT_SPEAKER = 2600;
 
That's all. I am familiar with writing libraries, that even have functions in them. I use them especially to control my companions and world travel. But anyway, I think the problem lies to the script that I used for giving the feat. If they have ginc_param_const as an include, there must be a reason for it :).


Hi andysks,

Exactly! Do what you say here, and it should work fine. This will then allow your feat to be recognised as a const int throughout the campaign. (Assuming you have made your library a campaign script library... and you have associated all the relevant modules to the same campaign.)

Lance.

#67
andysks

andysks
  • Members
  • 1 645 messages

Alertness. Lol. Eliminating possible things that may cause this lead me to the solution... and understanding hopefully. So, after the include is there, and my feat on the custom 2da lines, I still get alertness on the history feats after changing module. The only possible solution I can think of, is that the columns of my custom feat are missing something or something is added wrong. I will post my line later today and I hope this will be the last thing I do in this topic. Except of the final thanks after this is resolved :).



#68
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Alertness. Lol. Eliminating possible things that may cause this lead me to the solution... and understanding hopefully. So, after the include is there, and my feat on the custom 2da lines, I still get alertness on the history feats after changing module. The only possible solution I can think of, is that the columns of my custom feat are missing something or something is added wrong. I will post my line later today and I hope this will be the last thing I do in this topic. Except of the final thanks after this is resolved :).


Hi andysks,

OK, I have run out of ideas now (apart from point 5 that you may not have considered) ... Just to do this check list though ...

1) Make a constant library that mentions your new feat line in the feat.2da.
2) Associate said library as an #include with all scripts that make reference to this feat.
3) Make sure you have a unique custom.tlk file that contains the correct name and description for the feat.
4) Make sure your feat.2da points to the correct custom.tlk lines.
5) Make sure *all modules* you are using use the same campaign scripts, haks and custom.tlk files.
6)Other feat.2da settings I have used (as they appear across the columns):- ICON; AllClassCanUse; SpellID, UsesPerDay, TARGETSELF; Constant; TOOLSCATEGORIES; MinLevel; FeatCategory; IsActive; IsPersistent; Instant. All other column settings are left default ****.

If you can tell me what settings you have for these columns for the feat you are trying to set up, then maybe we can get to the bottom of it.

Example of my HP Bar feat settings (ignoring the default settings of **** as I mention above):

FEAT_ALTHEA_OBSERVECON; FEAT (16777369); DESCRIPTION (16777370); ICON (ife_observecon); ALLCLASSCANUSE (1); SPELLID (1714); USESPERDAY (-1); TARGETSELF (1); Constant (FEAT_ALTHEA_OBSERVECON); TOOLSCATERGORIES (2); MinLevel (41); FeatCategory (HISTORY_FT_CAT); IsActive(0); IsPersistent (0); Instant (1).

Note the settings carefully and do not miss any out ... Also note ...

A) The feat and description numbers are the ones that I have set up in my custom.tlk, so yours will differ slightly.
B ) The icon image is one that I made up. Yours will reference any you have used.
C) The spell ID refers to the spells.2da line where I have set up a script to fire when the feat is used.
D) Note also that the Constant column refers to the same ref as you use to define your feat in the library. I keep my label and this line the same to make it easier to remember.

Also, I double checked my own feats (different types) to see if only certain types were working (or like yours failing), but mine all worked that I tested.

Hopefully, this will get you through,
Lance.

EDIT: I think the title of your post needs to be renamed: "How To Make Persistent Feats Across Modules". ;)
  • andysks aime ceci

#69
andysks

andysks
  • Members
  • 1 645 messages

Lol, topic title should indeed be renamed. You know, I see this so many times during my work with the toolset. Occam's razor. Searching all these 2das, and tlks and custom scripts and what not. Here what was happening. In my campaign module transitions happen only through world travel. But each map point has a condition on it, for when in the plot it will become visible. So, One of my newest modules, has its map point visible because I haven't done its condition yet. OK. When I was testing the transition, and if the feat will remain, I didn't want to also set a variable on the convo where I get the feat... so that I'm able to travel. So I was traveling to the module that's always visible. Did I mention that this module is new? Yes, I think I did. And of course, step 5: Make sure your modules have the same tlk and haks assigned to them! Well, this one had none. Once I put mine, the feat stayed put!

 

4 pages of comments. People, I don't know when your patience with me will run out... but I hope not too soon :D.

 

ps: Thanks all of course, as always. Kidding aside... you were grea help once more.

pss: Note made on the top of my logbook AND on my progress excel sheet AND on my Important Notes sheet AND on my ToDo list.

When creating a new module and attaching it to the campaign, before you do anything else, assign the script set, hak and tlk. Then there are like 100 exclamation marks :).



#70
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Lol, topic title should indeed be renamed. You know, I see this so many times during my work with the toolset. Occam's razor. Searching all these 2das, and tlks and custom scripts and what not. Here what was happening. In my campaign module transitions happen only through world travel. But each map point has a condition on it, for when in the plot it will become visible. So, One of my newest modules, has its map point visible because I haven't done its condition yet. OK. When I was testing the transition, and if the feat will remain, I didn't want to also set a variable on the convo where I get the feat... so that I'm able to travel. So I was traveling to the module that's always visible. Did I mention that this module is new? Yes, I think I did. And of course, step 5: Make sure your modules have the same tlk and haks assigned to them! Well, this one had none. Once I put mine, the feat stayed put!
 
4 pages of comments. People, I don't know when your patience with me will run out... but I hope not too soon :D.
 
ps: Thanks all of course, as always. Kidding aside... you were grea help once more.
pss: Note made on the top of my logbook AND on my progress excel sheet AND on my Important Notes sheet AND on my ToDo list.
When creating a new module and attaching it to the campaign, before you do anything else, assign the script set, hak and tlk. Then there are like 100 exclamation marks :).


Phew!

I am so glad that I emphasised the fifth point now. :)

And even gladder that it now works for you. ;)

I also sorted out my own transition problems ... mine was due to some code on the wrong side of a bracket! That was hard to track down.

Lance.