sticky c4

Give a clear description of what you need and maybe Santa will deliver

sticky c4

Postby larynachos » Sat Aug 17, 2013 3:40 am

This has probably already been made, but I can't find it.

I want to be able to throw c4 onto a vehicle, drive it somewhere, bailout, then detonate it.

Impress me.
larynachos
 
Posts: 1
Joined: Sat Aug 17, 2013 3:37 am

Re: sticky c4

Postby Vilespring » Sat Aug 17, 2013 4:07 am

Why do that when you can do something funner?

copy this code, put it in any .con file. spawn it by typing "game.spawnObect V-bed" without the quotes.
Code: Select all

rem *** v-bed ***
ObjectTemplate.create PlayerControlObject V-Bed
ObjectTemplate.NameTagOffset -0.3/-0.2/0
ObjectTemplate.setNetworkableInfo WillyBodyInfo
ObjectTemplate.saveInSeparateFile 1
objectTemplate.cullRadiusScale 5
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.explosionRadius 20
ObjectTemplate.explosionDamage 5
ObjectTemplate.damageFromWater 1
ObjectTemplate.drag 1.5
ObjectTemplate.mass 2500
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasArmor 1
ObjectTemplate.speedMod 1
ObjectTemplate.exitTimer 0.75
ObjectTemplate.hitpoints 50
ObjectTemplate.maxhitpoints 50
ObjectTemplate.material 45
ObjectTemplate.criticalDamage 6
ObjectTemplate.hpLostWhileCriticalDamage 2
ObjectTemplate.explosionForceMod 20
ObjectTemplate.hpLostWhileUpSideDown 5
ObjectTemplate.hpLostWhileDamageFromWater 5
ObjectTemplate.timetoliveafterdeath 60
ObjectTemplate.fadeAtTimeToLiveAfterDeath 0
ObjectTemplate.addArmorEffect 30 e_WillyDamage 0/1.7/0
ObjectTemplate.addArmorEffect 6 e_WillyFire 0/0.5/0.8
ObjectTemplate.addArmorEffect 0 e_scrapmetal_willy 0/0/0
ObjectTemplate.addArmorEffect 0 e_ExplGas 0/1.2/0
ObjectTemplate.addArmorEffect -1 WaterWaterExplosion  0/0/0
ObjectTemplate.aiTemplate Willy
rem -------------------------------------
ObjectTemplate.addTemplate lodvbed
rem -------------------------------------
ObjectTemplate.setSoldierExitLocation -1.5/0/-0.8 0/0/0
ObjectTemplate.GUIIndex 26
ObjectTemplate.setVehicleIcon "Vehicle/Icon_willy.tga"
ObjectTemplate.setVehicleIconPos 40/79
ObjectTemplate.setPrimaryAmmoBar ABNone
ObjectTemplate.setCrossHairType CHTNone
ObjectTemplate.setVehicleCategory VCLand
ObjectTemplate.setVehicleType  VTScoutCar
ObjectTemplate.setToolTipType  TTScoutCar
ObjectTemplate.setMinimapIcon "Minimap/minimap_icon_common_16x16.tga"
ObjectTemplate.hasRestrictedExit 1

rem *** lodvbed ***
ObjectTemplate.create LodObject lodvbed
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
rem -------------------------------------
ObjectTemplate.addTemplate vbedComplex
ObjectTemplate.addTemplate WillySimple
ObjectTemplate.addTemplate WillyWreck
rem -------------------------------------
ObjectTemplate.lodSelector WillyLodSelector


rem *** vbedComplex ***
ObjectTemplate.create Bundle vbedComplex
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
rem -------------------------------------
ObjectTemplate.addTemplate lodWillyCockpit
rem ObjectTemplate.setPosition 0/0.6/-0.999
ObjectTemplate.addTemplate WillyCamera
ObjectTemplate.setPosition -0.38/0.95/-1.25
ObjectTemplate.addTemplate WillySeat
ObjectTemplate.setPosition -0.399/0.6/-0.75
ObjectTemplate.addTemplate WillyEntry
ObjectTemplate.setPosition 0/0/1
ObjectTemplate.addTemplate WillyEntry
ObjectTemplate.setPosition 0/0/-1
ObjectTemplate.addTemplate WillyEngine
ObjectTemplate.setPosition 0/0.35/-0.25
ObjectTemplate.addTemplate WillySteeringDummy
ObjectTemplate.setPosition -0.399/0.35/0.15
ObjectTemplate.setRotation 0/34/0
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
ObjectTemplate.addTemplate carbomb
rem #############front###################
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.4/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.4/0.5/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.3/1
ObjectTemplate.setRotation 0/-90/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.3/1
ObjectTemplate.setRotation 0/-90/0
rem ########hood##################
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.7/0.8
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.4/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.4/0.7/0.6
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.4/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.4/0.7/0.4
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.1/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.1/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.2/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.2/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.3/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.3/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.4/0.7/0.2
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.4/0.7/0.2
ObjectTemplate.setRotation 0/0/0
rem ###############side skirts#############
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.7/0.5/0.3
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.7/0.5/0.3
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition -0.7/0.5/0.5
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.7/0.5/0.5
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate bomb
ObjectTemplate.setPosition 0.7/0.5/0.7
ObjectTemplate.setRotation 0/0/0
rem -------------------------------------

rem bomb looking thing
ObjectTemplate.create SimpleObject bomb
ObjectTemplate.geometry ExpPack



rem *** explosive ***
ObjectTemplate.create FireArms carbomb
ObjectTemplate.setNetworkableInfo TankFireArmInfo
ObjectTemplate.projectileTemplate bombboom
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize 1
ObjectTemplate.numOfMag 1
ObjectTemplate.velocity 100
ObjectTemplate.autoReload 1
ObjectTemplate.reloadtime 0.25
ObjectTemplate.roundOfFire 0.25
ObjectTemplate.fireingForce 0
ObjectTemplate.recoilSpeed 0
ObjectTemplate.recoilSize 0
ObjectTemplate.setFireArmsPosition 0/0/1 0/0/0



rem bombboom
ObjectTemplate.create Projectile bombboom
ObjectTemplate.networkableInfo ProjectileInfo
ObjectTemplate.geometry ExpPack
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 9999
ObjectTemplate.maxHitPoints 9999
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/0/0/0
ObjectTemplate.dieAfterColl 0
ObjectTemplate.radius 50
ObjectTemplate.ForceOnExplosion 50
ObjectTemplate.DamageType 1
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.useMMOnEndEffect 1
ObjectTemplate.material 70
ObjectTemplate.material2 204
ObjectTemplate.damageType 1
ObjectTemplate.endEffectTemplate e_ExplGranade
ObjectTemplate.noFFSound 1


Take care of that code please! I made it and it took forever to get the bombs right. :lol:
left click is the BOOOM thing.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Vilespring
 
Posts: 743
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: sticky c4

Postby Apache Thunder » Sat Aug 17, 2013 7:26 am

There's one way of doing this. There is an unused code you can use on the projectile template for the C4:

Code: Select all
ObjectTemplate.isSticky 1


Here's a really old video I made of my BF1942 mod "Battlefield Heroes'42" where I first implemented this feature for the Sticky TNT from BFHeroes. It still works the same way in the current version, but I think this is the only video that directly shows the TNT in action:



It sticks to vehicles and explodes shortly after. Because in Battlefield Heroes the TNT is only a timed explosive, I did not need to use a detonator, thus I had no issues simply removing the netinfo and making the projectile sticky. Though in this mod, the sticky TNT is it's own template and object name and doesn't actually replace the ExpPack in the code. The mod simply doesn't have the vanilla ExpPack in any of the kits. I created a new template for the Sticky TNT. :P

BUT you must remove network info from the projectile or you will get game CTDs. This also means you will no longer be able to detonate the C4 on demand. (removing net info will brake the detonator)

Thus you must convert the C4 to a timed explosive by using a smaller timeToLive setting on the projectile template:

Code: Select all
ObjectTemplate.timeToLive CRD_NONE/10/0/0


That's about the best way to do it. The other way is to change the material ID of the c4 (the material1 property for direct collision, don't change the second one. That one is for splash damage) to a custom material that has the friction/resistance values increased. It's best to do this on a new material because the c4 shares the same material ID as the grenades for direct collision.

I'm assuming you wanted to do this in vanilla BF1942 as you did not specify what mod you wanted to do this in. Most mods use the same materials for the c4. (in vanilla BF1942, C4 goes by "ExpPack" in the con files) But not all of them. So keep an eye out for that.
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1192
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: sticky c4

Postby Vilespring » Sat Aug 17, 2013 6:39 pm

I forgot about that code. :oops:
Well, it works too.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Vilespring
 
Posts: 743
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: sticky c4

Postby Swaffy » Tue Aug 27, 2013 7:49 pm

It's really important to remove the NetworkInfo from the projectile, otherwise the game will crash when it's used.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Image
User avatar
Swaffy
 
Posts: 1708
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas


Return to Make a Request!

Who is online

Users browsing this forum: No registered users and 7 guests