Ok...to have a upgrade that only applies for one specific unit:
Go to upgrade.ini and make your initial upgrade:
Upgrade.ini
Code:
Upgrade Upgrade_B2HN
DisplayName = UPGRADE:B2hn
Type = OBJECT
BuildTime = 6.0
BuildCost = 1000
ButtonImage = SOB2hn
End
Now make sure its on Type = Object because that will prove crucial in making it for one unit or all units...
Now; if you have an actual object that latches on to the unit [like the overlord], you must go to Objectcreationlist.ini first and make one of these[this is using overlord code because my b2 only upgraded with nuclear munitions]...
ObjectCreationList.ini
Code:
ObjectCreationList OCL_OverlordGattlingCannon
CreateObject
ObjectNames = ChinaTankOvelordGattlingCannon
Count = 1
ContainInsideSourceObject = Yes
End
End
Now you advance to Commandbutton.ini
CommandButton.ini
Code:
CommandButton Command_UpgradeAmericaB2HeavyNuclearBombs
Command = OBJECT_UPGRADE
Upgrade = Upgrade_B2HN
Options = OK_FOR_MULTI_SELECT NOT_QUEUEABLE
TextLabel = CONTROLBAR:UpgradeB2nHeavyNukes
ButtonImage = SOB2hn
ButtonBorderType = UPGRADE ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:ToolTipUpgradeAmericaB2nHeavyNukes
End
FOR THE OVERLORD:
Code:
CommandButton Command_UpgradeChinaOverlordGattlingCannon
Command = OBJECT_UPGRADE
Upgrade = Upgrade_ChinaOverlordGattlingCannon
Options = OK_FOR_MULTI_SELECT NOT_QUEUEABLE
TextLabel = CONTROLBAR:UpgradeChinaOverlordGattlingCannon
ButtonImage = SSOLGattling
ButtonBorderType = UPGRADE ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:TooltipUpgradeChinaOverlordGattlingCannon
UnitSpecificSound = OverlordTankVoiceModeGattling
End
Now move on to commandset.ini
CommandSet.ini
Code:
CommandSet AmericaB2nCommandSet
1 = Command_UpgradeAmericaB2HeavyNuclearBombs
9 = Command_AttackMove
12 = Command_Stop
End
Last but not least, we have to go to the source of the upgrade [here, the b2] and put code in there explaining that this will attack or will upgrade...now attaching it is much different than just upgrading...so what i will do is post overlord code to show the attachment and upgrade:
Factionunit.ini [partial overlord code]
[code]Behavior = OverlordContain ModuleTag_06 ; Like Transport, but when full, passes transport queries along to first passenger (redirects like tunnel)
Slots = 1
DamagePercentToUnits = 100%
AllowInsideKindOf = PORTABLE_STRUCTURE
PassengersAllowedToFire = Yes
PassengersInTurret = Yes ; My passengers ride in my turret, that's where the Firepoint bones are
End
Behavior = ObjectCreationUpgrade ModuleTag_07
UpgradeObject = OCL_OverlordGattlingCannon
TriggeredBy = Upgrade_ChinaOverlordGattlingCannon
ConflictsWith = Upgrade_ChinaOverlordPropagandaTower MaxQueueEntries = 1; So you can't build multiple upgrades in the same frame
End
Behavior = CommandSetUpgrade ModuleTag_11
CommandSet = ChinaTankOverlordGattlingCannonCommandSet
TriggeredBy = Upgrade_ChinaOverlordGattlingCannon
ConflictsWith = Upgrade_ChinaOverlordPropagandaTower
Notice these things here...they show that the commandset will be switched when the upgrade is activated...
Code:
Object ChinaTankOverlordGattlingCannon
; *** ART Parameters ***
SelectPortrait = SNGatTower_L
ButtonImage = SNGatTower
;UpgradeCameo1 = Upgrade_Nationalism
UpgradeCameo1 = Upgrade_ChinaUraniumShells
UpgradeCameo2 = Upgrade_ChinaNuclearTanks
;UpgradeCameo4 = NONE
UpgradeCameo5 = Upgrade_ChinaOverlordGattlingCannon
Draw = W3DDependencyModelDraw ModuleTag_01
OkToChangeModelColor = Yes
AttachToBoneInContainer = FIREPOINT01
DefaultConditionState
Model = NVOvrlrd_G
Turret = TURRET01
TurretPitch = TURRETEL
WeaponFireFXBone = PRIMARY Muzzle
WeaponMuzzleFlash = PRIMARY MuzzleFX
WeaponFireFXBone = SECONDARY Muzzle
WeaponMuzzleFlash = SECONDARY MuzzleFX
End
ConditionState = CONTINUOUS_FIRE_SLOW
Model = NVOvrlrd_G
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.1 0.1 ;set this state to animate s l o w l y
End
ConditionState = CONTINUOUS_FIRE_MEAN
Model = NVOvrlrd_G
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.2 0.2 ;set this state to animate medium-fast
End
ConditionState = CONTINUOUS_FIRE_FAST
Model = NVOvrlrd_G
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.3 0.3 ;set this state to animate vryfst
ParticleSysBone = Muzzle01 GattlingMuzzleSmoke
ParticleSysBone = Muzzle02 GattlingMuzzleSmoke
End
ConditionState = REALLYDAMAGED
Model = NVOvrlrd_GD
Turret = TURRET01
TurretPitch = TURRETEL
WeaponFireFXBone = PRIMARY Muzzle
WeaponMuzzleFlash = PRIMARY MuzzleFX
WeaponFireFXBone = SECONDARY Muzzle
WeaponMuzzleFlash = SECONDARY MuzzleFX
ParticleSysBone = Smoke01 SmokeFactionMedium
ParticleSysBone = Smoke02 SmokeFactionMedium
ParticleSysBone = Smoke03 SmokeFactionMedium
ParticleSysBone = SparkM01 SparksMedium
ParticleSysBone = SparkM02 SparksMedium
End
ConditionState = CONTINUOUS_FIRE_SLOW REALLYDAMAGED
Model = NVOvrlrd_GD
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.1 0.1 ;set this state to animate s l o w l y
End
ConditionState = CONTINUOUS_FIRE_MEAN REALLYDAMAGED
Model = NVOvrlrd_GD
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.2 0.2 ;set this state to animate medium-fast
End
ConditionState = CONTINUOUS_FIRE_FAST REALLYDAMAGED
Model = NVOvrlrd_GD
Animation = NVOvrlrd_G.NVOvrlrd_G
AnimationMode = LOOP
AnimationSpeedFactorRange = 0.3 0.3 ;set this state to animate vryfst
ParticleSysBone = Muzzle01 GattlingMuzzleSmoke
ParticleSysBone = Muzzle02 GattlingMuzzleSmoke
End
End
; ***DESIGN parameters ***
Side = China
EditorSorting = SYSTEM
TransportSlotCount = 1
WeaponSet
Conditions = None
Weapon = PRIMARY GattlingBuildingGun
Weapon = SECONDARY GattlingBuildingGunAir
PreferredAgainst = SECONDARY BALLISTIC_MISSILE AIRCRAFT
End
ArmorSet
Conditions = None
Armor = InvulnerableAllArmor ; We can't be hurt on the field. We share damage from the Overlord with his damage module
End
VisionRange = 200
; *** AUDIO Parameters ***
UnitSpecificSounds
TurretMoveStart = NoSound
TurretMoveLoop = NoSound ;TurretMoveLoop
VoiceRapidFire = NoSound
End
; *** ENGINEERING Parameters ***
KindOf = PRELOAD PORTABLE_STRUCTURE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CLICK_THROUGH IGNORED_IN_GUI
Body = StructureBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
End
Behavior = AIUpdateInterface ModuleTag_03
Turret
ControlledWeaponSlots = PRIMARY SECONDARY
TurretTurnRate = 60 // turn rate, in degrees per sec
TurretPitchRate = 60
AllowsPitch = Yes
End
AutoAcquireEnemiesWhenIdle = Yes
End
Behavior = DestroyDie ModuleTag_04
;nothing
End
Behavior = WeaponBonusUpgrade ModuleTag_05
TriggeredBy = Upgrade_ChinaChainGuns
End
Behavior = StealthDetectorUpdate ModuleTag_06
DetectionRate = 500 ; how often to rescan for stealthed things in my sight (msec)
;DetectionRange = ??? ; Defaults to VisionRange
CanDetectWhileContained = Yes
End
Geometry = BOX
GeometryMajorRadius = 8.0
GeometryMinorRadius = 8.0
GeometryHeight = 9.0
GeometryIsSmall = No
Shadow = SHADOW_VOLUME
ShadowSizeX = 45 ; minimum elevation angle above horizon. Used to limit shadow length
End
Now, this part may be hard to understand, but the reason i have this posted here, is to show that object upgrades [such as the gattling cannon for the overlord] require another actual object; therefore, you need another unit code. Note the red underlined text. This is important. This is underline because it identifies where on the unit the object will spawn when you have upgraded to it. If you were to view the Overlord in Renx, you would notice that it does have a bone called FIREPOINT01. This is where the objects will spawn after being upgraded.
Test the game, and you should be done... if you have further questions, just contact me on aim or yahoo...