Help - Search - Members - Calendar
Full Version: Weapon crashes game, bf1942_r doesn't notice!
Battlefield SinglePlayer Forum > Main > BF42 and BFV Discussion > AI Editing and Mod Support
Fireball1
I'm putting a weapon into my mod, and it crashes the game. It is a weapon with an custom projectile, and I haven't tried that before, so I expected the crash. However, I ran it again under bf1942_r (debugger) and it crashed without a message or anything!

Basically, when I start the game, it starts, and I click the kit that has the corresponding weapon... and that's when the game crashes.

I'm not sure what is causing the crash, though. I basically put it right over top of the Type5 and replaced the name... I also cNped a part for the projectile (I later deleted it, still crashed)

Here's the code!

[code]ObjectTemplate.create HandFireArms SonicBlaster
ObjectTemplate.itemIndex 3
ObjectTemplate.networkableInfo HandFireArmsInfo
ObjectTemplate.projectileTemplate SonicBlasterProjectile
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize 15
ObjectTemplate.numOfMag 4
ObjectTemplate.magType 0
ObjectTemplate.reloadtime 3.0
ObjectTemplate.roundOfFire 2.2
rem ObjectTemplate.roundOfFire 4
objectTemplate.aiTemplate SonicBlasterAI
ObjectTemplate.zoomFov 0.6
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.fireOnce 1
ObjectTemplate.altFireOnce 1
ObjectTemplate.soldierZoomFov 0.8
ObjectTemplate.soldierZoomPosition -0.04/-0.03/0
ObjectTemplate.soldierCameraPosition -0.02/-0.03/0.01
ObjectTemplate.addRootSpeed 0
ObjectTemplate.ammoType 1

ObjectTemplate.GUIIndex 3
ObjectTemplate.setHudAmmoType ATAmmoBar
ObjectTemplate.setAmmoBar "Ingame/Magbar_Rifle_empty_32x64.tga"
ObjectTemplate.setAmmoBarFill "Ingame/Magbar_Rifle_full_32x64.tga"
ObjectTemplate.setAmmoBarSize 20
ObjectTemplate.setAmmoBarPosX 6
ObjectTemplate.setAmmoBarPosY -17
ObjectTemplate.setAmmoBarTextPosX 5
ObjectTemplate.setAmmoBarTextPosY 10
ObjectTemplate.setCrossHairType CHTCrossHair

Rem *** Deviation Begin *****

ObjectTemplate.velocity 1000
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/1.2/1.2/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/-0.1/-0.3/0
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setGoBackOnRecoil 1

ObjectTemplate.setFireDev 1.8 0.3 0.08
rem ObjectTemplate.setFireDev 1.8 0.25 0.03
ObjectTemplate.setDevMod 1 0.7 0.5
rem ObjectTemplate.setDevMod 1 0.7 0.5
ObjectTemplate.setMinDev 0.25
ObjectTemplate.setTurnDev 0.3 0.2 0.2 0.1
rem ObjectTemplate.setTurnDev 0 0 0 0
ObjectTemplate.setSpeedDev 1.3 0.4 0.4 0.2
rem ObjectTemplate.setSpeedDev 1.2 0.3 0.3 0.1


ObjectTemplate.setMiscDev 1.8 1.8 0.1

Rem *** Deviation End *****

ObjectTemplate.fireInCameraDof 1
ObjectTemplate.loadSoundScript Sounds/SonicBlaster.ssc

ObjectTemplate.createSkeleton animations/SonicBlaster.ske
ObjectTemplate.useSkeletonPartAsMain Base

rem *** LodObject must be located as first child to work on handweapons.
ObjectTemplate.addTemplate SonicBlasterLod

ObjectTemplate.addTemplate e_MuzzGun
ObjectTemplate.setPosition 0/0.05/0.84
ObjectTemplate.setRotation 0/0/0

ObjectTemplate.addTemplate e_shellM1Garand
ObjectTemplate.setPosition 0/0.1/0.41
ObjectTemplate.setRotation 0/0/0

rem -------------------------------------
rem LasCannonWeaponProjectile
rem -------------------------------------
ObjectTemplate.create Projectile SonicBlasterProjectile
ObjectTemplate.createNotInGrid 1
ObjectTemplate.loadSoundScript ../../Common/Sounds/Projectile.ssc
ObjectTemplate.geometry projectile_m1
ObjectTemplate.gravityModifier 0
ObjectTemplate.ExplosionForceMod 0.5
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Radius 2
ObjectTemplate.timeToLive CRD_NONE/10/0/0
ObjectTemplate.damageType 1
ObjectTemplate.material 236
ObjectTemplate.material2 206
ObjectTemplate.hasCollisionEffect 1
ObjectTemplate.explosionDamage 0
ObjectTemplate.addTemplate e_SonicBlasterBeam
ObjectTemplate.setPosition 0/0/-10

ObjectTemplate.create SimpleObject SonicBlasterSimple
ObjectTemplate.geometry SonicBlasterSimple

ObjectTemplate.create AnimatedBundle SonicBlasterComplex
ObjectTemplate.createSkeleton animations/SonicBlaster.ske
ObjectTemplate.geometry SonicBlaster
ObjectTemplate.hasDynamicShadow 1

ObjectTemplate.create LodObject SonicBlasterLod
ObjectTemplate.lodselector HandWeaponLodSelect

CONTINUED

or HandWeaponLodSelector
ObjectTemplate.addTemplate SonicBlasterComplex
ObjectTemplate.addTemplate SonicBlasterSimple[/code]

That was objects, this is Geometries

CODE
GeometryTemplate.create StandardMesh SonicBlaster
GeometryTemplate.file SonicBlaster
GeometryTemplate.hasDynamicShadow 1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 3
GeometryTemplate.setLodDistance 2 10
GeometryTemplate.setLodDistance 3 20
GeometryTemplate.setLodDistance 4 30
GeometryTemplate.setLodDistance 5 100

GeometryTemplate.create StandardMesh SonicBlasterSimple
GeometryTemplate.file SonicBlaster
GeometryTemplate.hasDynamicShadow 1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 300


and finally, the effect
CODE
rem -------------------------------------
rem e_LasCannonBeam
rem -------------------------------------
ObjectTemplate.create EffectBundle e_SonicBlasterBeam
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.timeToLive CRD_NONE/7/0/0
rem -------------------------------------
ObjectTemplate.addTemplate Em_SonicBlasterBeam
rem -------------------------------------


rem -------------------------------------
rem Em_LasCannonBeam
rem -------------------------------------
ObjectTemplate.create Emitter Em_SonicBlasterBeam
ObjectTemplate.template Fx_SonicBlasterBeam
ObjectTemplate.looping 0
ObjectTemplate.startAtCreation 1
ObjectTemplate.addEmitterSpeed 0
ObjectTemplate.emitterSpeedScale 0
ObjectTemplate.startProbability 1
ObjectTemplate.lodDistance 400
ObjectTemplate.timeToLive CRD_NONE/3/0/0
ObjectTemplate.intensity CRD_NONE/100/0/0
ObjectTemplate.positionalSpeedInUp CRD_UNIFORM/0/0/0
ObjectTemplate.positionalSpeedInRight CRD_UNIFORM/0/0/0


rem -------------------------------------
rem Fx_LasCannonBeam
rem -------------------------------------
ObjectTemplate.create Particle Fx_SonicBlasterBeam
ObjectTemplate.geometry SonicBlasterBeam
ObjectTemplate.timeToLive CRD_NONE/0.7/0/0
ObjectTemplate.gravityModifier CRD_NONE/0/0/0
ObjectTemplate.drag CRD_NONE/0/0/0
ObjectTemplate.AlphaOverTime 0/1|50/0.25|100/0.0


CODE
GeometryTemplate.create StandardMesh SonicBlasterBeam
GeometryTemplate.file SonicBlasterBeam
GeometryTemplate.Scale 3/3/4
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 100
GeometryTemplate.setLodDistance 2 200
GeometryTemplate.setLodDistance 3 400
GeometryTemplate.setLodDistance 4 500
GeometryTemplate.setLodDistance 5 600




A lot of code! Hopefully someone will be able to point out what's going on... thanks for any help!



[quote name='Fireball1' date='Sep 11 2006, 08:25 PM' post='53246']
I'm putting a weapon into my mod, and it crashes the game. It is a weapon with an custom projectile, and I haven't tried that before, so I expected the crash. However, I ran it again under bf1942_r (debugger) and it crashed without a message or anything!

Basically, when I start the game, it starts, and I click the kit that has the corresponding weapon... and that's when the game crashes.

I'm not sure what is causing the crash, though. I basically put it right over top of the Type5 and replaced the name... I also cNped a part for the projectile (I later deleted it, still crashed)

Here's the code!

[code]ObjectTemplate.create HandFireArms SonicBlaster
ObjectTemplate.itemIndex 3
ObjectTemplate.networkableInfo HandFireArmsInfo
ObjectTemplate.projectileTemplate SonicBlasterProjectile
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize 15
ObjectTemplate.numOfMag 4
ObjectTemplate.magType 0
ObjectTemplate.reloadtime 3.0
ObjectTemplate.roundOfFire 2.2
rem ObjectTemplate.roundOfFire 4
objectTemplate.aiTemplate SonicBlasterAI
ObjectTemplate.zoomFov 0.6
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.fireOnce 1
ObjectTemplate.altFireOnce 1
ObjectTemplate.soldierZoomFov 0.8
ObjectTemplate.soldierZoomPosition -0.04/-0.03/0
ObjectTemplate.soldierCameraPosition -0.02/-0.03/0.01
ObjectTemplate.addRootSpeed 0
ObjectTemplate.ammoType 1

ObjectTemplate.GUIIndex 3
ObjectTemplate.setHudAmmoType ATAmmoBar
ObjectTemplate.setAmmoBar "Ingame/Magbar_Rifle_empty_32x64.tga"
ObjectTemplate.setAmmoBarFill "Ingame/Magbar_Rifle_full_32x64.tga"
ObjectTemplate.setAmmoBarSize 20
ObjectTemplate.setAmmoBarPosX 6
ObjectTemplate.setAmmoBarPosY -17
ObjectTemplate.setAmmoBarTextPosX 5
ObjectTemplate.setAmmoBarTextPosY 10
ObjectTemplate.setCrossHairType CHTCrossHair

Rem *** Deviation Begin *****

ObjectTemplate.velocity 1000
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/1.2/1.2/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/-0.1/-0.3/0
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setGoBackOnRecoil 1

ObjectTemplate.setFireDev 1.8 0.3 0.08
rem ObjectTemplate.setFireDev 1.8 0.25 0.03
ObjectTemplate.setDevMod 1 0.7 0.5
rem ObjectTemplate.setDevMod 1 0.7 0.5
ObjectTemplate.setMinDev 0.25
ObjectTemplate.setTurnDev 0.3 0.2 0.2 0.1
rem ObjectTemplate.setTurnDev 0 0 0 0
ObjectTemplate.setSpeedDev 1.3 0.4 0.4 0.2
rem ObjectTemplate.setSpeedDev 1.2 0.3 0.3 0.1


ObjectTemplate.setMiscDev 1.8 1.8 0.1

Rem *** Deviation End *****

ObjectTemplate.fireInCameraDof 1
ObjectTemplate.loadSoundScript Sounds/SonicBlaster.ssc

ObjectTemplate.createSkeleton animations/SonicBlaster.ske
ObjectTemplate.useSkeletonPartAsMain Base

rem *** LodObject must be located as first child to work on handweapons.
ObjectTemplate.addTemplate SonicBlasterLod

ObjectTemplate.addTemplate e_MuzzGun
ObjectTemplate.setPosition 0/0.05/0.84
ObjectTemplate.setRotation 0/0/0

ObjectTemplate.addTemplate e_shellM1Garand
ObjectTemplate.setPosition 0/0.1/0.41
ObjectTemplate.setRotation 0/0/0

rem -------------------------------------
rem LasCannonWeaponProjectile
rem -------------------------------------
ObjectTemplate.create Projectile SonicBlasterProjectile
ObjectTemplate.createNotInGrid 1
ObjectTemplate.loadSoundScript ../../Common/Sounds/Projectile.ssc
ObjectTemplate.geometry projectile_m1
ObjectTemplate.gravityModifier 0
ObjectTemplate.ExplosionForceMod 0.5
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Radius 2
ObjectTemplate.timeToLive CRD_NONE/10/0/0
ObjectTemplate.damageType 1
ObjectTemplate.material 236
ObjectTemplate.material2 206
ObjectTemplate.hasCollisionEffect 1
ObjectTemplate.explosionDamage 0
ObjectTemplate.addTemplate e_SonicBlasterBeam
ObjectTemplate.setPosition 0/0/-10

ObjectTemplate.create SimpleObject SonicBlasterSimple
ObjectTemplate.geometry SonicBlasterSimple

ObjectTemplate.create AnimatedBundle SonicBlasterComplex
ObjectTemplate.createSkeleton animations/SonicBlaster.ske
ObjectTemplate.geometry SonicBlaster
ObjectTemplate.hasDynamicShadow 1

ObjectTemplate.create LodObject SonicBlasterLod
ObjectTemplate.lodselec
Sting
You trying this in a Conquest or co-op mode? If co-op then there might be a problem with the AI settings, if the AI exists that is. That was my first thought since you are able to get all the way to the point of selecting the kit, and that would probably be the default weapon for that kit.

Check the debug log for the last few things listed, sometimes it will give you a hint. Otherwise you need to start some basic troubleshooting by either setting the projectile back to a standard one (to see if the problem is with the weapon), or try adding the new projectile to an existing weapon.
Depending on the outcome, you might know better where you problem is.
rpw0311
Do you actually have those ske files for the animations and did you also add the weapons to the animation states files? Debugg will crash with no information on handweapon stuff it doesn't like. You can enable animation debugg also to get the debugg exe to ussually make it past a critical problem and let you know what is wrong.

Fireball1
Ahh, I figured it out! I didn't have a certain couple of lines (although the ske file was a problem too, since I was using the type5.ske, but I had it as sonicblaster.ske)

Thanks for all the help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.