Posted by: Tank Destroyer - Saturday, September 19, 2015 10:47:40 AM
So I was trying to make a weapon but encountered an annoying problem...
What It was supposed to do:
When the weapon is used it will fire a scud missile, then after a second the scud missile will disappear then 6 mini-missiles will spawn and rain down on the area.
What happened:
The missile fires, then after that the mini-missiles don't even spawn [sad]
Code:
[code=cpp];ObjectCreationList.ini
ObjectCreationList OCL_ScatterMissiles
DeliverPayload
Transport = AWATD_DeliveryUnit
FormationSize = 6
FormationSpacing = 1.0
StartAtPreferredHeight = Yes
StartAtMaxSpeed = Yes
MaxAttempts = 1 ;max attempts
DeliveryDistance = 250 ;distance from target allowed to start/stop dropping.
WeaponErrorRadius = 250 ; how bad the artillerist is
DelayDeliveryMax = 1000 ; his delayed reaction to "Fire!"
VisibleItemsDroppedPerInterval = 5 ;Drops two bombs at a time
VisibleDropBoneBaseName = RootTransform ;The bombs are created and dropped at this bone base
VisibleSubObjectBaseName = Bomb ;The bombs are visible until dropped.
VisibleNumBones = 1 ;Number of bones.
VisiblePayloadTemplateName = ScatterMissile ;Created when payload is dropped.
VisiblePayloadWeaponTemplate = ScatterMissileWeapon
InheritTransportVelocity = Yes ;The bombs will start at transport velocity.
ExitPitchRate = 30 ;The bomb will pitch down.
SelfDestructObject = Yes ; so the delivery vehicle goes away 'POP!'
DeliveryDecalRadius = 125
DeliveryDecal
Texture = SCCArtilleryBarrage_China
Style = SHADOW_ALPHA_DECAL
OpacityMin = 25%
OpacityMax = 50%
OpacityThrobTime = 500
Color = R:255 G:156 B:0 A:255
OnlyVisibleToOwningPlayer = Yes
End
End
End
;WeaponObjects.ini
Object ScatterMissile_Main
; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
OkToChangeModelColor = Yes
DefaultConditionState
Model = UBScudStrm_M
End
ConditionState = DAMAGED REALLYDAMAGED RUBBLE
Model = NONE
End
End
; ***DESIGN parameters ***
KindOf = PROJECTILE BALLISTIC_MISSILE
EditorSorting = SYSTEM
VisionRange = 300.0
ShroudClearingRange = 0
TransportSlotCount = 10
ArmorSet
Conditions = None
Armor = ProjectileArmor
DamageFX = None
End
; *** AUDIO Parameters ***
; SoundFallingFromPlane = DaisyCutterWeapon
; *** ENGINEERING Parameters ***
Body = ActiveBody ModuleTag_02
MaxHealth = 10000.0
InitialHealth = 10000.0
End
Behavior = PhysicsBehavior ModuleTag_03
Mass = 500.0
End
Behavior = MissileAIUpdate ModuleTag_04
TryToFollowTarget = No
FuelLifetime = 0 ; zero is infinite
InitialVelocity = 0 ; in dist/sec
IgnitionFX = FX_ScudStormIgnition
DistanceToTravelBeforeTurning = 500
DistanceToTargetBeforeDiving = 200 ; When I hit this close to target, I ignore PreferredHeight.
End
Behavior = LifetimeUpdate SplitMissile
MinLifetime = 1000
MaxLifetime = 1000
End
Behavior = InstantDeathBehavior ReleaseMissiles
DeathTypes = ALL -LASERED
OCL = OCL_ScatterMissiles
End
Locomotor = SET_NORMAL SCUDStormMissileLocomotor
Behavior = HeightDieUpdate ModuleTag_05
TargetHeight = 15.0
TargetHeightIncludesStructures = No
OnlyWhenMovingDown = Yes
SnapToGroundOnDeath = Yes
InitialDelay = 1000 ; Can't explode in the first second so we don't explode on the pad
End
Behavior = DestroyDie ModuleTag_06
;nothing
End
Geometry = Cylinder
GeometryIsSmall = Yes
GeometryMajorRadius = 7.0
GeometryHeight = 30.0
End
Object ScatterMissile
; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
OkToChangeModelColor = Yes
DefaultConditionState
Model = ExMsslTm
End
ConditionState = JAMMED
ParticleSysBone = None SparksMedium
End
End
; ***DESIGN parameters ***
DisplayName = OBJECT:RangerTeamMissile
EditorSorting = SYSTEM
VisionRange = 0.0
ArmorSet
Conditions = None
Armor = ProjectileArmor
DamageFX = None
End
; *** ENGINEERING Parameters ***
KindOf = PROJECTILE SMALL_MISSILE
Body = ActiveBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
; Subdual damage "Subdues" you (reaction defined by BodyModule) when it passes your max health.
; The cap limits how extra-subdued you can be, and the other numbers detemine how fast it drains away on its own.
; A projectile is not disabled, but instead loses target and scatters
SubdualDamageCap = 200
SubdualDamageHealRate = 100000
SubdualDamageHealAmount = 50
End
; ---- begin Projectile death behaviors
Behavior = InstantDeathBehavior DeathModuleTag_01
DeathTypes = NONE +DETONATED
; we detonated normally.
; no FX, just quiet destroy ourselves
End
Behavior = InstantDeathBehavior DeathModuleTag_02
DeathTypes = NONE +LASERED
; shot down by laser.
FX = FX_GenericMissileDisintegrate
OCL = OCL_GenericMissileDisintegrate
End
Behavior = InstantDeathBehavior DeathModuleTag_03
DeathTypes = ALL -LASERED -DETONATED
; shot down by nonlaser.
FX = FX_GenericMissileDeath
End
; ---- end Projectile death behaviors
Behavior = PhysicsBehavior ModuleTag_06
Mass = 1
End
Behavior = MissileAIUpdate ModuleTag_07
TryToFollowTarget = No
FuelLifetime = 3000
InitialVelocity = 150 ; in dist/sec
IgnitionDelay = 0
DistanceToTravelBeforeTurning = 3
IgnitionFX = FX_BuggyMissileIgnition
End
Locomotor = SET_NORMAL MissileDefenderMissileLocomotor
Geometry = Sphere
GeometryIsSmall = Yes
GeometryMajorRadius = 2.0
End[/code]
Posted by: Zatsupachi - Saturday, September 19, 2015 12:08:57 PM
[code]
;------------------------------------------------------------------------------
Object ASpt_NukeCannonShell
; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
ConditionState = NONE
Model = AVTankShel
ParticleSysBone = NONE ArtilleryBarrageTrail
ParticleSysBone = NONE ArtilleryBarrageTrailRing
End
End
; ***DESIGN parameters ***
DisplayName = OBJECT:TankShell
EditorSorting = SYSTEM
ArmorSet
Armor = ProjectileArmor
End
VisionRange = 0.0
; *** AUDIO Parameters ***
SoundAmbient = NukeCannonIncomingWhistle
; *** ENGINEERING Parameters ***
KindOf = PROJECTILE
Body = ActiveBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
End
Behavior = DestroyDie ModuleTag_03
;nothing
End
Behavior = DumbProjectileBehavior ModuleTag_04
; To tweak a Bezier path, please see GS
FirstHeight = 50 ; Height of Bezier control points above highest intervening terrain
SecondHeight = 150
FirstPercentIndent = 30% ; Percentage of shot distance control points are placed
SecondPercentIndent = 70%
FlightPathAdjustDistPerSecond = 0 ; Can allow a max speed this can attempt to follow a target. Units are their velocity we can tag.
End
Behavior = PhysicsBehavior ModuleTag_05
Mass = 0.01 ; we can't have a zero mass, but we want it pretty tiny...
End
Behavior = LifetimeUpdate ModuleTag_06
MinLifetime = 1000
MaxLifetime = 1200
End
Behavior = FireWeaponWhenDeadBehavior ModuleTag_10
DeathWeapon = ASpt_ScatterShellAestheticWeapon
StartsActive = Yes
End
Behavior = FireWeaponWhenDeadBehavior ModuleTag_102
DeathWeapon = ASpt_ScatterShellAestheticWeapon
StartsActive = Yes
End
Behavior = FireWeaponWhenDeadBehavior ModuleTag_103
DeathWeapon = ASpt_ScatterShellAestheticWeapon
StartsActive = Yes
End
Behavior = FireWeaponWhenDeadBehavior ModuleTag_104
DeathWeapon = ASpt_ScatterShellAestheticWeapon
StartsActive = Yes
End
Behavior = FireWeaponWhenDeadBehavior ModuleTag_105
DeathWeapon = ASpt_ScatterShellAestheticWeapon
StartsActive = Yes
End
Geometry = Sphere
GeometryIsSmall = Yes
GeometryMajorRadius = 1.0
End
Object ASpt_MiniShells
; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
ConditionState = NONE
Model = AVTankShel
ParticleSysBone = NONE CzAM_MiniShellTrail
End
End
; ***DESIGN parameters ***
Side = China
EditorSorting = SYSTEM
ArmorSet
Conditions = None
Armor = ProjectileArmor
DamageFX = None
End
VisionRange = 0.0
; *** AUDIO Parameters ***
; *** ENGINEERING Parameters ***
KindOf = PROJECTILE
Body = ActiveBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
End
Behavior = PhysicsBehavior ModuleTag_03
Mass = 75.0
AerodynamicFriction = 2 ; this is now friction-per-sec
ForwardFriction = 2 ; this is now friction-per-sec
CenterOfMassOffset = 2 ; Default of 0 means nothing tips as it falls. Positive tips forward, negative tips back
End
; it may seem odd to have a "bomb" with a Locomotor, especially a Thrust locomotor,
; but there's a good reason: the Aurora moves so freakin' fast that it's really
; hard to (1) find a reliable drop location, and (2) actually get it close enough to
; that location. So we cheat: just get fairly close, then let the "bomb" do a little (subtle)
; navigation on the way down. This works pretty well and actually looks much better
; than you might think. (srj)
Behavior = MissileAIUpdate ModuleTag_04
TryToFollowTarget = No
FuelLifetime = 0
IgnitionDelay = 0
InitialVelocity = 0 ; in dist/sec
DistanceToTravelBeforeTurning = 0
DistanceToTargetBeforeDiving = 0
End
Locomotor = SET_NORMAL AuroraBombLocomotor ; yes, that's right.
Scale = 0.75
Geometry = Sphere
GeometryIsSmall = Yes
GeometryMajorRadius = 1.0
End
[/code]
Posted by: Tank Destroyer - Sunday, September 20, 2015 11:16:34 AM
Well it kinda works(Just gonna have to tweak it a bit tho). But I have another question, is it possible to make a unit have an upgrade as a requirement? Whenever I try to do something like:
[code=cpp]
Prerequisites
Object = AWATDAirfield
Upgrade = Upgrade_AWATDPlasmaWeapons ; This always makes it crash
End
[/code]
Then it always results in an crash. I want to make some units buildable only when an upgrade is already researched... Help please?
Posted by: acidbrain - Sunday, September 20, 2015 12:34:34 PM
Maybe you can add 'Options = NEED_UPGRADE' to your construction commandbutton.
[code=plain]
CommandButton Command_ConstructYourThing
Command = UNIT_BUILD
Object = YourThing
Options = NEED_UPGRADE
Upgrade = Upgrade_AWATDPlasmaWeapons
TextLabel = CONTROLBAR:ConstructYourThing
ButtonImage = ImageHere
ButtonBorderType = BUILD
DescriptLabel = CONTROLBAR:ToolTipBuildYourThing
End
;Add this to the object code
Prerequisites
Object = AWATDAirfield
End
[/code]
Dont know if it works, didnt test it...
Greetz
Posted by: Gameanater - Tuesday, September 22, 2015 10:22:20 PM
Although I don't think this is very close at all to what you have in mind, you could try using "ProjectileDetonationOCL" in the weapon code to spawn an OCL that creates several units that wait a few seconds to explode or just explode instantly, if that's possible.
Posted by: Tank Destroyer - Wednesday, September 23, 2015 1:32:56 PM
Hmm, that idea I thought of came from [url=http://m.youtube.com/watch?v=ADniytpxM20]this[/url] video([i]notice in the video how the missiles split apart just when they're about to hit an enemy unit[/i])