View Single Post
Old 01-30-2004, 11:44 AM   #1 (permalink)
DJRowley
Senior Member
 
Join Date: Mar 2003
Location: UK
Posts: 676
Send a message via MSN to DJRowley
Default Bouncing Grenades

I have decided to release some code I wrote for my TS mod which is highly unlikely to ever be released. Anyway, this code will create a disc thrower weapon where, if the projectile misses its target, it will bounce along the ground a bit and then blow up. Enjoy

Quote:
WeaponObjects.ini
;------------------------------------------------------------------------------
Object DiscGrenade

; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
ConditionState = NONE
Model = GIDisc_P
End
End

; ***DESIGN parameters ***
DisplayName = OBJECT:TankShell
EditorSorting = SYSTEM
ArmorSet
Armor = ProjectileArmor
End
VisionRange = 0.0

; *** ENGINEERING Parameters ***
KindOf = PROJECTILE
Body = ActiveBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
End

Behavior = DestroyDie ModuleTag_03
;nothing
End

Behavior = DumbProjectileBehavior ModuleTag_09
DetonateCallsKill = Yes
; To tweak a Bezier path, please see GS
FirstHeight = 20 ; Height of Bezier control points above highest intervening terrain
SecondHeight = 20
FirstPercentIndent = 33% ; Percentage of shot distance control points are placed
SecondPercentIndent = 75%
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 = 5 ; we can't have a zero mass, but we want it pretty tiny...
AllowBouncing = Yes
End

Behavior = HeightDieUpdate ModuleTag_06
TargetHeight = 1.0 ;;; changed from previous, 50
TargetHeightIncludesStructures = No
End

; ---- begin Projectile death behaviors
Behavior = InstantDeathBehavior DeathModuleTag_01
DeathTypes = NONE +DETONATED
; we detonated normally.
;FX = FX_NukeGLA
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
; kills self
FX = FX_GrenadeBounce
OCL = OCL_CreateBouncingGrenade
End
; ---- end Projectile death behaviors

Geometry = Sphere
GeometryIsSmall = Yes
GeometryMajorRadius = 1.0
Shadow = SHADOW_VOLUME
ShadowSizeX = 45 ; minimum elevation angle above horizon. Used to limit shadow length
Scale = 1.4

End

;------------------------------------------------------------------------------
Object DiscGrenadeBounce

; *** ART Parameters ***
Draw = W3DModelDraw ModuleTag_01
ConditionState = NONE
Model = GIDisc_P
End
End

; ***DESIGN parameters ***
DisplayName = OBJECT:TankShell
EditorSorting = SYSTEM
ArmorSet
Armor = ProjectileArmor
End
VisionRange = 0.0

; *** ENGINEERING Parameters ***
KindOf = PROJECTILE
Body = ActiveBody ModuleTag_02
MaxHealth = 100.0
InitialHealth = 100.0
End

Behavior = DestroyDie ModuleTag_03
;nothing
End


Behavior = LifetimeUpdate ModuleTag_04 ; random death time
MinLifetime = 1000 ; min lifetime in msec
MaxLifetime = 2000 ; max lifetime in msec
End

Behavior = PhysicsBehavior ModuleTag_05
Mass = 0.6 ; we can't have a zero mass, but we want it pretty tiny...
AllowBouncing = Yes
End

Behavior = FireWeaponWhenDeadBehavior ModuleTag_06
DeathWeapon = DiscThrowerGrenadeBounceWeapon
StartsActive = Yes
End

Behavior = WanderAIUpdate ModuleTag_07
End
Locomotor = SET_NORMAL DiscBounceLocomotor

; ---- begin Projectile death behaviors
Behavior = InstantDeathBehavior DeathModuleTag_01
DeathTypes = ALL
; we detonated normally.
FX = WeaponFX_GenericTankShellDetonation
End

; ---- end Projectile death behaviors

Geometry = Sphere
GeometryIsSmall = Yes
GeometryMajorRadius = 1.0
Shadow = SHADOW_VOLUME ; wanted so you can see that they are bouncing....
ShadowSizeX = 45 ; minimum elevation angle above horizon. Used to limit shadow length
Scale = 1.4

End
Quote:
Weapon.ini
;-------------------------------------------------------------------------------------------------

Weapon DiscThrowerGrenadeWeapon
PrimaryDamage = 60.0
PrimaryDamageRadius = 5.0
ScatterRadiusVsInfantry = 10.0 ;When this weapon is used against infantry, it can randomly miss by as much as this distance.
AttackRange = 150.0
MinTargetPitch = -15 ; we may not target anything outside of this pitch range
MaxTargetPitch = 15 ; ditto
DamageType = EXPLOSION
DeathType = NORMAL
WeaponSpeed = 200 ; dist/sec
ProjectileObject = DiscGrenade
ProjectileDetonationFX = WeaponFX_GenericTankShellDetonation
FireSound = MarauderTankWeapon
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS
DelayBetweenShots = 1500 ; time between shots, msec
ClipSize = 0 ; how many shots in a Clip (0 == infinite)
ClipReloadTime = 0 ; how long to reload a Clip, msec

; note, these only apply to units that aren't the explicit target
; (ie, units that just happen to "get in the way"... projectiles
; always collide with the Designated Target, regardless of these flags
ProjectileCollidesWith = STRUCTURES WALLS

End

;-------------------------------------------------------------------------------------------------

Weapon DiscThrowerGrenadeBounceWeapon
PrimaryDamage = 60.0
PrimaryDamageRadius = 5.0
AttackRange = 150.0
DamageType = EXPLOSION
DeathType = NORMAL
FireSound = MarauderTankWeapon
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS
DelayBetweenShots = 1500 ; time between shots, msec
ClipSize = 1 ; how many shots in a Clip (0 == infinite)
ClipReloadTime = 0 ; how long to reload a Clip, msec
End
Quote:
ObjectCreationList.ini
; -----------------------------------------------------------------------------
ObjectCreationList OCL_CreateBouncingGrenade
CreateObject
ObjectNames = DiscGrenadeBounce
Offset = X:0.0 Y:0.0 Z:1.0
Count = 1
Disposition = LIKE_EXISTING INHERIT_VELOCITY
End
End
Quote:
Locomotor.ini
;------------------------------------------------------------------------------
Locomotor DiscBounceLocomotor
Surfaces = GROUND RUBBLE
Speed = 250 ; in dist/sec
MinSpeed = 250
TurnRate = 1 ; in degrees/sec
TurnRateDamaged = 1 ; in degrees/sec
Acceleration = 100 ; in dist/(sec^2)
AccelerationDamaged = 100 ; in dist/(sec^2)
Braking = 1 ; in dist/(sec^2)
PreferredHeight = 1
ZAxisBehavior = NO_Z_MOTIVE_FORCE
Appearance = HOVER
StickToGround = No
AllowAirborneMotiveForce = Yes
End
You will need to make a simple disc w3d in Renx (or you could cheat and use a normal tank shell...) If you have a problem, post it here...
DJRowley is offline   Reply With Quote