Page 1 of 1

Setting up Wargear and Weapons

Posted: Wed Feb 01, 2017 10:22 pm
by Aekar
Thanks to the available documentation and files, I successfully created a new army, new units and added them to Skirmish maps.
Yay!

There are however a heretical amount of problems in trying to customize them.
Like customizing weapons, models and wargear. :p

The Squads.csv file gives values about range and damage output. It's helpful to set up damage, men count, etc.
However it does not mention directly the "weapon used" and default wargear provided.
The "AssetFilename" it mentions, which seems used for model, also cannot be found in file structure.

To take an example:
In the original Squads.scv file, there is a "Grey_Hunter_Bolter1" unit with the "BolterHunter" asset filename.
But there is no file in file structure named "BolterHunter".
Instead there are skin DDS files named "GHunters_Bolter_*" in Data/Battle/UnitTextures.
I can change these files to make another skin for the Grey Hunters, but I cannot see how to create a skin for new units...

Re: Setting up Wargear and Weapons

Posted: Wed Feb 01, 2017 10:35 pm
by pipfromslitherine
The assetfile denotes the mesh file that is loaded for the unit (these are in a packed file for efficiency). These include the names of the textures they use. So reskinning a mesh for a NEW unit is a little more complex. Obviously you can have your own DATA/BATTLE/UNITTEXTURES version to just change the texture on a mesh. To reuse a mesh with a different texture you would probably need to use SetUnitTexture as part of the initial pre-battle turn of a battle (so find all the units of type X and apply your new texture to them).

I will add a potentially different way to reskin to the wishlist.

Cheers

Pip

Re: Setting up Wargear and Weapons

Posted: Wed Feb 01, 2017 10:50 pm
by Aekar
Thanks Pip!
I'll try it there or from the Skirmish script.
Will watch patch notes on this feature! ;)

Re: Setting up Wargear and Weapons

Posted: Thu Feb 02, 2017 8:34 pm
by Aekar
I have tried many many ways in several files (init file, map generation, campaign file on start turn, etc).
To implement this and get around current limitation, just like you said I need to:
get all units, test them one by one, see if they fit the type I am looking for, place a SetUnitTexture.

My attempt looks like:
(tried full path or asset filename just to see)

Code: Select all

FUNCTION CHANGE_TEXTURES(side)
{
	int nbUnits;
	int idUnit;
	int i;
	nbUnits = GetUnitCount(side);
	i = 0;
	for(i=0;i<nbUnits;i++)
	{
		idUnit = GetUnitID(side, i);
		if (IsUnitValid(idUnit))
		{
			DebugLog("Testing unit for unit " + idUnit, 1);
			if (IsUnitType(idUnit, "Noise_Marine_Bolter")) 
			{
				DebugLog("... bolter found", 1);
				SetUnitTexture(idUnit, "NoiseMarineBolter_Colour.dds");
			}
			if (IsUnitType(idUnit, "Noise_Marine_Sonic")) 
			{
				DebugLog("... sonic found", 1);
				SetUnitTexture(idUnit, "NoiseMarineSonic");
			}
			if (IsUnitType(idUnit, "Chaos_Rhino")) 
			{
				DebugLog("... rhino found", 1);
				SetUnitTexture(idUnit, "ChaosRhino");
			}
			if (IsUnitType(idUnit, "Lucius_Eternal")) 
			{
				DebugLog("... lord found", 1);
				SetUnitTexture(idUnit, "ChaosLord");
			}
		}
	}
}

I understand you have many many other people to support so you'll answer if you have time... ;)
But what am I missing?

Re: Setting up Wargear and Weapons

Posted: Thu Feb 02, 2017 9:32 pm
by pipfromslitherine
If you call this in STARTTURN in a scenario script on turn 0 then it should work, from what I can see. At that point the units have been created.

Note that you can use the inbuilt debugger (provided you are in windowed mode and DEBUGMODE is set). A DebugBreak ; statement will cause the script to open the debugger so you can step through. Or you can use CTRL+F3 to open it and choose/search/set breakpoints.

As a tip, when i am testing these kinds of functions I often hook them to an order (e.g. MOVE) so I can trigger and watch them on demand.

Cheers

Pip

Re: Setting up Wargear and Weapons

Posted: Sun Feb 05, 2017 9:33 am
by Aekar
Thx Pip.
New textures worked.
Now heading to the next items :D

Re: Setting up Wargear and Weapons

Posted: Thu Feb 20, 2020 11:00 pm
by A_Wal_
This works from the deployment turn onwards if it's done from the StartTurn function but where does it need to be to apply the textures during force selection?

I tried some functions including in the ForceList file but I think that's just UI stuff. I might have tried the right function but set it up wrong, once I know the right one I can go from there.