Is there a skin limit in the Editor

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

Post Reply
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Is there a skin limit in the Editor

Post by jomni »

So I have created 8 (samurai) faction skin sets and I want to use them all in one battle.
In the editor, only 5 skins are selectable for each model. Is this a limitation?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

Yes, currently.

Currently the engine will only allow 16 skins to be active. Unfortunately it assumes that the Core skins will be active at all times, which takes up 11 of the slots.

It is on the wishlist to have this restriction removed, or at least allow the core skins to be excluded, thus freeing up 11 skin slots.

What you could do in the meantime is
1) Make a copy of the entire PikeandShot installation to a new folder.
2) Run the game from there (at least when playing Japanese games).

This will allow you to modify core files in the new setup without altering your main installation.

You could then add the textures for the extra daimyos to some of the TYW skin sets - though you might have to overwrite some of the existing textures - which means they won't work correctly if you run TYW games from this new installation.

Alernatively, you could allow two daimyos to share one skin set by making clones of the models and renaming them. This won't work correctly in the editor, because the models contain internal texture file references which will mean that the clones will use their original textures in the editor. However, they will show their new textures (obviously renamed to match the new model name) in skirmishes.

Alternatively, as there are several variant pike and shot models, many of which look the same as each other, you could one for one Daimyo and the other for the other.
Richard Bodley Scott

Image
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

Well that's sad. I'll see what I can do.
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

Well this sucks. I tired making clones and assigning a few textures each but still won't show the right ones in the editor.
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

So I don't want to mess with the original and have so many skins sharing the models. Looks like I can only do skirmish now. I would love to depict multiple generals and their unique clan banners in a single battle eventually.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

jomni wrote:Well this sucks. I tired making clones and assigning a few textures each but still won't show the right ones in the editor.
Sorry. I did say that in the post above. It is because the models have the skin reference built in, and it doesn't change when you clone them, and the editor uses those references.

However, you can in fact do it in the scenario script using the ReSkinUnit() function, which does not use the internal file reference. If you assign the different daimyos to different teams in the AI dialogue in the editor (press CTRL to assign side0 teams), you can then write a bit of code to reskin just that team. If that damiyo has cloned models with different filenames and textures to match, it will get reskinned with the correct texture.

Assuming that the shared skin folder was called Japanese_1

You could make a new function called

Code: Select all

FUNCTION ReSkinTeam(side, team, skin)
{
	int i;
	int id;

	for (i = 0; i < GetUnitCount(side); i++)
	{
		id = GetUnitID(side,i);
		if (id != -1)
			{
				if (GetUnitTeam(id) == team)
					{
						ReSkinUnit(id, skin);
					}
			}
	}
}
So if your cloned daimyo was team 2 you could just do

ReSkinTeam(2, "Japanese_1");

in CustomiseUnits() in your scenario script, and the cloned renamed units will be reskinned with their correct texture from the Japanese_1 texture folder.

Obviously you could have more than one team for each daimyo and call this for each team.

The only problem with this is that the units will go back to their original skin when a saved game is reloaded. You could reskin them again in the scenario script StartTurn() function, but that won't take effect until you hit the end turn button.

There are two better ways round this, one of which will reskin the units about 1 second after the save game is reloaded, the other will do it immediately, but is a bit convoluted as it involves altering core files. If you are interested I can enlighten you further.
jomni wrote:So I don't want to mess with the original and have so many skins sharing the models. Looks like I can only do skirmish now. I would love to depict multiple generals and their unique clan banners in a single battle eventually.
Hopefully the engine team will have time to allow more skins in a custom campaign - perhaps by disabling the core skin sets, then you could have 16 different daimyos. However, note that this still won't allow the editor to use different skins for the same model on the same side, because it will reskin all models with the same name on the same side when you select a different skin. The method above, however, should work fine (apart from the reoloading a saved game issue, which can be resolved).
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

Of course, for now you could do the historical scenarios showing all units with the leading clan banner. This is pretty much what happens in the historical scenarios in the main game.
Richard Bodley Scott

Image
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

Thanks for all the suggestions above. I would think it would be a neat feature for the mod to have colorful and varying banners within the same side to represent the various characters in Japanese history so I will try as much as possible to have that in the scenarios rather than a single generic commander to represent the side's main commander.

The team suggestion is useful as I will definitely organize the sub commanders into teams because I have other team mechanics in mind. :D
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

Newbie qiestion. So where do I put this function? And how to actually use it at the start of each turn?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

I would suggest putting it in a copy of MoreScenarioTools.BSF in your custom campaign.

It seems that the textures used are getting saved in saved Skirmishes, but not correctly as they are not showing the transparent areas correctly when reloaded (without ReSkinning them again). This is perhaps a bug that can be corrected in a future engine update, and then the units can be ReSkinned once only in the CustomiseUnits() scenario script function.

Until then, one way to make it work after a reload would be to include the following function in each of your scenario scripts. This will reskin the teams once every 30 ticks (i.e. once per second), which isn't very efficient, but is more efficient than doing it every tick. It does mean that there will be up to 1 second delay after reloading a saved game before the units get reskinned correctly. You could of course experiment with doing the rekinning more often than once every 30 ticks and see if it degrades game responsiveness.

There is a way of doing it that won't have a delay (as used by the vanilla program for skirmishes), but because of the sequence of function calls by the engine, it would require a change to core scripts, which I don't think you can do in a custom campaign.

Code: Select all

FUNCTION Tick(side)
{
	SetUniversalVar("TickCounter", GetUniversalVar("TickCounter") + 1);
	if (GetUniversalVar("TickCounter") == 30)
		{
			ReSkinTeam...
			ReSkinTeam...
			ReSkinTeam...
			
			SetUniversalVar("TickCounter", 0);
		}
}
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

I have just realised that you don't have to do any of this, and you don't need to use cloned models.

All you have to do is create cloned units in the Squads file for each Daimyo - obviously with different names. Even though they use the same model, the Editor will allow you to assign alternate texture by unit type. Each unit type in the Squads file is treated as a different unit type by the editor, even if it uses the same model (AssetFileName).

And as previously stated, v1.0.3 (the next patch) allows up to 32 alternative texture folders. (Although I would not risk using more than 12 or 14 in case we expand the number in the Core set)

Apologies for taking you round the scenic route on this one.
Richard Bodley Scott

Image
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

I am still looking at the script method because I already have loads of skins (14) and it's just for one battle. What more if I make the other prominent battles of the era? :wink:
Perhaps I'm too ambitious. I could have just gone with one skin per side but I want to make it coloful and historical.
jomni
Sengoku Jidai
Sengoku Jidai
Posts: 1394
Joined: Thu Dec 03, 2009 1:20 am

Re: Is there a skin limit in the Editor

Post by jomni »

Thanks for the clarification Richard (via email). Looks like engine limitations will make me drop being too ambitious with skins. Anyway, that means less skinning work involved. :)
macdonncadh
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 63
Joined: Fri Apr 24, 2015 1:30 am

Re: Is there a skin limit in the Editor

Post by macdonncadh »

I was just reading these posts, as I was pondering the task of cloning unit and have a question, the answer to which might save me an infinity of work....

If I create a new unit in a squad file saved to my custom campaign - lets say "Galloglas Warrior" which uses the Swordsman model, do I, can I save a skin to my custom units file named "Galloglas" or is the texture name irrevocably tied to the model name?

I apologise, this is probably obvious. I await and answer with chagrin...
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28330
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a skin limit in the Editor

Post by rbodleyscott »

macdonncadh wrote:I was just reading these posts, as I was pondering the task of cloning unit and have a question, the answer to which might save me an infinity of work....

If I create a new unit in a squad file saved to my custom campaign - lets say "Galloglas Warrior" which uses the Swordsman model, do I, can I save a skin to my custom units file named "Galloglas" or is the texture name irrevocably tied to the model name?

I apologise, this is probably obvious. I await and answer with chagrin...
The texture is tied to the model name. You can clone the model to make a new one, but for this to work correctly in the editor you would need to edit to file reference in the .s3f file - which I can send you if you wish.
Richard Bodley Scott

Image
Post Reply

Return to “Modders Corner”