damage_system of custom map

Ask questions, discuss ideas, get answers
maehnaebteheu
Posts: 18
Joined: Sat May 22, 2010 2:52 pm

Re: damage_system of custom map

Post by maehnaebteheu »

there's everything in original bf1942. I just made a new Grenade with new material but with templates from original bf. it loads all the geometries and textures. only sound an explosion effects are lost. Thougth I could link the soundfile to the original path in the mod archive.

for example instead of:

MaterialManager.attGroup 901
MaterialManager.defGroup 44
MaterialManager.damageMod 3.0
MaterialManager.setEffectTemplate e_ExplBazooka

this:

MaterialManager.attGroup 901
MaterialManager.defGroup 44
MaterialManager.damageMod 3.0
MaterialManager.setEffectTemplate "../../objects/effects/e_ExplBazooka/effects"

Don't think that I have to put all the sound and effect files into the map?



EDIT: now looked into the map with flettner and froggy. that's the way how I put for example the boat into the map. But I don't think that I have to do so with the effects and sound files because they are already in the mod?!
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: damage_system of custom map

Post by freddy »

it should work, if you look in the ObjectSpawnTemplates.con in that map you downloaded, you can see i have custom materials there with effects

on thing you must have tho, is that you must defined every material there is in the map or they cant collide with each other

ex

Code: Select all

rem * *** Bamboo Fence ***
MaterialManager.attGroup 853
MaterialManager.defGroup 116
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate BombSmallNS_Expl
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: damage_system of custom map

Post by Apache Thunder »

You can save the hassle and just have the grenade use a end effect instead of using the material system. Modify the code of your grenade by doing the following:

Code: Select all

ObjectTemplate.active GrenadeAllies
ObjectTemplate.useMMOnEndEffect 0
ObjectTemplate.endEffectTemplate e_explGranade
The endEffectTemplate code tells the game what end effect to use. However if the useMMOnEndEffect is turned on, then the material system overrides this and will use a end effect defined in the damage system depending on what material the grenade was touching when it explodes. If you wish to have more consistancy and save some time coding you can just turn the code off and use the endEffectTemplate code which will make the grenade use the same effect always and never rely on the damage system. :D

If your map is using the GrenadeAxis, be sure to change that one too. ;)

You still have to define the materials you want the grenade to collide with though. But you won't have to worry about defining a effect for all the materials you set up for the grenade.

I think in the vanilla files the endEffectTemplate code is already there so you may only have to use the MMOnEndEffect code on your map. Unless you intend on using a different effect for your grenade.
ImageImageImage
I have cameras in your head!
maehnaebteheu
Posts: 18
Joined: Sat May 22, 2010 2:52 pm

Re: damage_system of custom map

Post by maehnaebteheu »

well nice .. this works with the end effect :)

but now I wanted to this also for the BazookaProjectile because this doesn't explode, too ... but here it doesn't work :(
There are many different effects for different materials. It would be enough if theres one effect (small explosion) for every hit on my map. But at the moment the projectile only disappears ;)

My Bazooka also makes no sound when firing and I don't know why :/ But this could I fix by an active code instead of create

Also tried with ObjectTemplate.collisionEffectTemplate ? :)


PS: A general question: The ObjectTemplate.active code only works if I put it in the ObjectsSpawnTemplates.con of the game mode. Is this normal?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: damage_system of custom map

Post by Apache Thunder »

The endEffectTemplate should work on any projectile provided that the usMMOnEndEffect code is turned off.

After checking the code it appears it uses a "hasCollisionEffect" code. It is logical to believe that turning this off will also be required before it will work.
(note that it is turned off on the grenades. There's you clue right there. :D )

Code: Select all

ObjectTemplate.active BazookaProjectile
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.useMMOnEndEffect 0
ObjectTemplate.endEffectTemplate e_ExplBazooka
Firing sound is weapon related. Check your handweapon code. There is perhaps an issue with a sound script somewhere.

The hasCollisionEffect command tells the game that the projectile has uses the damage system to have an effect when ever it touches a material. This is not the same as the useMMOnEndEffect. The effects made with that only appear when the projectile dies. Hence using collision effect on landmines and c4 and such is a bad idea and will lag like hell. This is why for things like grenades and other thigns that don't die on contact, the hasCollisionEffect code is turned off. The vanilla BazookaProjectile has it turned on because it dies on contact. But if you want to specify a end effect for it, collisionEffect code must be turned off.

Also, the "collisionEffectTemplate" code you tried doesn't exist. The easiest way to check if a code will work or not is to go here:

http://www.velotech.net/battlefield/commands.php

It has a nice database of all commands that are available in BF1942 and BFVietnam. It also shows what objects each command is valid for and whether or not it was used in the vanilla files.
ImageImageImage
I have cameras in your head!
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: damage_system of custom map

Post by freddy »

you must separate on direct damage and splashdamage, the nades org material 1 doesnt harm anything but has all collisions and materials setup so usually just keep mat 1 and change mat 2, zookas on the other hand has both direct damage and splashdamage so if you change material 1 there and dont have collisions setup properly with other material it will just pass straight throw it, even the ground.
maehnaebteheu
Posts: 18
Joined: Sat May 22, 2010 2:52 pm

Re: damage_system of custom map

Post by maehnaebteheu »

sound works now. but the bazooka explosion doesn't work. I also tried ObjectTemplate.dieAfterColl 1 for example. Maybe bf doesn't know when it's time for the endEffect of the bazooka? Don't know what to do .. tried many things .. :(

btw: as startEffectTemplate it works ;)
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Post by freddy »

Apache Thunder wrote:
The hasCollisionEffect command tells the game that the projectile has uses the damage system to have an effect when ever it touches a material. This is not the same as the useMMOnEndEffect. The effects made with that only appear when the projectile dies.
maehnaebteheu
Posts: 18
Joined: Sat May 22, 2010 2:52 pm

Re: damage_system of custom map

Post by maehnaebteheu »

this is why I tried ObjectTemplate.dieAfterColl 1
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Post by freddy »

post the code your using for zook
Post Reply