RGB adjustable hair? (1 Viewer)

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
Hello

I am wondering if it is possible to assign a RGB slider of a costume part to hair layers?
@Iago showed me a technique to merge or reassign sliders (I made a little tutorial about it), and I tried it on SD chan 2's hair, but it doesn't seem to work (SD chan 2 RGB.fla).
Does this trick doesn't work with hair layers, or did a do something wrong in the FLA?
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
there is not a CharacterElementHelper assigned to these, and those character element helpers usually have a setFill function defined for them.
this.modTargetHelpers[ModElements.HAIR_TOP] = new CustomElementHelper({target:g.hairTop});
this.modTargetHelpers[ModElements.HAIR_UNDER] = new CustomElementHelper({target:g.hairUnder});
this.modTargetHelpers[ModElements.HAIR_BOTTOM] = new CustomElementHelper({target:g.hairBottom});
this.modTargetHelpers[ModElements.HAIR_BACK] = new CustomElementHelper({target:g.hairBack});
this.modTargetHelpers[ModElements.DYNAMIC_HAIR_OVER] = new CustomElementHelper({target:g.hairOverLayer});
this.modTargetHelpers[ModElements.DYNAMIC_HAIR_UNDER] = new CustomElementHelper({target:g.hairUnderLayer});
this.modTargetHelpers[ModElements.DYNAMIC_HAIR_BETWEEN] = new CustomElementHelper({target:g.hairBetweenLayer});
this.modTargetHelpers[ModElements.DYNAMIC_HAIR_BACK] = new CustomElementHelper({target:g.hairBackLayer});
this.modTargetHelpers[ModElements.HAIR_COSTUME_OVER] = new CustomElementHelper({target:g.hairCostumeOver});
this.modTargetHelpers[ModElements.HAIR_COSTUME_UNDEROVER] = new CustomElementHelper({target:g.hairCostumeUnderOver});
this.modTargetHelpers[ModElements.HAIR_COSTUME_UNDER] = new CustomElementHelper({target:g.hairCostumeUnder});
this.modTargetHelpers[ModElements.HAIR_COSTUME_BACK] = new CustomElementHelper({target:g.hairCostumeBack});

unlike this one:
this.modTargetHelpers[ModElements.GAG_FRONT] = new CustomElementHelper({target:g.her.gagFront}, g.characterControl.gagControl);


you could probably create your own in your mod, something like


CharacterControl = l.eDOM.getDefinition("obj.CharacterControl") as Class;

myrgbfillname:String = "rgbFill"

//colorslider is the combination object for alpha, red, green, and blue
//should be possible to grab one from a color picker

var _loc_3:* = new ColorTransform(1, 1, 1, colorslider.a, colorslider.r, colorslider.g, colorslider.b);
CharacterControl.tryToSetFill(g.hairTop, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnder, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBottom, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBack, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairOverLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnderLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBetweenLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBackLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeUnderOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeBack, myrgbfillname, _loc_3);

totally untested code there
 

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
sby sby : Thanks for your fast answer.

Would this code work on Vanilla? The problem is I understand only a few things to AS...

Also do I need to change something to your code, or will it work as-is?
I tried to add it to my mod and get these errors:
Main, Layer 'Settings', Frame 1, Line 6, Column 1 1120: Access of undefined property CharacterControl.
Main, Layer 'Settings', Frame 1, Line 6, Column 20 1120: Access of undefined property l.
Main, Layer 'Settings', Frame 1, Line 8, Column 24 1067: Implicit coercion of a value of type String to an unrelated type Class.
Main, Layer 'Settings', Frame 1, Line 8, Column 24 1188: Illegal assignment to class String.
Main, Layer 'Settings', Frame 1, Line 13, Column 20 1180: Call to a possibly undefined method ColorTransform.
Main, Layer 'Settings', Frame 1, Line 13, Column 44 1120: Access of undefined property colorslider.
Main, Layer 'Settings', Frame 1, Line 13, Column 59 1120: Access of undefined property colorslider.
Main, Layer 'Settings', Frame 1, Line 13, Column 74 1120: Access of undefined property colorslider.
Main, Layer 'Settings', Frame 1, Line 13, Column 89 1120: Access of undefined property colorslider.
Main, Layer 'Settings', Frame 1, Line 14, Column 1 1120: Access of undefined property CharacterControl.
Main, Layer 'Settings', Frame 1, Line 14, Column 31 1120: Access of undefined property g.
Main, Layer 'Settings', Frame 1, Line 14, Column 42 1120: Access of undefined property myrgbfillname.
Main, Layer 'Settings', Frame 1, Line 15, Column 1 1120: Access of undefined property CharacterControl.
Main, Layer 'Settings', Frame 1, Line 15, Column 31 1120: Access of undefined property g.
Main, Layer 'Settings', Frame 1, Line 15, Column 44 1120: Access of undefined property myrgbfillname.
I made two RGB symbols (rgbFill & rgbFill2) on hairTop & hairUnder, and two symbols on the headwear layer.
My actual code looks like this (I named the instances of the templates top, under & headwear):

import SDTMods.*;
registerMod(headwear);
registerMod(under);
registerMod(top);

addEventListener(Event.ENTER_FRAME, followColorSlider);
function followColorSlider(e:Event)
{
top.rgbFill.transform.colorTransform = headwear.rgbFill.transform.colorTransform;
under.rgbFill.transform.colorTransform = headwear.rgbFill.transform.colorTransform;
top.rgbFill2.transform.colorTransform = headwear.rgbFill2.transform.colorTransform;
under.rgbFill2.transform.colorTransform = headwear.rgbFill2.transform.colorTransform;
}
 
Last edited:

sby

Content Creator
Coder
Joined
Sep 11, 2012
it will definitely not work as is, i kinda threw concepts together and copy pasted stuff.
i am guessing it would require the loader, i am unsure if the things referenced are exposed in vanilla. i also forgot how you would get to the 'g' object in vanilla, probably something like stage.something. someone that does complicated vanilla mods might have an idea.

here is stuff a bit more refined.


import flash.geom.ColorTransform;

//loader referenced used to get to the 'g' reference, and the character control class definition.
var g = l.g; // l is the loader reference. if loaded in the loader, it is the reference passed into the initl(l) function.
var CharacterControl = l.eDOM.getDefinition("obj.CharacterControl") as Class;
var colorslider = g.collarControl.rgb1; //grab the first collar rgb. colorslider is the combination object for alpha, red, green, and blue
var myrgbfillname:String = "rgbFill";


var _loc_3: = new ColorTransform(1, 1, 1, colorslider.a, colorslider.r, colorslider.g, colorslider.b);
CharacterControl.tryToSetFill(g.hairTop, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnder, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBottom, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBack, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairOverLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnderLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBetweenLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBackLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeUnderOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeBack, myrgbfillname, _loc_3);
 

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
sby sby : thank you for your time

This code has still two compiler errors:
Main, Layer 'Settings', Frame 1, Line 14, Column 13 1084: Syntax error: expecting identifier before assign.
Main, Layer 'Settings', Frame 1, Line 14, Column 33 1086: Syntax error: expecting semicolon before leftparen.


This is the line 14:
var _loc_3: = new ColorTransform(1, 1, 1, colorslider.a, colorslider.r, colorslider.g, colorslider.b);

The second error seem to be solved by adding a semicolon after ColorTransform, but I do not know how to get rid of the first one.

By the way, I removed these lines that are not used in my mod:

CharacterControl.tryToSetFill(g.hairBottom, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBack, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairOverLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnderLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBetweenLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairBackLayer, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeUnderOver, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairCostumeBack, myrgbfillname, _loc_3);
 

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
ModGuy sent me a MP with a correction of the var _loc_3 line, but now I have two new errors.
My code:
import SDTMods.*;
registerMod(headwear);
registerMod(under);
registerMod(top);

import flash.geom.ColorTransform;

//loader referenced used to get to the 'g' reference, and the character control class definition.
var g = l.g; // l is the loader reference. if loaded in the loader, it is the reference passed into the initl(l) function.
var CharacterControl = l.eDOM.getDefinition("obj.CharacterControl") as Class;
var colorslider = g.collarControl.rgb1; //grab the first collar rgb. colorslider is the combination object for alpha, red, green, and blue
var myrgbfillname: String = "rgbFill";

var _loc_3: ColorTransform = new ColorTransform(1, 1, 1, colorslider.a, colorslider.r, colorslider.g, colorslider.b);
CharacterControl.tryToSetFill(g.hairTop, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnder, myrgbfillname, _loc_3);


Compiler errors:
Main, Layer 'Settings', Frame 1, Line 10, Column 24 1120: Access of undefined property l.
Main, Layer 'Settings', Frame 1, Line 9, Column 9 1120: Access of undefined property l.


[EDIT] damned, I didn't read/understood that "l" is a Loader reference... So I guess this won't work for Vanilla. :frown:
 
Last edited:

sby

Content Creator
Coder
Joined
Sep 11, 2012
ModGuy sent me a MP with a correction of the var _loc_3 line, but now I have two new errors.
My code:
import SDTMods.*;
registerMod(headwear);
registerMod(under);
registerMod(top);

import flash.geom.ColorTransform;

//loader referenced used to get to the 'g' reference, and the character control class definition.
var g = l.g; // l is the loader reference. if loaded in the loader, it is the reference passed into the initl(l) function.
var CharacterControl = l.eDOM.getDefinition("obj.CharacterControl") as Class;
var colorslider = g.collarControl.rgb1; //grab the first collar rgb. colorslider is the combination object for alpha, red, green, and blue
var myrgbfillname: String = "rgbFill";

var _loc_3: ColorTransform = new ColorTransform(1, 1, 1, colorslider.a, colorslider.r, colorslider.g, colorslider.b);
CharacterControl.tryToSetFill(g.hairTop, myrgbfillname, _loc_3);
CharacterControl.tryToSetFill(g.hairUnder, myrgbfillname, _loc_3);


Compiler errors:
Main, Layer 'Settings', Frame 1, Line 10, Column 24 1120: Access of undefined property l.
Main, Layer 'Settings', Frame 1, Line 9, Column 9 1120: Access of undefined property l.


[EDIT] damned, I didn't read/understood that "l" is a Loader reference... So I guess this won't work for Vanilla. :frown:

"i also forgot how you would get to the 'g' object in vanilla, probably something like stage.something. someone that does complicated vanilla mods might have an idea."
 

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
I gave up trying to use RGB sliders on hair layers with AS, but I still found a trick to achieve this:
headwear-sd-chan-2-rgb-x3-jpg.63433

SD Chan 2 (RGB adjustable)
This is not a proper hair mod as it uses the Headwear layer. :tongue:

The only problem I see is that cum will not stick to the hair as it is not drawn on the Hair Under layer.
Also, there are tiny clipping issues with the ear, mostly because the Reference template does not exactly match the game, but I bet no-one will notice it.
 
Last edited:

SyntaxTerror

Content Creator
Joined
Jul 24, 2014
@ModGuy found the solution.
[EDIT] works only for Vanilla, look at my tutorial for the Vanilla+Loader version.
Here is his code:

import SDTMods.*;
import flash.system.ApplicationDomain;
import flash.geom.ColorTransform;

registerMod(under);
charData = "";
modName = "Static Hair - Chun Li RGB";
modCreator = "SyntaxTerror & ModGuy";

var SDT = ApplicationDomain.currentDomain;
var g = SDT.getDefinition("g");
var cc = g.characterControl;

// Color: {r, g, b, a}
// Target: rgbFill | rgbFill2

under.addEventListener(Event.ENTER_FRAME, tick);
function
tick(e)
{
var fills = g.characterControl.
collarControl.getDataString().split(",");
if(fills.length < 5) return; //Check for rgbFill1
under.rgbFill.transform.colorTransform = new ColorTransform(1, 1, 1, fills[4], fills[1], fills[2], fills[3]);
if(fills.length < 9) return; //Check for rgbFill2
under.rgbFill2.transform.colorTransform = new ColorTransform(1, 1, 1, fills[8], fills[5], fills[6], fills[7]);
}

To change the costume RGB slider, modify the name in pink (e.g. "headwear").
To add another layer (e.g. hairBack), duplicate the part in light blue, rename the function in light green (e.g. "tick2") and modify the layer instance name in dark green (e.g. "back").

I could upgrade SD Chan 2's hair mod and make another one with Chun Li:
 
Last edited:

sby

Content Creator
Coder
Joined
Sep 11, 2012
"var SDT = ApplicationDomain.currentDomain;
var g = SDT.getDefinition("g");"
this is the snippet i was looking for

also, mine is more like code to cover every hair mod that happens to define rgbFill symbols, probably more suited for an extension. i could try adding an rgb color picker next to the hair menu and throw it in the template extension if interested. if so, throw a hair mod my way that doesn't have any color slider code (only rgbFill and rgbFill2 symbols) and i'll see if i can make some magic happen.
also, would be a loader thing then xD
 

Users who are viewing this thread

Top


Are you 18 or older?

This website requires you to be 18 years of age or older. Please verify your age to view the content, or click Exit to leave.