Tinting Powers

From OuroDev

Some powers within City of Heroes are not currently tintable - most noted would be the villain/monster powers - which were never meant for public consumption / use. Other powers such as Peacebringer + Warshade powers are tintable in SCoRE but not in Ouroboros code base. This is because the Powers were modified in SCoRE to add that power customization option. Through some experimentation, the process of how to enable tinting has been discovered - although it currently requires the modification of numerous files to get even a single power to be tintable in an acceptable manner.

The Power File

Elsewhere in this wiki, a description of the Power def structure will be explained, but the part that we care about is the VisualFX and include segments. For example: If you locate: Power Warshade_Offensive.Umbral_Blast.Ebon_Eye Within the Warshade_Offensive_Umbral_Blast.powers file

You will find the VisualFX and include options set to:

	VisualFX             "menu\Powers\AnimFX\Warshadow_EyeBeam.pfx"
	include              menu\Powers\AnimFX\Warshadow_EyeBeam.pfx

It is important to note - that in its current format, this power is sharing its visual effects with those of the enemy Nictus in the game. We don't want that - because if we enable tinting on the Warshade powers globally, then Primary / Secondary tint information will not be available for the NPC/Critters. The powers may not show correctly.

What we want to do is decouple the players power, from the critters.

To do this - change the VisualFX and include to read:

	VisualFX             "menu\Powers\AnimFX\PlayerPowers\Warshadow_EyeBeam.pfx"
	include              menu\Powers\AnimFX\PlayerPowers\Warshadow_EyeBeam.pfx

Note the inclusion of PlayerPowers sub-directory.

Note - the pfx does not exist in that location yet. Navigate to menu\Powers\AnimFX\ and copy the Warshadow_EyeBeam.pfx to menu\Powers\AnimFX\PlayerPowers\

The PFX File

The Power FX file or PFX - contains information about the emotes/animations that the power plays, as well as the base FX that plays during the powers use.


The default Ebon Eye PFX will look like this:

// -------------------------  ANIMATION RELATED FIELDS --------------------------------//
	ModeBits			ANIM_COMBAT
	AttackBits			ANIM_COMBAT, ANIM_HEADCAST
	HitBits				ANIM_HIT, ANIM_QUICK
	FramesBeforeHit			25
	AttackFrames			50

// -------------------------  FX RELATED FIELDS  --------------------------------------//
	AttackFx			"POWERS\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"POWERS\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"
	DelayedHit			1
	ProjectileSpeed			150

ModeBits - I think indicates that using the power will engage combat mode (combat aura's will kick in)
AttackBits - Animations that play when you are casting
HitBits - Animations your target plays when hit.
FramesBeforeHit - How long in frames before the power hits the target (assume 30 fps - so 25 f would be close to 1 second)
AttackFrames - How many frames in total do the attack animations play for.

FX related fields is where it gets intricate. These default values point at the 'POWERS' directory - which is where the default FX reside for the critters and npcs in the game. These are not tinted.

AttackFx - The Visual Effect of your power - Eg: The effect of it emanating from your eyes and the projectile.
HitFx - The impact Effect of it hitting an enemy - usually an explosion or impact effect of some sort.
DelayedHit - Possibly a boolean to indicate that it is not instant and should use ProjectileSpeed to calculate impact time.
ProjectileSpeed - Possibly used to calculate the time to impact - useful when targeting enemies flying away etc.

What you want to do now is copy the following directory in the POWERS directory (in fx directory)

POWERS\CosmicPowers

To

CustomizeablePowers\

So you should now have: CustomizeablePowers\CosmicPowers inside the FX directory.


The PFX file is where we can add additional animations and palette options for our power tinting.

Modify the PFX to look like this:


// -------------------------  ANIMATION RELATED FIELDS --------------------------------//
	ModeBits			ANIM_COMBAT
	AttackBits			ANIM_COMBAT, ANIM_HEADCAST
	HitBits				ANIM_HIT, ANIM_QUICK
	FramesBeforeHit			25
	AttackFrames			50

// -------------------------  FX RELATED FIELDS  --------------------------------------//
	AttackFx			"POWERS\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"POWERS\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"
	DelayedHit			1
	ProjectileSpeed			150
    
CustomFX "Bright Flames"
AltTheme "Bright Fire"
// -------------------------  ANIMATION RELATED FIELDS --------------------------------//
	ModeBits			ANIM_COMBAT
	AttackBits			ANIM_COMBAT, ANIM_HEADCAST
	HitBits				ANIM_HIT, ANIM_QUICK
	FramesBeforeHit			25
	AttackFrames			50

// -------------------------  FX RELATED FIELDS  --------------------------------------//
        Palette                         "Additive"
	AttackFx			"CustomizeablePowers\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"CustomizeablePowers\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"
	DelayedHit			1
	ProjectileSpeed			150
End

CustomFX "Dark Flames"
AltTheme "Dark Fire"
// -------------------------  ANIMATION RELATED FIELDS --------------------------------//
	ModeBits			ANIM_COMBAT
	AttackBits			ANIM_COMBAT, ANIM_HEADCAST
	HitBits				ANIM_HIT, ANIM_QUICK
	FramesBeforeHit			25
	AttackFrames			50

// -------------------------  FX RELATED FIELDS  --------------------------------------//
        Palette                         "Subtractive"
	AttackFx			"CustomizeablePowers\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"CustomizeablePowers\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"
	DelayedHit			1
	ProjectileSpeed			150
End

The above will add 3 options in the Power Customization menu for Ebon Eye.

Default - which is the purple
Bright Fire - Bright additive colors
Dark Fire - Dark palette etc

Note - the names Bright and Dark fire/flames can be changed.

We now want to keep the default entry untouched - so make sure you do not touch these files

	AttackFx			"POWERS\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"POWERS\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"

The files we want to look at and modify are:

	AttackFx			"CustomizeablePowers\CosmicPowers\Nictus\XRayBeam\XRayBeam.fx"
	HitFx				"CustomizeablePowers\CosmicPowers\Nictus\NictusQuickBlast\NictusQuickBlastHit.fx"

Which are the newly copied over files you did above.

The FX File

The FX file, like the previous files contains more references to additional files which contribute to making up the power fx.

The 3 typical files an FX file will point at are

Bhvr (Behavior files) - which controls physics, magnetism, gravity etc in relation to the power.
Geom (Geometry files) - these are typically physical objects or weapon models. In some cases they can be projectiles if the projectile has a solid physical form.
Part (Particle files) - these are definition files that define how particles are spawned and managed during the powers use.

Because Warshades and Peacebringers use particle effects primarily for their powers- it will be 'part' files that we will have to modify. Which ones you ask? Well.. to know that.. we need to look at the FX file for Ebon Eye.

Looking at: XRayBeam.fx


FxInfo - This declares the file as a FxInfo type class, ignore this.
LifeSpan - this is the max-life-type of the visual effect in frames (I think?) - 200 on Ebon Eye might sound like a lot, but I think it is set to a high number because this is the point where the powers projectile will vanish if it is chasing a moving target.

Your going to want to leave SOUND FX's as they are - unless you want to change the sounds too.

When dealing with FX's - they can also call other FX's. These are called 'ChildFX' - Most Warshade and Peacebringers use ChildFX - in order to make their eyes glow while powers are being used. Note- you need to change the path of this ChildFX otherwise your power will be one color, but your eyes will glow the default Kheldian color.

Change:

POWERS\CosmicPowers\Nictus\ActivationEyes\ActivationEyes.fx

to

CustomizeablePowers\CosmicPowers\Nictus\ActivationEyes\ActivationEyes.fx

Note- you will have to make ActivationEyes tintable as well - in order for it to use the same color options you pick for Ebon eye.


Work your way through the fx file and look for lines that refer to 'Part' type files. If it ever begins a filename with : (colon) - that means the file is local to the fx file that you are editing.

Eg:

Part	:XRayEyeGlow.Part

Ignore the Bhvr and Geom references for now - you want to find the Part files and edit them.

For each 'Part' file referenced in the FX file, edit it and follow the instructions in the following section.


The Particle File

The XRayEyeGlow.Part file and all other Part files for that matter, look like a mishmash of random information and it isn't nicely formatted at all, I am also fairly sure these were edited by hand by Cryptic staff - lots of commented out lines etc.

The file will look like this.

##############################
#Particle System 
#
System

#NewPerFrame		.3

Burst			2

EmissionType		0
EmissionRadius		0
#EmissionStartJitter	.3  .3 .3

WorldOrLocalPosition	1



OrientationJitter	180



Magnetism		0.00
#Gravity			-.001

InitialVelocity		0.0 0.023 -0.017
InitialVelocityJitter	0.0 0.0 0.0
VelocityJitter		0.0 0.0 0.0

TightenUp		0.08


FadeInBy 		20
FadeOutStart		51
FadeOutBy   		61

StartSize		.0001
StartSizeJitter		.001
ExpandType		1
ExpandRate		.05
EndSize			2.0

StreakType		0 			#1 Velocty  3 Origin
 StreakScale		0
 StreakOrient		0 			#1 Orient   0 No Orient
 StreakDirection	0 			#0 Pull     1 Push 

Blend_mode		0			#Tokened: 0 = Normal 1 = Additive  		


TextureName		sharpstar.tga 


Alpha			255

StartColor		1 1 1

Becolor1		5 5 5
ByTime1			20

Becolor2		5 5 5
ByTime2			60

End

The above file - XRayEyeGlow.part - is actually a file you should not edit. The reason being is that it is a 'Glow' file designed to add illumination / brightness to an effect over time. You can recognize these types of files by the behavior observed within their files.

EG: Look at lines that say

StartColor		1 1 1

Becolor1		5 5 5
ByTime1			20

Becolor2		5 5 5
ByTime2			60

StartColor - this is the RGB color defined as an integer trio. Eg: 255 255 255 would be white.
Becolor1 - this is another RGB color, but it is marked as a keyframe - this basically means that the particles will 'become' this color after a certain amount of time has elapsed.
ByTime1 - this is the time in frames, before the particles change from 'StartColor' to 'BeColor1'

BeColor2 and ByTime2 are just additional keyframes where the color can be modified further over time.

So if we think about this logically - Going from 1 1 1 to 5 5 5 : Is basically like going from 'nearly totally black' to 'slightly lighter black'.

The change in brightness would be insignificant to the human eye for the most part - and that is why this is not a good candidate for adding tinting. Close this file and move onto the next part file.


Eventually you will come across a file like NictusPurpleElectricity.part Which is totally a file that needs to be changed to enable tinting.

StartColor		100 10 155
ColorChangeType		2 

You can see that this has a RGB value that indicates a sort of blue/purple color.

What we want to do, is replace that with Primary and Secondary Tints.

Change these 2 lines to be

StartColor		255 255 255
ColorChangeType		2
PrimaryTint		75
SecondaryTint		25 

Make sure to preserve the ColorChangeType that is in the part file. Eg: If it says 0 - then use 0.

What we are doing here is setting the color to be white from the start of the effect, and then telling the system that we are going to feed in an override color via the Customization menu in the character creator. The numbers 75 and 25 are my personal preferences. It basically means that the final color displayed for the player is going to be 75% primary tint, and 25% secondary tint.

Primary Tints tend to be the colors that emanate from inside a particle effect (the core of an energy blast etc), while secondary tints tend to be the edges or the trails that follow. Using this logic you can get effects like Black energy, with red trails or vice versa etc.

Now that the part file has been changed - save it and close.

Move onto the next and repeat the process until all Part files needed for the FX are updated.


Keyframes + Tints

It is possible to have tints change color over time. Eg: Maybe you want the energy blast to start 75% primary and 25% secondary, but by the end of the power they swap around to be 25% primary, and 75% secondary etc.

Such an effect can be achieved via:

StartColor		255 255 255
ColorChangeType		0
PrimaryTint		75
SecondaryTint		25

ByTime1                 30
PrimaryTint1		25
SecondaryTint1		75 

With this logic, 30 frames in (1 second) - the primary and secondary tints will swap in intensity.

You can add up to 5 Color keyframes to a powers particle file these would take the form of:

StartColor : For starting static color
BeColor1 : second static color
BeColor2 : third
BeColor3 : fourth
BeColor4 : fifth

Each of the above must have a corresponding ByTime# value with exception of StartColor - which is the default color and requires no ByTime.

Eg:
ByTime1                30   ## 1 second in
ByTime2                60   ## 2 seconds in
ByTime3                90   ## 3 seconds in
ByTime4                120  ## 4 seconds in

Note- remember you are bound by the powers maximum life time. Take that into consideration when choosing ByTime valus.


You can also use PrimaryTints and SecondaryTints in place of BeColors

PrimaryTint        75
SecondaryTint      0      ## These 2 represent the starting color of the particles - this pair do NOT need a ByTime#

PrimaryTint1       50     ## the color when we reach the first keyframe (ByTime1)
SecondaryTint1     25

PrimaryTint2       45     ## the color when we reach the second keyframe (ByTime2)
SecondaryTint2     45

PrimaryTint3       25     ## the color when we reach the third keyframe (ByTime3)
SecondaryTint3     50

PrimaryTint4       0      ## the color when we reach the fourth keyframe (ByTime4)
SecondaryTint4     75

Like the BeColors - Primary/Secondary Tint pairs need to be accompanied by a 'ByTime#' value to tell the system 'when' these colors come into effect.


When you have edited enough particle files - complete your binning process and copy the following client bins to a pigg file.

behaviors.bin
particles.bin
powercats.bin
powers.bin
powersets.bin
VillainCostume.bin

VillainCostume.bin is generated with different content it seems, when you decouple the players powerset from the critters. I suspect this is because some of the particle effects are used for villains costumes - Such as the Nictus Hunter etc.

Once you have pigged the above files - drop it into your patch dir - start the game, open the character creator and create a dummy Warshade. Navigate to his costume and powers - and check to see what effect your efforts have had on his Ebon Eyes power.

Attached are some results from my changes to Shadow Bolt (NictusQuickBlast)