Hello
This tutorial shows artists/modders how to use hairHSL to change the colour of hair costumes (layer) of a SWF hair costume mod, or an SWF hair mod.
It can be useful if you want to use a static toggeable part of hair.
I want to thank [USER=3361]@ModGuy[/USER] because even if he dissappears, he leaves more informations into the forum.
I want to thank [USER=5850]@SyntaxTerror[/USER] for his tutorials. This topic is really similar to this tutorial, you should read this before.
example
how to use the hairHSL to modify the colours of a piece of costume located in the HAIR_COSTUME_UNDEROVER layer.
In your modPackage :
import SDTMods.*;
import flash.system.ApplicationDomain;
import flash.filters.*;
public class ModPackage extends MovieClip
{
public var SDT;
public var g;
//declare your movieclip as usual
public var hairCUnderOver:MovieClip;
function frame1() : *
{
this.registerMod(this.hairCUnderOver);
this.charData = "";
this.modName = "";
this.modCreator = "";
this.SDT = ApplicationDomain.currentDomain;
try
{
this.g = this.SDT.getDefinition("g"); //Vanilla
this.copyHairHSL(this.g);
}
catch(ex:*)
{
//We're in loader, wait.
}
}
public function initl(param1:*) : void
{
this.copyHairHSL(param1.g); //Loader
}
public function copyHairHSL(param1:*) : void
{
this.hairCUnderOver.addEventListener(Event.ENTER_FRAME, tick);
}
public function tick(param1:*) : *
{
var _loc4_:* = this.g.characterControl.hairHSL;
var _loc5_:* = new ColorMatrixFilter(this.g.getCMFMatrix(_loc4_.h,_loc4_.s,_loc4_.l,_loc4_.c));
this.g.hairCostumeUnderOver.filters = [_loc5_];
}
}
- hsl affects filters.
- To change the layers, modify the name in green (you can use "hairCostumeOver","hairCostumeUnderOver","hairCostumeUnder", "hairCostumeBack").
- If you want to use the others HSL replace hairHSL by skinHSL or hisSkinHSL.
- Keep in mind that headwear registerComponentst is encapsuled in the hairCostume content like this :"this.headwearControl.registerComponents([g.hairCostumeOver.headwear, g.hairCostumeBack.headwear], ModTypes.HEADWEAR);" So if you use "hairCostumeOver", the front headwear is affected too and "hairCostumeBack" is bond with the back headwear. I recommend to avoid these two layers. [SPOILER="exemple of weird behaviour"]
[
In these pictures, the hairCostumeOver layers is synchronized with the hairHSL, So the headwear front is bond with the hairHSL.[/SPOILER]
I invite modders to debate and maybe find a way to use the hairCostumeOver without affects the headwear cause the majority of hair mods with haircostume layers have hairCostumeOver and currently this method is not very useful.