Set tint through scripting - possible?

I don’t think this is possible but I ask here anyway if someone perhaps knows…
Is there a way to change tints on a character through scripting, like change the hair color or skin color, eyes etc. For reasons I won’t go into detail to, it would have been nice to be able to do that. I can solve it in another way but it would be a lot better if this was achievable.

My guess is that all that is under a character’s Appearance under Properties can’t be changed through scripting…but since @Lance_Botelle managed to change a portrait through XML coding, maybe (again) something like this is possible through that?

It would be really good if you could change hair and things like that but the only way I can think of doing it is to make companions run off and come back different. Which is impossible when they’ve levelled up and will really annoy people that have to do it again.

There is no hairdresser/ plastic surgeon like in fallout or even skyrim that you can visit. If there was then you could probably change everyone’s looks etc. I remember skyrim had an eye change if you went vampire which really annoyed me and I had to install a mod to get rid of my ghoul eyes.

You could go really daft and have a big explosion, destroy one companion and bring in a new one, tint ( burn ) your new companion and fry their hair to another style then they can say they’ve forgotten everything in the blast and have to be levelled up again !

You can change the haircut though, by using a helmet-haircut. I did this in my second module.

You can copy the companion, and that way they don’t need to level up again (at least I don’t think so). I did something like this in my third module.

andgalf… Copying companions is interesting, but you wouldn’t want to copy any of mine they’re all mad !

Seriously though if you can copy a companion then maybe you can leave out part of that and change appearances or copy their stats etc. on to someone else that way changing appearance. I don’t know I just try to write my way out of things before I get bogged down in detail and looking for perfection.

One way you might do it is a bit of a cheat but by using two haks and putting each on two separate modules but with the same appearance numbers for different looks. Give whoever you want that number for appearances when you make them and when the module changes so does the hak and what they look like.

You just have to write it in as a change just before the next module starts and make sure the files are not in your override. Not that easy but it should work.

In this case I might just be able to take the same character with changed looks and with another tab, another blueprint even, just jump the companion elsewhere, spawn in the other character (same but with different blueprint) and have the camera point elsewhere for a moment when that happens, and then when that cutscene is finished, jump back the “real” companion so to speak. So there’s always a way to solve it, but as said in my first post, it would have been neat if one could change the appearance through scripting instead.

It would have been a whole other matter if I wanted a permanent change. Then I don’t know if it would have been possible, but maybe, just maybe, there’s a way to do something like this through XML scripting.

Thinking wildy out of the box here…When you save the game in NWN2, the companions are saved as .ros files. Maybe one could go in an manipulate them through scripting somehow to get what I need? When looking at the .ros files in Notepad++, most of it is gibberish, but one can see certaing things, and I believe all the information about the companions are there…

@kevL_s or @travus perhaps knows about that, if that’s possible? Or maybe one should not attempt such a thing in order not to break things?

@kevL_s - You made this nwn2_CritterStatsEditor Gff/Utc file(s) - #244 by andgalf so, since you made that editor, could one use that somehow to change tint things in a module ingame through scripting or…again, just brainstorming.

andgalf… What exactly are you trying to change ? Body colour, hair colour, eye colour, different looks, hair styles… ?

To tint a companion you could maybe body and head swap them in a hak by making the body/ face untintable ( what you put on the original properties doesn’t matter ), having the colour you want on the original then colouring another version ( same number ) and putting it in the hak for the next module. Same with eyes.

Altering stats can be done with the console in game I’m really not sure tinting can. Could you polymorph them permanently instead ? Create a creature that’s how you want them to look stick it in the 2da and change them that way.

1 Like

Ok, it’s like this. I have a companion, and at a particular moment in the module I need to change the skin color for it to fit another armor/clothing. The skin color I use now for the normal outfits of the character look really good and doesn’t affect the custom face, since the face I’m using is not tintable. So I’ve matched the tint to those outfits. Sure, I could go the odd route by taking the outfits into Gimp and try to fix the skin color of those outfits there (since I don’t have a clue as to how to use Blender or 3d max or something like that), but that’s a lot of work and I don’t want to do that in this particular case (I have done stuff like that before though, in other situations). As I’ve said before, and I’ll say it again, I can fix this by just using another blueprint for the character for this scene/scenes, and that is not that hard with a bit of camera trickery and whatnot (spawning in the new blueprint), but it would be nice if there was a way to change tints through scripting. That would open up quite a few possibilites. I know I tend to be rather fixated with how my characters look in game. Other creators couldn’t care less, for me it’s the opposite. I want the faces, clothing, portraits, soundsets and all to be as good as can be.

Yeah, well, it wouldn’t work in this case since I need the tint of the Appearance of the character itself to change.

@andgalf that’s a GFF editor … it can open and edit .ROS files … yes the tints are in there … somewhere …

but it can’t affect a currently running game. Nwn1 has lots of script functions for changing colors and stuff, but they all got put to the wayside when Nwn2 ‘upgraded’ the graphics engine … :\

so, i dont think there’s any way, short of what’s been said: replace the character with another.

2 Likes

@kevL_s - Thanks for the reply! Yes, I thought as much. Too bad then.

2 Likes

@kevL_s - I thought there might have been some way to change this through XML scripting, but when looking through documents about that, there doesn’t seem to exist any functions for changing something like that there. Maybe if @Lance_Botelle is around tomorrow he’ll have something to say about that, but as far as I can see, there’s no way to change tints through XML.

1 Like

nope, I honestly think its replace the char or just go with green beards clashing with red caps …

And one couldn’t somehow, again totally brainstorming here, copy the stats and everything about a character to a new blueprint? A new blueprint that has the “correct” tints? But of course, you’d still need to change and spawn the new blueprint so…

EDIT: I mean, I know you can copy an object/character but I don’t know if you could copy the “contents” of a character to a new bluprint…

EDIT2: Sometimes it feels a bit odd the choices Obsidian made when doing NWN2 and updating the engine and all that, and skip certain good parts from NWN1. Doesn’t quite make sense.

By the way, I asked this question on Discord too, and Crom suggested that I “… ship your module with nwnx4, so players will be able to quickly start a server and play on it. It’s a fairly new feature of nwnx4, and there may be some rough edges, but I can help you with that if you need.”
It sounds interesting but…well, I feel like going into a territory where I don’t have a clue as to how things work so…it may be too big a step just to achieve something that I have an ok workaround solution for.

" One day people wont be judged by the colour of their skin but by the contents of their character… I have a dream "

1 Like

It’s possible to edit a character with a 3d party tool, I don’ t remember its name.

In order to make it happend in game you need to call those setting from outside the client, it’s probably possible with the gui. You pass parameter on the gui, the gui would then call an exterior tools which would change edit the character file. You ll probably have to “reload” the area for it to take effect in game.

For my part, I had something similar to do, with companion that change look between BGR and SOAR.

I don’t change the look, I “copy” all the feat/skills and whatever of the old one into the new one.

So I have made a script that read all skills/attributes/feats/xp/classes of a NPC and set them into a new one, that’s possible withing NWN2 scripting without external tool and I made it work for my setting/campaign.

1 Like

Now this sounds interesting. Would you be willing to share that script?

#include “ginc_object”
#include “ginc_cutscene”
//56178
int GetXPForClass(object oOriginal,int nClassPosition,int BaseLevel){

int iLevel =  GetLevelByPosition(nClassPosition,oOriginal);
int iLevelSum  = iLevel + BaseLevel ;


if( iLevel > 0){

	string s2DA = "exptable";
	string sXP = Get2DAString(s2DA,"XP",iLevelSum);
	
	SendMessageToPC(GetFirstPC(FALSE),"sXP = " + sXP);
	
	return StringToInt(sXP);
}
else {

	return 0;

}

}
//-------------------------------------------------------------------------------------------------------

int GetLevelUpPackageSOAR(object oOriginal,int nClassPosition){

int iPackage = 255;
if(GetClassByPosition(nClassPosition,oOriginal) == CLASS_TYPE_WIZARD){

	//SendMessageToPC(GetFirstPC(FALSE),"nClassPosition = " + IntToString(nClassPosition));

	int iSpellSchool = 0 ;// GetCasterClassSpellSchool(oOriginal,nClassPosition);
	if(GetStringLowerCase(GetTag(oOriginal))== "edwin"){
	
			 iSpellSchool = 2;
	
	}
	else {
	
		//SendMessageToPC(GetFirstPC(FALSE),"Trying to retrieve iSpellSchool");
		//iSpellSchool = GetCasterClassSpellSchool(oOriginal,2); Doesn' t work, can' t get the caster school
		
	
	}
	//SendMessageToPC(GetFirstPC(FALSE),"iSpellSchool = " + IntToString(iSpellSchool));
			
		switch (iSpellSchool){
		
			case 1 :
				iPackage = PACKAGE_WIZARD_ABJURATION;
			break;
		
			case 2 :
				iPackage = PACKAGE_WIZARD_CONJURATION;
			break;
		
			case 3 :
				iPackage = PACKAGE_WIZARD_DIVINATION;
			break;
		
			case 4 :
				iPackage = PACKAGE_WIZARD_ENCHANTMENT;
			break;
		
			case 5 :
				iPackage = PACKAGE_WIZARD_EVOCATION;
			break;

			case 0 :
				iPackage = PACKAGE_WIZARDGENERALIST;
			break;
			
			case 6 :
				iPackage = PACKAGE_WIZARD_ILLUSION;
			break;

			
			case 7 :
				iPackage = PACKAGE_WIZARD_NECROMANCY;
			break;
					
			case 8 :
				iPackage = PACKAGE_WIZARD_TRANSMUTATION;
			break;
			
								
		}
	
	return  iPackage;
	
}	


return iPackage;

}
//-------------------------------------------------------------------------------------------------------
object LevelUpClass(object oNewCompanion,int iClass,int iLevel,int iPackage){

//SendMessageToPC(GetFirstPC(FALSE),"iClass = " + IntToString(iClass) );
//SendMessageToPC(GetFirstPC(FALSE),"iLevel = " + IntToString(iLevel) );
int i;
for(i= 1; i <= iLevel;i++){

	LevelUpHenchman(oNewCompanion,iClass,FALSE,iPackage);  


}

return oNewCompanion;

}

//-------------------------------------------------------------------------------------------------------
object SetClasses(object oOriginal,object oNewCompanion){

int iLevelClass1 = GetLevelByPosition(1,oOriginal);
int iLevelClass2 = GetLevelByPosition(2,oOriginal);	
int iLevelClass3 = GetLevelByPosition(3,oOriginal);
int iLevelClass4 = GetLevelByPosition(4,oOriginal);	

int ECL = 0;
if(GetSubRace(oOriginal) == RACIAL_SUBTYPE_DROW){

	ECL =2;
}

int iLevel1 = iLevelClass1 + ECL;
int iLevel2 = iLevel1 + iLevelClass2 ;	
int iLevel3 = iLevel3 + iLevelClass3 ;	
int iLevel4 = iLevel4 + iLevelClass4 ;

int XPLevelUp =0;
ResetCreatureLevelForXP(oNewCompanion,0,FALSE);

if( iLevelClass1 > 0) {	
	LevelUpClass(oNewCompanion,GetClassByPosition(1,oOriginal),iLevelClass1-1,GetLevelUpPackageSOAR(oOriginal,1));
}

if( iLevelClass2 > 0) {

	LevelUpClass(oNewCompanion,GetClassByPosition(2,oOriginal),iLevelClass2,GetLevelUpPackageSOAR(oOriginal,2));
	//XPLevelUp = GetXPForClass(oOriginal,2,ECL);

}

if( iLevelClass3 > 0) {

	LevelUpClass(oNewCompanion,GetClassByPosition(3,oOriginal),iLevelClass3,GetLevelUpPackageSOAR(oOriginal,3));
}

if( iLevelClass4 > 0) {

	LevelUpClass(oNewCompanion,GetClassByPosition(4,oOriginal),iLevelClass4,GetLevelUpPackageSOAR(oOriginal,4));

}	

return oNewCompanion;

}
//------------------------------------------------------------------------------------------------------
object CopySpell(object oOriginal, object oNewCompanion){

	int iNumberOfSpells = GetNum2DARows("spells");
	int i;
	for (i=0; i <= iNumberOfSpells; i++){

		if(!GetSpellKnown(oOriginal,i)){
		
			SetSpellKnown(oNewCompanion,0,TRUE,TRUE);	
		
		
		}
	
	}

	return oNewCompanion;

}
//------------------------------------------------------------------------------------------------------
object newCompanion(object oOriginal,object oNewCompanion){

oNewCompanion = SetClasses(oOriginal,oNewCompanion);

SetXP(oNewCompanion,GetXP(oOriginal));



int iNumberOfFeats = GetNum2DARows("feat");
	
int i;
for(i=0 ; i <6;i++){
  	
  	SetBaseAbilityScore(oNewCompanion,i,GetAbilityScore(oOriginal,i,TRUE));
}


int iNumberOfSkills = GetNum2DARows("skills");

for (i=0; i <= iNumberOfSkills; i++){

	SetBaseSkillRank(oNewCompanion,i,GetSkillRank(i,oOriginal,TRUE),FALSE);


}

for (i=0; i <= iNumberOfFeats; i++){

/*
	FeatRemove(oNewCompanion,i);

	 if(GetHasFeat(i,oOriginal)){
  
  		FeatAdd(oNewCompanion,i,FALSE,FALSE,FALSE);
	}*/
	
 	 if(GetHasFeat(i,oOriginal) && !GetHasFeat(i,oNewCompanion)){
  
  		FeatAdd(oNewCompanion,i,FALSE,FALSE,FALSE);
	  	}
	  
  	else if(!GetHasFeat(i,oOriginal) && GetHasFeat(i,oNewCompanion)){
  
  		FeatRemove(oNewCompanion,i);
  		}
	
 }




SetFortitudeSavingThrow(oNewCompanion,GetFortitudeSavingThrow(oOriginal));
SetReflexSavingThrow(oNewCompanion,GetReflexSavingThrow(oOriginal));
SetWillSavingThrow(oNewCompanion,GetWillSavingThrow(oOriginal));


return oNewCompanion;

}

3 Likes

Good morning … @andgalf

I mentioned to my wife what you were trying to do … now she also wants me to take a look. :sweat_smile: Me, I’m happy with the original PC created stuff, but she wants to put on make-up and stuff according to the next adventure! Mass Effect has a lot to answer for this. Whatever happened to a simple pixelated representative of our hero? I mean before that it was just pencil and paper! :woozy_face:

I have not yet read through all the responses, but I imagine you have had quite a few good answers now anyway. As a quick initial response, I do not see any SetColor type functions in NWN2, as they were removed for the newer game.

But, whether it is possible to use an altered version of one of the PC creation XML’s to accommodate what you are after, I am not sure. Even if possible, it was also depend upon whether you expected the player to select a colour and click a button to accept, or whether you were just wanting to exploit the code to force the colour change yourself in the background, like we did with the portrait thing.

Let me know if you still need me to take a closer look, and if so, I will look closer at the xml stuff then. I won’t be able to respond until later this evening as I have other chores today. However, if this is something you are still interested in, just let me know.

There are some lines that look as though they could be accessible …

UIButton_Input_SetCreatureColor(“CHARGEN”,“COLOR_HAIR_1”)

… but whether I can do the same thing as the portrait code, I would need to check. But, if I can then I imagine we could (potentially) have dedicated xml setups to apply under certain conditions. i.e. It would likely only work for the controlled PC, which could be forced if need be.

If I get the time later, I may play around with this anyway, just for the experience … and in case I can do something with it.

2 Likes

All I can say is… Shallina’s script… :dizzy_face:

1 Like