Modified tank destruction

Ask questions, discuss ideas, get answers
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Modified tank destruction

Post by Vilespring »

I have attempted to make the Tiger tank in the game just have its turret fly off when it dies, instead of what it currently does. Mocking some code I found in the AA allies, I made these modifications

Code: Select all

rem *** Tiger ***
ObjectTemplate.create PlayerControlObject Tiger
ObjectTemplate.setNetworkableInfo TigerBodyInfo
ObjectTemplate.saveInSeparateFile 1

(bla bla bla, stuff I didn't change)

ObjectTemplate.addArmorEffect 12 e_PanzFire 0/1/-1.4
ObjectTemplate.addArmorEffect 0 e_ExplGas 0/0/0
ObjectTemplate.addArmorEffect 0 e_scrapmetal 0/0/0
ObjectTemplate.addArmorEffect 0 e_Tigerexplosion
ObjectTemplate.addArmorEffect -1 WaterWaterExplosion 0/0/0
ObjectTemplate.damageFromWater 1
ObjectTemplate.aiTemplate Tiger
rem -------------------------------------
ObjectTemplate.addTemplate lodTiger
rem -------------------------------------
ObjectTemplate.setSoldierExitLocation -2.3/0.5/0 0/0/0
ObjectTemplate.GUIIndex 75

(bla bla bla, stuff I didn't change)

rem *** TigerWreck ***
ObjectTemplate.create bundle TigerWreck
ObjectTemplate.geometry Tiger_Hull_M1
ObjectTemplate.addTemplate TigerHullHatch
ObjectTemplate.setPosition -1.199/0.65/1.8


rem *** TigerLodSelector ***
LodSelectorTemplate.create DistCompareSelector2 TigerLodSelector
LodSelectorTemplate.hasDestroyedLod 1
LodSelectorTemplate.addLodDistance 100

rem -----------------------------------------------------------------------
rem -------------------boom effects----------------------------------------
rem -----------------------------------------------------------------------


rem *** e_Tigerexplosion***
ObjectTemplate.create EffectBundle e_Tigerexplosion
ObjectTemplate.saveInSeparateFile 1
rem -------------------------------------
ObjectTemplate.addTemplate Em_TigerTurret
ObjectTemplate.setPosition 0/1/0
ObjectTemplate.timeToLive CRD_NONE/1.8/0/0
rem -------------------------------------


rem *** Em_TigerTurret ***
ObjectTemplate.create Emitter Em_TigerTurret
ObjectTemplate.template TigerDestroyedTurret
addTemplate e_CorsairFire
ObjectTemplate.addEmitterSpeed 1
ObjectTemplate.emitterSpeedScale 1
ObjectTemplate.lodDistance 375
ObjectTemplate.timeToLive CRD_NONE/1/0/0
ObjectTemplate.intensity CRD_NONE/1/0/0
ObjectTemplate.relativePositionInDof CRD_NONE/0.1/0/0
ObjectTemplate.positionalSpeedInDof CRD_UNIFORM/10/0/1
ObjectTemplate.positionalSpeedInUp CRD_UNIFORM/20/15/0
ObjectTemplate.positionalSpeedInRight CRD_UNIFORM/10/0/1
ObjectTemplate.startRotation CRD_UNIFORM/1/100/0


rem *** TigerDestroyedTurret ***
ObjectTemplate.create Bundle TigerDestroyedTurret
ObjectTemplate.addTemplate e_FireSmallYellow
ObjectTemplate.geometry Tiger_Tow_M1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.destroyed 1
ObjectTemplate.sinkInToLandAfterDeathSpeed 1
ObjectTemplate.addTemplate TigerGunBase
ObjectTemplate.setPosition 0/0.325/1.295
ObjectTemplate.addTemplate TigerTowerHatch
ObjectTemplate.setPosition -0.792/0.95/-0.232
The problem is, when the tank is destroyed, it changes to the destroyed, black junk it does, which confuses my in why, and no turret flying in the air. what did I do wrong?
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
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Modified tank destruction

Post by Swaffy »

You still have "scrapmetal" on the list and you didn't add coordinates to "Tigerexplosion".
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Modified tank destruction

Post by Apache Thunder »

You need to have the turret wreck mesh be it's own object. Then have it spawn from an effect emitter tied to one of your scrap metal effects.

As for the turret object you have coded. You may need to remove the sink into land code:

Code: Select all

ObjectTemplate.create Bundle TigerDestroyedTurret
ObjectTemplate.geometry Tiger_Tow_M1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.mass 100
ObjectTemplate.destroyed 1
rem ObjectTemplate.sinkInToLandAfterDeathSpeed 1
ObjectTemplate.timeToLiveAfterDeath 20
rem --------------------------------------------------
ObjectTemplate.addTemplate e_FireSmallYellow
ObjectTemplate.addTemplate TigerGunBase
ObjectTemplate.setPosition 0/0.325/1.295
ObjectTemplate.addTemplate TigerTowerHatch
ObjectTemplate.setPosition -0.792/0.95/-0.232
I also added mass and defined the timeToLiveAfterDeath property.

Also make sure the turrent isn't being emitted inside the vehicles collision mesh. This may interfere with the upward movement it's supposed to have. So have it spawn above the tank at a distance that would ensure it isn't spawning side the vehicle's collision mesh.

Also, you didn't specify the required vector3 after the armor effect:

Code: Select all

ObjectTemplate.addArmorEffect 0 e_Tigerexplosion
It needs to have a position defined:

Code: Select all

ObjectTemplate.addArmorEffect 0 e_Tigerexplosion 0/0/0
If you don't specify the minimum required arguments for a command, the game will ignore the entire command. So pay close attention to that! ;)
ImageImageImage
I have cameras in your head!
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Modified tank destruction

Post by Vilespring »

I did all the modifying, adding a coordinate, copying and pasting the new turret, and no new results. The tanks still launches scrap metal, even though e_srapmetal was remmed out. Also, even though I changed the destroyed geometry to the normal hull, it still turns into the destroyed form. I though I was running the wrong mod, so I put a pole on top of the tank, and it was there. Either I'm doing something really stupid, or it's just ignoring me! :| (bets on I'm stupid! :lol: )
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: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Modified tank destruction

Post by Vilespring »

It was me being stupid. When I did all the editing but the pole adding I packed to the FHR RFA. :lol:
I knew it was me being a retard.

the only problem is the turret acts funny on the ground. It rocks all over the place, and it phases through vehicles and buildings. any solutions? other than that, it works great!
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
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Modified tank destruction

Post by Swaffy »

Vilespring wrote:the only problem is the turret acts funny on the ground. It rocks all over the place, and it phases through vehicles and buildings. any solutions? other than that, it works great!
Perhaps there's a way to make it collide with objects but make it go through the heightmap?
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Modified tank destruction

Post by Vilespring »

I could just turn off collision all together, making it just cosmetic.
I kinda wanted the turret to be usable as cover, but whatever.

could I put a box inside of it? would that work? :lol:
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
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Modified tank destruction

Post by Apache Thunder »

The mass for the tank turret isn't high enough. Try increasing it's mass. You can also add springs to it as that will help stabalize it.


If you don't want it to collide with the terrain use this command:

Code: Select all

ObjectTemplate.addToCollisionGroup c_CGLandsape
ImageImageImage
I have cameras in your head!
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Modified tank destruction

Post by BotHunter »

Take a look at the code for my Hoverjeep

http://bfmods.com/viewtopic.php?f=45&t=1630&start=10
Walk quietly and carry a sniper rifle
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Modified tank destruction

Post by Swaffy »

Apache Thunder wrote:

Code: Select all

ObjectTemplate.addToCollisionGroup c_CGLandsape
Precisely this! That way planes and other objects can collide with it but it will fall through the ground! (I think)
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Post Reply