Menu:

GenDev
 
   News
   Forums
   Downloads
   Link Us
   The Team

Cameo Mapper
 
   About
   How to Use
   Download

Tutorials
 
   Modding
   Graphics
   Mapping

Modding Resources
 
   GenDev Utilities
   User Submitted Models
   Alpha/Beta Models
   Tutorial Downloads
   Modding Utilities

Affiliates
 
   CNC DEN
   SDI

Using the Defector

By: Chronologic

Before you start you'll have to have the following INI files extracted:
SpecialPower.ini
FactionBuilding.ini (in the Object directory)
CommandButton.ini
CommandSet.ini

First you need to open up FactionBuilding.ini and search the entire file for the word "Defector" (without the quotes), you should be presented with a module that looks something like this:
Behavior = DefectorSpecialPower ModuleTag_28
SpecialPowerTemplate = SpecialPowerDefector ; @todo lorenzen add fatcursor params
End
Copy or Cut the module from its place and scroll down to whatever building you want to add it to, paste it in and adjust the ModuleTag string to one that is free, save, leave FactionBuilding.ini open for reference and switch to SpecialPower.ini.

In SpecialPower.ini perform a search for "SpecialPowerDefector", when the Defector is located you will have to comment out the RequiredScience line unless you want to add the Defector as a Generals ability point (which is beyond the scope of this tutorial), change the other statistics to flavour, save and close SpecialPower.ini.

Zero Hour - the defector is not present in SpecialPower.ini.You should use the following code:

;-----------------------------------------------------------------------------
SpecialPower SpecialPowerDefector
Enum = SPECIAL_DEFECTOR
ReloadTime = 600000 ; in milliseconds
;RequiredScience = SCIENCE_Defector
PublicTimer = Yes ;Should be changed to "No" if you make it Science-dependant
End

Deezire Note: You can also specify DetectionTime = N in this section, where N is the time it takes for a unit to fully defect (in milliseconds).
Open CommandButton.ini and copy and paste any Super Weapon target button then change the SpecialPower tag to the name of the Defector in SpecialPower.ini, change the section name to something easily remembered (I used Command_Defector). Wipe the Options clean and add CONTEXTMODE_COMMAND and then NEED_TARGET_XXX_OBJECT (Replacing XXX with ENEMY, ALLY or NEUTRAL). Save and keep CommandButton.ini open in the off chance that you forget the name of your Button.

Open CommandSet.ini and look for the CommandSet that the Object you placed the Defector module in uses, look for that Set, then find a number that hasn't been used and add your Command Button in the same style as all the other entries are, save and close all the open ini files.

Zero Hour:Now-it will be hard adding it to the shortcut-commands.
If you are adding the SW to USA-it will be impossible or you will have to remove some of the shortucts.China has a few free shortcuts.Slots 9 and 10 are free.GLA has slots 8,9 and 10 free.The common free slot is 9 (for an example) so simply add the following to either SpecialPowerShortcutChina or SpecialPowerShortcutGLA.
9 = Command_Defector

Test the Special Power in game, if you get any problems that can't be solved by checking through this tutorial again check the bug report first, then if your findings from there still don't solve the problem email me at mike@wendland.org.uk

Extra:
In MiscAudio.ini you have the following values that allow you to customise the noises that the Defector makes when capturing an enemy unit.
DefectorTimerTickSound = DefectorTimerTick ; played when a unit is defecting, etc.

And, for the SoundEffect.ini AudioEvent
AudioEvent DefectorTimerTick
Sounds = ucapture
Control = interrupt
Limit = 2
Volume = 50
VolumeShift = -10
MinRange = 200
MaxRange = 1200
Priority = high
Type = world shrouded everyone
End

And finally, Deezire has given me a little extra information that can help you add a bit more to the environment.
Each unit can be given a VoiceDefect = which is used when it is hit by the defector.

The DefectorSpecialPower module can take the FatCursorRadius = parameter too.

Credit to:
DeeZire for disclosing a lot of extra information.
Mad Ivan for adding in the extra bits about ZH before I got my hands on it.
You for taking the time to read this far!

Thanks all of you, couldn't have had half a tutorial without you

This tutorial was taken from Sleipnir's Stuff. For discussion and more information on this tutorial, visit this thread.

Layout by Origin-Network